-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Closed
Description
Symfony version(s) affected: 4.4.18
Description
symfony/src/Symfony/Component/DependencyInjection/Exception/InvalidParameterTypeException.php
Line 28 in 9b719ab
parent::__construct(sprintf('Invalid definition for service "%s": argument %d of "%s::%s()" accepts "%s", "%s" passed.', $serviceId, 1 + $parameter->getPosition(), $parameter->getDeclaringClass()->getName(), $parameter->getDeclaringFunction()->getName(), $acceptedType, $type)); |
$parameter->getDeclaringClass()->getName()
fails because getDeclaringClass
returns null.
This only happens on PHP 8 because
Line 155 in fe91b86
->setFactory('current') |
current
in PHP 8 will result in a parameter type hint being array|object
, while PHP 7 did not have a type hint: https://3v4l.org/YKHtO and apparently Symfony also does not support union types as per @nicolas-grekas.
How to reproduce
I could not reduce it to a minimal repro case sorry
derrabus