diff --git a/compat-tests/composer.json b/compat-tests/composer.json index f80e8e11cde..c78af07d4e4 100644 --- a/compat-tests/composer.json +++ b/compat-tests/composer.json @@ -5,7 +5,7 @@ "require-dev": { "php": "^8.2", "phpunit/phpunit": "10.*|11.*|12.*", - "nikic/php-parser": "5.4.*|5.5.*|5.6.*|5.7.*", + "nikic/php-parser": "5.4.*|5.5.*|5.6.*|5.7.*|5.8.*", "rector/rector": "dev-main as 2.4.4", "phpstan/phpstan": "^2.2", "driftingly/rector-laravel": "^2.4" diff --git a/composer.json b/composer.json index e638c2e295e..9beb2a596c9 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "doctrine/inflector": "^2.1", "illuminate/container": "12.39.*", "nette/utils": "^4.1.4", - "nikic/php-parser": "^5.7", + "nikic/php-parser": "^5.8", "ondram/ci-detector": "^4.2", "phpstan/phpdoc-parser": "^2.3", "phpstan/phpstan": "^2.2.2", diff --git a/rules/Php70/EregToPcreTransformer.php b/rules/Php70/EregToPcreTransformer.php index 5f71e4e6cf9..4c28dc7d36b 100644 --- a/rules/Php70/EregToPcreTransformer.php +++ b/rules/Php70/EregToPcreTransformer.php @@ -245,6 +245,7 @@ private function processSquareBracket(string $s, int $i, int $l, string $cls, bo $cls .= $this->_ere2pcre_escape($a) . '\-'; break; } + if (ord($a) > ord($b)) { $errorMessage = sprintf('an invalid character range %d-%d"', (int) $a, (int) $b); throw new InvalidEregException($errorMessage); diff --git a/rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeForArrayMapRector.php b/rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeForArrayMapRector.php index 62f859477c6..2b16507403d 100644 --- a/rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeForArrayMapRector.php +++ b/rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeForArrayMapRector.php @@ -117,6 +117,7 @@ public function refactor(Node $node): ?Node $values = []; break; } + if ($value instanceof UnionType) { $values = [...$values, ...$value->getTypes()]; } @@ -127,6 +128,7 @@ public function refactor(Node $node): ?Node $keys = []; break; } + if ($key instanceof UnionType) { $keys = [...$keys, ...$key->getTypes()]; }