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

Commit d6c0f99

Browse files
authored
fix reflection deprecated php 8.0 methods
1 parent 3918e66 commit d6c0f99

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Method.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,12 @@ public static function match(\ReflectionMethod $method): bool
6464
if ($method->getNumberOfParameters() != 2) {
6565
return false;
6666
}
67+
68+
$ctxType = $method->getParameters()[0]->getType();
69+
$inType = $method->getParameters()[1]->getType();
6770

68-
$ctx = $method->getParameters()[0]->getClass();
69-
$in = $method->getParameters()[1]->getClass();
71+
$ctx = $ctxType && ! $ctxType->isBuiltin() ? new \ReflectionClass($ctxType->getName()) : null;
72+
$in = $inType && ! $inType->isBuiltin() ? new \ReflectionClass($inType->getName()) : null;
7073

7174
if (empty($ctx) || !$ctx->implementsInterface(ContextInterface::class)) {
7275
return false;
@@ -110,7 +113,7 @@ public static function parse(\ReflectionMethod $method): Method
110113

111114
$m = new self();
112115
$m->name = $method->getName();
113-
$m->input = $method->getParameters()[1]->getClass()->getName();
116+
$m->input = $method->getParameters()[1]->getType()->getName();
114117
$m->output = $method->getReturnType()->getName();
115118

116119
return $m;

0 commit comments

Comments
 (0)