mirror of
https://github.com/j0k3r/php-readability.git
synced 2026-09-26 22:16:12 +00:00
Rector: Upgrade configuration
This commit is contained in:
+9
-10
@@ -2,31 +2,30 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Rector\Core\Configuration\Option;
|
use Rector\Config\RectorConfig;
|
||||||
use Rector\Core\ValueObject\PhpVersion;
|
use Rector\Core\ValueObject\PhpVersion;
|
||||||
use Rector\Set\ValueObject\LevelSetList;
|
use Rector\Set\ValueObject\LevelSetList;
|
||||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
|
||||||
|
|
||||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
|
||||||
$parameters = $containerConfigurator->parameters();
|
|
||||||
|
|
||||||
|
return static function (RectorConfig $rectorConfig): void {
|
||||||
// paths to refactor; solid alternative to CLI arguments
|
// paths to refactor; solid alternative to CLI arguments
|
||||||
$parameters->set(Option::PATHS, [
|
$rectorConfig->paths([
|
||||||
__DIR__ . '/src',
|
__DIR__ . '/src',
|
||||||
__DIR__ . '/tests',
|
__DIR__ . '/tests',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Path to phpstan with extensions, that PHPSTan in Rector uses to determine types
|
// Path to phpstan with extensions, that PHPSTan in Rector uses to determine types
|
||||||
$parameters->set(Option::PHPSTAN_FOR_RECTOR_PATH, __DIR__ . '/phpstan.neon');
|
$rectorConfig->phpstanConfig(__DIR__ . '/phpstan.neon');
|
||||||
|
|
||||||
$parameters->set(Option::BOOTSTRAP_FILES, [
|
$rectorConfig->bootstrapFiles([
|
||||||
__DIR__ . '/vendor/bin/.phpunit/phpunit/vendor/autoload.php',
|
__DIR__ . '/vendor/bin/.phpunit/phpunit/vendor/autoload.php',
|
||||||
__DIR__ . '/vendor/autoload.php',
|
__DIR__ . '/vendor/autoload.php',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Define what rule sets will be applied
|
// Define what rule sets will be applied
|
||||||
$containerConfigurator->import(LevelSetList::UP_TO_PHP_72);
|
$rectorConfig->sets([
|
||||||
|
LevelSetList::UP_TO_PHP_72,
|
||||||
|
]);
|
||||||
|
|
||||||
// is your PHP version different from the one your refactor to?
|
// is your PHP version different from the one your refactor to?
|
||||||
$parameters->set(Option::PHP_VERSION_FEATURES, PhpVersion::PHP_72);
|
$rectorConfig->phpVersion(PhpVersion::PHP_72);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user