function AnnotationReader::getMethodImports
Retrieves imports for methods.
Return value
array<string, class-string>
1 call to AnnotationReader::getMethodImports()
- AnnotationReader::getMethodAnnotations in vendor/
doctrine/ annotations/ lib/ Doctrine/ Common/ Annotations/ AnnotationReader.php - Gets the annotations applied to a method.
File
-
vendor/
doctrine/ annotations/ lib/ Doctrine/ Common/ Annotations/ AnnotationReader.php, line 314
Class
- AnnotationReader
- A reader for docblock annotations.
Namespace
Doctrine\Common\AnnotationsCode
private function getMethodImports(ReflectionMethod $method) {
$class = $method->getDeclaringClass();
$classImports = $this->getImports($class);
$traitImports = [];
foreach ($class->getTraits() as $trait) {
if (!$trait->hasMethod($method->getName()) || $trait->getFileName() !== $method->getFileName()) {
continue;
}
$traitImports = array_merge($traitImports, $this->phpParser
->parseUseStatements($trait));
}
return array_merge($classImports, $traitImports);
}