From 7892fa18a76f142d694c6b778d5eca7f18f612cc Mon Sep 17 00:00:00 2001 From: Anatoliy Melnikov <5785276@gmail.com> Date: Fri, 30 Aug 2024 22:38:36 +0300 Subject: [PATCH] Describe autoloading of classes from PHAR file --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 6ebdac8..5d313da 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,8 @@ So, it's some work around till baseline will be implemented in the PHP CS Fixer. It expects `.php-cs-fixer-finder.php` at the root of the project. 3. Add filtering of files detected by Finder ```php + use Aeliot\PhpCsFixerBaseline\Service\FilterFactory; + $finder->filter((new FilterFactory())->createFilter(__DIR__ . '/.php-cs-fixer-baseline.json', $config)); ``` 4. Generate baseline. Just call script without options when all config files uses default names. @@ -31,6 +33,15 @@ So, it's some work around till baseline will be implemented in the PHP CS Fixer. You can see how it is configured in this project. +### Autoload classes from PHAR + +If you use this project as PHAR file, you need to require autoloader of it to use provided filter. +Do it in the main config file of PHP CS Fixer (`.php-cs-fixer.dist.php`) +```php +Phar::loadPhar('/path/to/pcsf-baseline.phar', 'pcsf-baseline.phar'); +require_once 'phar://pcsf-baseline.phar/vendor/autoload.php'; +``` + ### Options of baseline generator | Short name | Long name | Description | Default value |