Skip to content

Commit

Permalink
Fix getReflectionFunction
Browse files Browse the repository at this point in the history
  • Loading branch information
GromNaN committed Oct 9, 2024
1 parent f1e9ba2 commit a918ce8
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);

Check failure on line 528 in tests/Internal/Codebase/InternalCallMapHandlerTest.php

View workflow job for this annotation

GitHub Actions / build

UndefinedMethod

tests/Internal/Codebase/InternalCallMapHandlerTest.php:528:24: UndefinedMethod: Method ReflectionMethod::createfrommethodname does not exist (see https://psalm.dev/022)
}

Expand Down

0 comments on commit a918ce8

Please sign in to comment.