Fix PHP 8 deprecations

This commit is contained in:
Nicolas Grekas 2020-07-08 19:07:26 +02:00
parent 207b0b5996
commit 3db0684037
4 changed files with 4 additions and 4 deletions

View File

@ -520,7 +520,7 @@ class SecurityExtension extends Extension
return $this->contextListeners[$contextKey] = $listenerId; return $this->contextListeners[$contextKey] = $listenerId;
} }
private function createAuthenticationListeners($container, $id, $firewall, &$authenticationProviders, $defaultProvider = null, array $providerIds, $defaultEntryPoint, $contextListenerId = null) private function createAuthenticationListeners($container, $id, $firewall, &$authenticationProviders, $defaultProvider, array $providerIds, $defaultEntryPoint, $contextListenerId = null)
{ {
$listeners = []; $listeners = [];
$hasListeners = false; $hasListeners = false;

View File

@ -528,7 +528,7 @@ class AutowirePass extends AbstractRecursivePass
if (method_exists($parameter, 'getType')) { if (method_exists($parameter, 'getType')) {
$type = $parameter->getType(); $type = $parameter->getType();
if ($type && !$type->isBuiltin()) { if ($type && !$type->isBuiltin()) {
$class = new \ReflectionClass(method_exists($type, 'getName') ? $type->getName() : (string) $type); $class = new \ReflectionClass($type instanceof \ReflectionNamedType ? $type->getName() : (string) $type);
} else { } else {
$class = null; $class = null;
} }

View File

@ -274,7 +274,7 @@ class ControllerResolver implements ArgumentResolverInterface, ControllerResolve
return false; return false;
} }
$class = new \ReflectionClass(method_exists($type, 'getName') ? $type->getName() : (string) $type); $class = new \ReflectionClass($type instanceof \ReflectionNamedType ? $type->getName() : (string) $type);
return $class && $class->isInstance($request); return $class && $class->isInstance($request);
} }

View File

@ -1080,6 +1080,6 @@ class OptionsResolver implements Options
return null; return null;
} }
return method_exists($type, 'getName') ? $type->getName() : (string) $type; return $type instanceof \ReflectionNamedType ? $type->getName() : (string) $type;
} }
} }