Package

Stevebauman Unfinalize

Permanently remove final keywords from vendor packages.

Package

stevebauman/unfinalize

View on GitHub →

Unfinalize

Unleash the freedom lost with open source PHP packages marking classes and methods as final.


Unfinalize uses PHP CS Fixer to permanently remove final keywords from composer vendor packages:

- final class Foo
+ class Foo
{
-   final public function bar()
+   public function bar()
    {
        // ...
    }
}
  • Updates to PHP files are done safely, quickly, and performant.
  • Changes are stored permanently. There is no performance impact using Unfinalize.
  • No additional dependencies to your application. Unfinalize and its dependencies are compiled into a single phar file.

Installation

composer require stevebauman/unfinalize

Usage

Inside your composer.json file, add the vendor packages you want to remove the final keywords from inside:

{
    "unfinalize": [
        "vendor/package"
    ]
}

Add the unfinalize command to your composer.json so it runs on composer update:

{
  "scripts": {
    "post-update-cmd": [
      "@php vendor/bin/unfinalize run"
    ]
  }
}

Then, run composer update.

Options

--mark-final

If you would like final classes and methods to be marked with a @final doc block, you may add the --mark-final option to the unfinalize command:

{
  "scripts": {
    "post-update-cmd": [
      "@php vendor/bin/unfinalize run --mark-final"
    ]
  }
}

Which will produce:

Before:

final class Foo
{
    final public function bar()
    {
        // ...
    }
}

After:

/**
 * @final
 */
class Foo
{
    /**
     * @final
     */
    public function bar()
    {
        // ...
    }
}
--dry

Execute a dry run to see what files will be modified by PHP CS Fixer.

Stevebauman Unfinalize Related Articles

Remove "final" keywords from classes and methods in vendor packages with Unfinalize image

Remove "final" keywords from classes and methods in vendor packages with Unfinalize

Read article
Dynamic Cache, Database, and Mail Builders in Laravel 11.31 image

Dynamic Cache, Database, and Mail Builders in Laravel 11.31

Read article
"In Array Keys" Validation Rule Added in Laravel 12.16 image

"In Array Keys" Validation Rule Added in Laravel 12.16

Read article
URI Parsing and Mutation in Laravel 11.35 image

URI Parsing and Mutation in Laravel 11.35

Read article
Use Laravel Dusk to Test JS-Based Applications image

Use Laravel Dusk to Test JS-Based Applications

Read article
Access Request Data Fluently in Laravel 11.34 image

Access Request Data Fluently in Laravel 11.34

Read article

Pushsilver

Pushsilver is simple invoicing for freelancers and small studios — send polished invoices, automate reminders, and get paid on time without the bloat.

Pushsilver

Acquaint Softtech

Acquaint Softtech offers AI-ready Laravel developers who onboard in 48 hours at $3000/Month with no lengthy sales process and a 100 percent money-back guarantee.

Acquaint Softtech

Let your users buy domains without leaving your app

If your Laravel app gives users a site, a storefront, or a workspace, they’ll eventually want their own domain. The name.com API lets them search, register, and connect one without leaving your product. It’s a clean REST API, so Laravel’s HTTP client is all you need.

Let your users buy domains without leaving your app

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing