Skip to content

Commit

Permalink
Fix getReflectionFunction
Browse files Browse the repository at this point in the history
  • Loading branch information
GromNaN committed Oct 10, 2024
1 parent f1e9ba2 commit 8ef89ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2338,6 +2338,12 @@
</RiskyTruthyFalsyComparison>
</file>
<file src="tests/Internal/Codebase/InternalCallMapHandlerTest.php">
<MixedInferredReturnType>
<code><![CDATA[?ReflectionFunctionAbstract]]></code>
</MixedInferredReturnType>
<MixedReturnStatement>
<code><![CDATA[ReflectionMethod::createFromMethodName($functionName)]]></code>
</MixedReturnStatement>
<RiskyTruthyFalsyComparison>
<code><![CDATA[empty($normalizedEntry['type'])]]></code>
</RiskyTruthyFalsyComparison>
Expand Down
4 changes: 2 additions & 2 deletions tests/Internal/Codebase/InternalCallMapHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -521,10 +521,10 @@ private function getReflectionFunction(string $functionName): ?ReflectionFunctio
try {
if (strpos($functionName, '::') !== false) {
if (PHP_VERSION_ID < 8_03_00) {
[$className, , $methodName] = explode(':', $functionName, 3);
return new ReflectionMethod($className, $methodName);
return new ReflectionMethod($functionName);
}

/** @psalm-suppress UndefinedMethod */
return ReflectionMethod::createFromMethodName($functionName);
}

Expand Down

0 comments on commit 8ef89ff

Please sign in to comment.