diff --git a/src/Configuration/PhpLevelSetResolver.php b/src/Configuration/PhpLevelSetResolver.php index aa3a646c230..cd1deb955d8 100644 --- a/src/Configuration/PhpLevelSetResolver.php +++ b/src/Configuration/PhpLevelSetResolver.php @@ -33,6 +33,7 @@ final class PhpLevelSetResolver PhpVersion::PHP_82 => SetList::PHP_82, PhpVersion::PHP_83 => SetList::PHP_83, PhpVersion::PHP_84 => SetList::PHP_84, + PhpVersion::PHP_85 => SetList::PHP_85, ]; /** diff --git a/src/Configuration/RectorConfigBuilder.php b/src/Configuration/RectorConfigBuilder.php index 670ec6866fc..588aec729d7 100644 --- a/src/Configuration/RectorConfigBuilder.php +++ b/src/Configuration/RectorConfigBuilder.php @@ -547,7 +547,9 @@ public function withPhpSets( bool $php55 = false, bool $php54 = false, bool $php53 = false, - bool $php84 = false, // place on later as BC break when used in php 7.x without named arg + // place on later as BC break when used in php 7.x without named arg + bool $php84 = false, + bool $php85 = false, ): self { if ($this->isWithPhpSetsUsed === true) { throw new InvalidConfigurationException(sprintf( @@ -637,6 +639,8 @@ public function withPhpSets( $targetPhpVersion = PhpVersion::PHP_83; } elseif ($php84) { $targetPhpVersion = PhpVersion::PHP_84; + } elseif ($php85) { + $targetPhpVersion = PhpVersion::PHP_85; } else { throw new InvalidConfigurationException('Invalid PHP version set'); } diff --git a/tests/Issues/WithPhpSets/Fixture/fixture.php.inc b/tests/Issues/WithPhpSets/Fixture/fixture.php.inc new file mode 100644 index 00000000000..bfa3ec8764e --- /dev/null +++ b/tests/Issues/WithPhpSets/Fixture/fixture.php.inc @@ -0,0 +1,27 @@ + +----- + diff --git a/tests/Issues/WithPhpSets/WithPhpSetsTest.php b/tests/Issues/WithPhpSets/WithPhpSetsTest.php new file mode 100644 index 00000000000..0798a2fd054 --- /dev/null +++ b/tests/Issues/WithPhpSets/WithPhpSetsTest.php @@ -0,0 +1,28 @@ +doTestFile($filePath); + } + + public static function provideData(): Iterator + { + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + } + + public function provideConfigFilePath(): string + { + return __DIR__ . '/config/configured_rule.php'; + } +} diff --git a/tests/Issues/WithPhpSets/config/configured_rule.php b/tests/Issues/WithPhpSets/config/configured_rule.php new file mode 100644 index 00000000000..03bfeb78f96 --- /dev/null +++ b/tests/Issues/WithPhpSets/config/configured_rule.php @@ -0,0 +1,10 @@ +withPhpSets(php85: true) + ->withPhpVersion(PhpVersion::PHP_85); \ No newline at end of file