Skip to content

Commit 6e9d843

Browse files
authored
Fix PHPStan notice on PHPStan 2.1.23 (#545)
1 parent eafbe16 commit 6e9d843

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

rules/PHPUnit80/Rector/MethodCall/SpecificAssertContainsRector.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ public function refactor(Node $node): ?Node
9494
}
9595

9696
$methodName = $this->getName($node->name);
97+
if ($methodName === null) {
98+
return null;
99+
}
100+
97101
$newMethodName = self::OLD_TO_NEW_METHOD_NAMES[$methodName];
98102
$node->name = new Identifier($newMethodName);
99103

rules/PHPUnit90/Rector/MethodCall/SpecificAssertContainsWithoutIdentityRector.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ public function refactor(Node $node): ?Node
117117
/* here we search for element of array without identity check and we can replace functions */
118118
$methodName = $this->getName($node->name);
119119

120+
if ($methodName === null) {
121+
return null;
122+
}
123+
120124
$node->name = new Identifier(self::OLD_METHODS_NAMES_TO_NEW_NAMES['string'][$methodName]);
121125
unset($node->args[3], $node->args[4]);
122126

0 commit comments

Comments
 (0)