diff --git a/src/Application/ParameterFinder.php b/src/Application/ParameterFinder.php index 8b4368e..b8b9cae 100644 --- a/src/Application/ParameterFinder.php +++ b/src/Application/ParameterFinder.php @@ -166,6 +166,9 @@ private function createReflection(ReflectionClass $reflection, string $component throw new TypeHintException(sprintf('Method %s::%s does not return a class.', $reflection->name, $method)); } $class = (string) $type; + if ($class === 'self') { + $class = $element->getDeclaringClass()->getName(); + } if (!class_exists($class)) { throw new TypeHintException(sprintf('Class "%s" from %s::%s return type not found.', $class, $reflection->name, $method)); }