Skip to content

Commit

Permalink
Describe autoloading of classes from PHAR file
Browse files Browse the repository at this point in the history
  • Loading branch information
Aeliot-Tm committed Aug 30, 2024
1 parent 3b4df30 commit 7892fa1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 |
Expand Down

0 comments on commit 7892fa1

Please sign in to comment.