/**
  * @param ReflectionMethodMagic $method
  * @param string $args
  */
 private function attachMethodParameters(ReflectionMethodMagic $method, $args)
 {
     $parameters = [];
     foreach (array_filter(preg_split('~\\s*,\\s*~', $args)) as $position => $arg) {
         if (!preg_match(self::PATTERN_PARAMETER, $arg, $matches)) {
             // Wrong annotation format
             continue;
         }
         list(, $typeHint, $passedByReference, $name, $defaultValueDefinition) = $matches;
         $parameters[$name] = $this->reflectionFactory->createParameterMagic(['name' => $name, 'position' => $position, 'typeHint' => $typeHint, 'defaultValueDefinition' => $defaultValueDefinition, 'unlimited' => false, 'passedByReference' => $passedByReference === '&', 'declaringFunction' => $method]);
         $method->addAnnotation('param', ltrim(sprintf('%s $%s', $typeHint, $name)));
     }
     $method->setParameters($parameters);
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 public function getEndLine()
 {
     return $this->declaringFunction->getEndLine();
 }