Skip to content

Commit

Permalink
Merge pull request #16 from darckking/fix/deprecation-warning
Browse files Browse the repository at this point in the history
fix: ReflectionParameter::getClass deprecated since PHP 8.0.0
  • Loading branch information
Ocramius authored Jul 5, 2022
2 parents cfb688b + 4966f82 commit 9299687
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
"forum": "https://discourse.laminas.dev"
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
},
"sort-packages": true
},
"extra": {
Expand Down
6 changes: 4 additions & 2 deletions src/ParameterMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Laminas\Stdlib\ResponseInterface;
use ReflectionException;
use ReflectionFunction;
use ReflectionNamedType;
use ReflectionObject;

use function count;
Expand Down Expand Up @@ -68,8 +69,9 @@ public function getMatchedParameters($callable, $parameters): array
foreach ($reflMethodParams as $reflMethodParam) {
$paramName = $reflMethodParam->getName();
$normalMethodParamName = str_replace(['-', '_'], '', strtolower($paramName));
if ($reflectionTypehint = $reflMethodParam->getClass()) {
$typehint = $reflectionTypehint->getName();
$reflectionType = $reflMethodParam->getType();
if ($reflectionType instanceof ReflectionNamedType && ! $reflectionType->isBuiltin()) {
$typehint = $reflectionType->getName();

if (
$typehint === PhpEnvironmentRequest::class
Expand Down

0 comments on commit 9299687

Please sign in to comment.