airlst / rector-config
Rector config for AirLST projects
Installs: 8 075
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^8.2
- driftingly/rector-laravel: 1.2.5
- rector/rector: 1.2.10
Requires (Dev)
- airlst/php-cs-fixer-config: ^2.6.0
- airlst/phpstan-config: ^10.0.2
- ergebnis/composer-normalize: ^2.44
README
Rector config for AirLST projects.
Installation
You can install the package via Composer:
composer require --dev airlst/rector-config
Usage
Create a rector.php
in the root of your project with the following contents:
<?php declare(strict_types=1); $factory = new Airlst\RectorConfig\Factory(['src']); return $factory->create();
The constructor of the Factory
class takes an array of paths to be scanned for PHP files and fixed. You can pass any number of paths to it.
The method returns an instance of Rector\Configuration\RectorConfigBuilder
which can be further configured.
For example, you can instruct Rector to use file cache:
<?php declare(strict_types=1); $factory = new Airlst\RectorConfig\Factory(['src']); return $factory ->create() ->withCache('cache/rector');
Using Laravel rules
You can use predefined Laravel rules by chaining the withLaravelRules()
method before calling create()
:
<?php declare(strict_types=1); $factory = new Airlst\RectorConfig\Factory(['src']); return $factory ->withLaravelRules() ->create();
Running Rector
Run Rector with the following command:
./vendor/bin/rector
Skipping rules
You can skip certain rules by chaining the withSkip()
method before calling create()
:
<?php declare(strict_types=1); $factory = new Airlst\RectorConfig\Factory(['src']); return $factory ->withSkip([ Rector\DeadCode\Rector\PropertyProperty\RemoveNullPropertyInitializationRector::class, ]) ->create();
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
License
The MIT License (MIT). Please see License File for more information.