diff --git a/phpstan.neon b/phpstan.neon index 429e9f6e8d5..854020bdd80 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -340,3 +340,7 @@ parameters: identifier: rector.upgradeDowngradeRegisteredInSet count: 1 path: rules/Php74/Rector/Double/RealToFloatTypeCastRector.php + + - + message: '#Offset float\|int\|string might not exist on string#' + path: rules/Php70/EregToPcreTransformer.php diff --git a/rules/CodingStyle/Rector/Stmt/NewlineAfterStatementRector.php b/rules/CodingStyle/Rector/Stmt/NewlineAfterStatementRector.php index b89d65724ef..857ca35b2cb 100644 --- a/rules/CodingStyle/Rector/Stmt/NewlineAfterStatementRector.php +++ b/rules/CodingStyle/Rector/Stmt/NewlineAfterStatementRector.php @@ -129,7 +129,9 @@ private function processAddNewLine( continue; } + /** @var Stmt $stmt */ $endLine = $stmt->getEndLine(); + /** @var Stmt $nextStmt */ $line = $nextStmt->getStartLine(); $rangeLine = $line - $endLine; diff --git a/rules/Php70/Rector/FuncCall/CallUserMethodRector.php b/rules/Php70/Rector/FuncCall/CallUserMethodRector.php index 986a476dae1..3cd9809bb2c 100644 --- a/rules/Php70/Rector/FuncCall/CallUserMethodRector.php +++ b/rules/Php70/Rector/FuncCall/CallUserMethodRector.php @@ -67,6 +67,10 @@ public function refactor(Node $node): ?Node return null; } + if (! isset(self::OLD_TO_NEW_FUNCTIONS[$this->getName($node)])) { + return null; + } + $newName = self::OLD_TO_NEW_FUNCTIONS[$this->getName($node)]; $node->name = new Name($newName); diff --git a/rules/Php73/Rector/FuncCall/ArrayKeyFirstLastRector.php b/rules/Php73/Rector/FuncCall/ArrayKeyFirstLastRector.php index 2350eec1bbe..63a65592cf8 100644 --- a/rules/Php73/Rector/FuncCall/ArrayKeyFirstLastRector.php +++ b/rules/Php73/Rector/FuncCall/ArrayKeyFirstLastRector.php @@ -147,6 +147,10 @@ private function processArrayKeyFirstLast( continue; } + if (! isset(self::PREVIOUS_TO_NEW_FUNCTIONS[$this->getName($stmt->expr)])) { + continue; + } + $newName = self::PREVIOUS_TO_NEW_FUNCTIONS[$this->getName($stmt->expr)]; $keyFuncCall->name = new Name($newName); diff --git a/rules/Php81/Rector/FuncCall/NullToStrictStringFuncCallArgRector.php b/rules/Php81/Rector/FuncCall/NullToStrictStringFuncCallArgRector.php index 212d4a4292b..b4b177ee061 100644 --- a/rules/Php81/Rector/FuncCall/NullToStrictStringFuncCallArgRector.php +++ b/rules/Php81/Rector/FuncCall/NullToStrictStringFuncCallArgRector.php @@ -142,7 +142,7 @@ public function provideMinPhpVersion(): int private function resolveNamedPositions(FuncCall $funcCall, array $args): array { $functionName = $this->getName($funcCall); - $argNames = NameNullToStrictNullFunctionMap::FUNCTION_TO_PARAM_NAMES[$functionName]; + $argNames = NameNullToStrictNullFunctionMap::FUNCTION_TO_PARAM_NAMES[$functionName] ?? []; $positions = []; foreach ($args as $position => $arg) {