diff --git a/src/Configuration/RectorConfigBuilder.php b/src/Configuration/RectorConfigBuilder.php index 5d96678a1f..8dff9de935 100644 --- a/src/Configuration/RectorConfigBuilder.php +++ b/src/Configuration/RectorConfigBuilder.php @@ -158,9 +158,6 @@ final class RectorConfigBuilder private ?string $editorUrl = null; - /** - * @api soon to be used - */ private ?bool $isWithPhpSetsUsed = null; private ?bool $isWithPhpLevelUsed = null; @@ -533,6 +530,14 @@ public function withPhpSets( bool $php53 = false, bool $php84 = false, // place on later as BC break when used in php 7.x without named arg ): self { + if ($this->isWithPhpSetsUsed === true) { + throw new InvalidConfigurationException(sprintf( + 'Method "%s()" can be called only once. It always includes all previous sets UP TO the defined version.%sThe best practise is to call it once with no argument. That way it will pick up PHP version from composer.json and your project will always stay up to date.', + __METHOD__, + PHP_EOL + )); + } + $this->isWithPhpSetsUsed = true; $pickedArguments = array_filter(func_get_args());