Skip to content
This repository was archived by the owner on Jan 21, 2022. It is now read-only.

Commit da59a93

Browse files
authored
Merge pull request #55 from lampatrampa/bugfix/reflection-deprecated
fix reflection deprecated php 8.0 methods
2 parents 3918e66 + db2c503 commit da59a93

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/Method.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,10 @@ public static function match(\ReflectionMethod $method): bool
6464
if ($method->getNumberOfParameters() != 2) {
6565
return false;
6666
}
67-
68-
$ctx = $method->getParameters()[0]->getClass();
69-
$in = $method->getParameters()[1]->getClass();
67+
$ctxType = $method->getParameters()[0]->getType();
68+
$inType = $method->getParameters()[1]->getType();
69+
$ctx = $ctxType && $ctxType instanceof \ReflectionNamedType && !$ctxType->isBuiltin() ? new \ReflectionClass($ctxType->getName()) : null;
70+
$in = $inType && $inType instanceof \ReflectionNamedType && ! $inType->isBuiltin() ? new \ReflectionClass($inType->getName()) : null;
7071

7172
if (empty($ctx) || !$ctx->implementsInterface(ContextInterface::class)) {
7273
return false;
@@ -110,7 +111,7 @@ public static function parse(\ReflectionMethod $method): Method
110111

111112
$m = new self();
112113
$m->name = $method->getName();
113-
$m->input = $method->getParameters()[1]->getClass()->getName();
114+
$m->input = $method->getParameters()[1]->getType()->getName();
114115
$m->output = $method->getReturnType()->getName();
115116

116117
return $m;

0 commit comments

Comments
 (0)