Skip to content

Commit 0e50f45

Browse files
authored
Fix PHPStan notice on PHPStan 2.1.23 (#7236)
* Fix PHPStan notice on PHPStan 2.1.23 * skip complex logic
1 parent ed8e4d3 commit 0e50f45

File tree

5 files changed

+15
-1
lines changed

5 files changed

+15
-1
lines changed

phpstan.neon

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,3 +340,7 @@ parameters:
340340
identifier: rector.upgradeDowngradeRegisteredInSet
341341
count: 1
342342
path: rules/Php74/Rector/Double/RealToFloatTypeCastRector.php
343+
344+
-
345+
message: '#Offset float\|int\|string might not exist on string#'
346+
path: rules/Php70/EregToPcreTransformer.php

rules/CodingStyle/Rector/Stmt/NewlineAfterStatementRector.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,9 @@ private function processAddNewLine(
129129
continue;
130130
}
131131

132+
/** @var Stmt $stmt */
132133
$endLine = $stmt->getEndLine();
134+
/** @var Stmt $nextStmt */
133135
$line = $nextStmt->getStartLine();
134136
$rangeLine = $line - $endLine;
135137

rules/Php70/Rector/FuncCall/CallUserMethodRector.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ public function refactor(Node $node): ?Node
6767
return null;
6868
}
6969

70+
if (! isset(self::OLD_TO_NEW_FUNCTIONS[$this->getName($node)])) {
71+
return null;
72+
}
73+
7074
$newName = self::OLD_TO_NEW_FUNCTIONS[$this->getName($node)];
7175
$node->name = new Name($newName);
7276

rules/Php73/Rector/FuncCall/ArrayKeyFirstLastRector.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,10 @@ private function processArrayKeyFirstLast(
147147
continue;
148148
}
149149

150+
if (! isset(self::PREVIOUS_TO_NEW_FUNCTIONS[$this->getName($stmt->expr)])) {
151+
continue;
152+
}
153+
150154
$newName = self::PREVIOUS_TO_NEW_FUNCTIONS[$this->getName($stmt->expr)];
151155
$keyFuncCall->name = new Name($newName);
152156

rules/Php81/Rector/FuncCall/NullToStrictStringFuncCallArgRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public function provideMinPhpVersion(): int
142142
private function resolveNamedPositions(FuncCall $funcCall, array $args): array
143143
{
144144
$functionName = $this->getName($funcCall);
145-
$argNames = NameNullToStrictNullFunctionMap::FUNCTION_TO_PARAM_NAMES[$functionName];
145+
$argNames = NameNullToStrictNullFunctionMap::FUNCTION_TO_PARAM_NAMES[$functionName] ?? [];
146146
$positions = [];
147147

148148
foreach ($args as $position => $arg) {

0 commit comments

Comments
 (0)