Skip to content

Commit

Permalink
[bug] fix deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
kbond committed Jan 9, 2021
1 parent 0d084b2 commit eed6f12
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"php": ">=7.2.5"
},
"require-dev": {
"phpunit/phpunit": "^8.5.0"
"phpunit/phpunit": "^8.5.0",
"symfony/phpunit-bridge": "^5.2"
},
"config": {
"preferred-install": "dist",
Expand Down
4 changes: 4 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@
<directory>./src/</directory>
</whitelist>
</filter>

<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
</listeners>
</phpunit>
12 changes: 11 additions & 1 deletion src/Callback/Parameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,17 @@ final public function resolve(\ReflectionParameter $parameter)
{
$value = $this->valueFor($parameter);

return $value instanceof ValueFactory ? $value($parameter->getType()) : $value;
if (!$value instanceof ValueFactory) {
return $value;
}

$type = $parameter->getType();

if (!$type instanceof \ReflectionNamedType) {
return $value(null);
}

return $value($type->getName());
}

abstract public function type(): string;
Expand Down

0 comments on commit eed6f12

Please sign in to comment.