diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8aaab4b1..afbcd763 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,7 +8,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest] - php: ['8.0', '8.1', '8.2', '8.3'] + php: ['8.0', '8.1', '8.2', '8.3', '8.4'] fail-fast: false diff --git a/composer.json b/composer.json index d0875794..74bd6183 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ } ], "require": { - "php": "8.0 - 8.3" + "php": "8.0 - 8.4" }, "require-dev": { "nette/tester": "^2.5", diff --git a/src/Utils/Callback.php b/src/Utils/Callback.php index 732af967..2804baa3 100644 --- a/src/Utils/Callback.php +++ b/src/Utils/Callback.php @@ -93,8 +93,8 @@ public static function toReflection($callable): \ReflectionMethod|\ReflectionFun $callable = self::unwrap($callable); } - if (is_string($callable) && str_contains($callable, '::')) { - return new ReflectionMethod($callable); + if (is_string($callable) && str_contains($callable, '::')) { + return new ReflectionMethod(...explode('::', $callable, 2)); } elseif (is_array($callable)) { return new ReflectionMethod($callable[0], $callable[1]); } elseif (is_object($callable) && !$callable instanceof \Closure) { diff --git a/src/Utils/Reflection.php b/src/Utils/Reflection.php index 5a4f2ab7..36487aa7 100644 --- a/src/Utils/Reflection.php +++ b/src/Utils/Reflection.php @@ -100,7 +100,7 @@ public static function getMethodDeclaringMethod(\ReflectionMethod $method): \Ref $hash = [$method->getFileName(), $method->getStartLine(), $method->getEndLine()]; if (($alias = $decl->getTraitAliases()[$method->name] ?? null) - && ($m = new \ReflectionMethod($alias)) + && ($m = new \ReflectionMethod(...explode('::', $alias, 2))) && $hash === [$m->getFileName(), $m->getStartLine(), $m->getEndLine()] ) { return self::getMethodDeclaringMethod($m); @@ -125,7 +125,7 @@ public static function getMethodDeclaringMethod(\ReflectionMethod $method): \Ref public static function areCommentsAvailable(): bool { static $res; - return $res ?? $res = (bool) (new \ReflectionMethod(__METHOD__))->getDocComment(); + return $res ?? $res = (bool) (new \ReflectionMethod(__CLASS__, __FUNCTION__))->getDocComment(); }