function AbstractRecursivePass::getReflectionMethod
Throws
6 calls to AbstractRecursivePass::getReflectionMethod()
- AbstractRecursivePass::getConstructor in vendor/
symfony/ dependency-injection/ Compiler/ AbstractRecursivePass.php - AutowirePass::autowireCalls in vendor/
symfony/ dependency-injection/ Compiler/ AutowirePass.php - CheckTypeDeclarationsPass::processValue in vendor/
symfony/ dependency-injection/ Compiler/ CheckTypeDeclarationsPass.php - Processes a value found in a definition tree.
- ResolveAutowireInlineAttributesPass::processValue in vendor/
symfony/ dependency-injection/ Compiler/ ResolveAutowireInlineAttributesPass.php - Processes a value found in a definition tree.
- ResolveBindingsPass::processValue in vendor/
symfony/ dependency-injection/ Compiler/ ResolveBindingsPass.php - Processes a value found in a definition tree.
File
-
vendor/
symfony/ dependency-injection/ Compiler/ AbstractRecursivePass.php, line 193
Class
- AbstractRecursivePass
- @author Nicolas Grekas <p@tchwork.com>
Namespace
Symfony\Component\DependencyInjection\CompilerCode
protected function getReflectionMethod(Definition $definition, string $method) : \ReflectionFunctionAbstract {
if ('__construct' === $method) {
return $this->getConstructor($definition, true);
}
while (null === ($class = $definition->getClass()) && $definition instanceof ChildDefinition) {
$definition = $this->container
->findDefinition($definition->getParent());
}
if (null === $class) {
throw new RuntimeException(\sprintf('Invalid service "%s": the class is not set.', $this->currentId));
}
if (!($r = $this->container
->getReflectionClass($class))) {
throw new RuntimeException(\sprintf('Invalid service "%s": class "%s" does not exist.', $this->currentId, $class));
}
if (!$r->hasMethod($method)) {
if ($r->hasMethod('__call') && ($r = $r->getMethod('__call')) && $r->isPublic()) {
return new \ReflectionMethod(static function (...$arguments) {
}, '__invoke');
}
if ($r->hasMethod('__callStatic') && ($r = $r->getMethod('__callStatic')) && $r->isPublic()) {
return new \ReflectionMethod(static function (...$arguments) {
}, '__invoke');
}
throw new RuntimeException(\sprintf('Invalid service "%s": method "%s()" does not exist.', $this->currentId, $class !== $this->currentId ? $class . '::' . $method : $method));
}
$r = $r->getMethod($method);
if (!$r->isPublic()) {
throw new RuntimeException(\sprintf('Invalid service "%s": method "%s()" must be public.', $this->currentId, $class !== $this->currentId ? $class . '::' . $method : $method));
}
return $r;
}