- PHP 74.2%
- Shell 24.8%
- JavaScript 1%
| scripts | ||
| src | ||
| .editorconfig | ||
| .gitignore | ||
| .php-cs-fixer.php | ||
| bun.lock | ||
| commitlint.config.js | ||
| composer.json | ||
| herd.yml | ||
| lefthook.yml | ||
| LICENSE | ||
| mise.toml | ||
| package.json | ||
| phpstan.neon | ||
| phpunit.xml | ||
| publish.env.example | ||
| README.md | ||
| rector.php | ||
Rector Config
A helper for my Rector configurations
Installation
Add my Composer repository to your composer.json:
{
"repositories": [
{
"type": "composer",
"url": "https://code.rvx.works/api/packages/RVxLab/composer"
}
]
}
Then require the package:
composer require rvxlab/rector-config
Add the following to your rector.php:
use RVxLab\RectorConfig\RectorConfigurator;
return RectorConfigurator::defaultPreset()
->withBasePath(__DIR__)
->getConfigBuilder();
The call to withBasePath(__DIR__) is required, otherwise a ConfigurationException will be thrown.
Presets
defaultPreset()- Default configuration. Makes no path assumptions
laravelPreset()- Configuration for Laravel applications. Sets up app, bootstrap, database, and tests directories
packagePreset()- Configuration for PHP packages. Sets up src and tests directories
Configuration Options
Adding Paths
Adding paths can be done with the withPaths() methods.
The paths are relative to the base path set using withBasePath().
Removing Paths
Removing paths can be done with the withoutPaths() methods.
The paths are relative to the base path set using withBasePath().
Adding Skips
Skips can be configured with the addSkip() and addSkips() methods.
addSkip() with just the rector class will add it if it wasn't defined already.
Calling it with a rector class and parameters will try to merge the parameters with the existing ones, or overwrite them
if the $override flag is set to true.
addSkips() does the same as addSkip(), but for multiple rector classes in an array. The structure mimics the
withSkips method from Rector.
License
This package is licensed under the MIT License.