Skip to content

Commit

Permalink
Calling new ReflectionMethod with a single argument is deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
GromNaN committed Sep 18, 2024
1 parent 9fa730e commit af55f65
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/Internal/Codebase/InternalCallMapHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
use const PHP_MAJOR_VERSION;
use const PHP_MINOR_VERSION;
use const PHP_VERSION;
use const PHP_VERSION_ID;

/** @group callmap */
class InternalCallMapHandlerTest extends TestCase
Expand Down Expand Up @@ -519,7 +520,11 @@ private function getReflectionFunction(string $functionName): ?ReflectionFunctio
{
try {
if (strpos($functionName, '::') !== false) {
return new ReflectionMethod($functionName);
if (PHP_VERSION_ID < 803000) {
[$className, , $methodName] = explode(':', $functionName, 3);

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

View workflow job for this annotation

GitHub Actions / build

PossiblyUndefinedArrayOffset

tests/Internal/Codebase/InternalCallMapHandlerTest.php:524:36: PossiblyUndefinedArrayOffset: Possibly undefined array key (see https://psalm.dev/167)
return new ReflectionMethod($className, $methodName);

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

View workflow job for this annotation

GitHub Actions / build

ArgumentTypeCoercion

tests/Internal/Codebase/InternalCallMapHandlerTest.php:525:49: ArgumentTypeCoercion: Argument 1 of ReflectionMethod::__construct expects class-string|object, but parent type string provided (see https://psalm.dev/193)
}
return ReflectionMethod::createFromMethodName($functionName);

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

View workflow job for this annotation

GitHub Actions / build

UndefinedMethod

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

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

View workflow job for this annotation

GitHub Actions / build

MixedReturnStatement

tests/Internal/Codebase/InternalCallMapHandlerTest.php:527:24: MixedReturnStatement: Could not infer a return type (see https://psalm.dev/138)
}

/** @var callable-string $functionName */
Expand Down

0 comments on commit af55f65

Please sign in to comment.