diff --git a/src/Symfony/Component/DependencyInjection/Compiler/CheckTypeDeclarationsPass.php b/src/Symfony/Component/DependencyInjection/Compiler/CheckTypeDeclarationsPass.php index 4e145f294f..b132174932 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/CheckTypeDeclarationsPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/CheckTypeDeclarationsPass.php @@ -233,11 +233,11 @@ final class CheckTypeDeclarationsPass extends AbstractRecursivePass return; } - if ('string' === $type && \is_callable([$class, '__toString'])) { + if ('string' === $type && method_exists($class, '__toString')) { return; } - if ('callable' === $type && (\Closure::class === $class || \is_callable([$class, '__invoke']))) { + if ('callable' === $type && (\Closure::class === $class || method_exists($class, '__invoke'))) { return; }