diff --git a/config/set/php-polyfills.php b/config/set/php-polyfills.php new file mode 100644 index 00000000000..2b17037ae23 --- /dev/null +++ b/config/set/php-polyfills.php @@ -0,0 +1,24 @@ +rules([ + ArrayKeyFirstLastRector::class, + IsCountableRector::class, + GetDebugTypeRector::class, + StrStartsWithRector::class, + StrEndsWithRector::class, + StrContainsRector::class, + ]); +}; diff --git a/src/Configuration/RectorConfigBuilder.php b/src/Configuration/RectorConfigBuilder.php index ebbb3dadd1c..82d737893ea 100644 --- a/src/Configuration/RectorConfigBuilder.php +++ b/src/Configuration/RectorConfigBuilder.php @@ -457,6 +457,9 @@ public function withPhpSets( $this->sets[] = LevelSetList::UP_TO_PHP_84; } + // make use of polyfill packages in composer.json + $this->sets[] = SetList::PHP_POLYFILLS; + return $this; } diff --git a/src/Set/ValueObject/SetList.php b/src/Set/ValueObject/SetList.php index d32666554f1..6c186df0e66 100644 --- a/src/Set/ValueObject/SetList.php +++ b/src/Set/ValueObject/SetList.php @@ -11,6 +11,11 @@ */ final class SetList implements SetListInterface { + /** + * @var string + */ + public const PHP_POLYFILLS = __DIR__ . '/../../../config/set/php-polyfills.php'; + /** * @var string */