/** * @param string $annotation * @return ReflectionMethodMagic[]|array */ private function processMagicMethodAnnotation($annotation) { if (!preg_match(self::PATTERN_METHOD, $annotation, $matches)) { return []; } list(, $static, $returnTypeHint, $returnsReference, $name, $args, $shortDescription) = $matches; $startLine = $this->getStartLine($annotation); $endLine = $startLine + substr_count($annotation, "\n"); $methods = []; $methods[$name] = $method = $this->reflectionFactory->createMethodMagic(['name' => $name, 'shortDescription' => str_replace("\n", ' ', $shortDescription), 'startLine' => $startLine, 'endLine' => $endLine, 'returnsReference' => $returnsReference === '&', 'declaringClass' => $this->reflectionClass, 'annotations' => ['return' => [0 => $returnTypeHint]], 'static' => $static === 'static']); $this->attachMethodParameters($method, $args); return $methods; }