public function returning()
 {
     preg_match('#@return (.+)#', $this->_doc, $groupMatches);
     $trimGroupMatches = array_map('trim', $groupMatches);
     $this->_rawReturn = $trimGroupMatches[1];
     $parameterParser = new ParameterParser($trimGroupMatches[1], $this->getName());
     return $parameterParser->parse();
 }
 /**
  * @param string $types
  * @return ComplexTypeParser[]
  */
 public static function create($types)
 {
     preg_match_all('#@(\\((?:.+)\\)|(?:.+?))(?: |$)#', $types, $matches);
     $typesArray = $matches[1];
     $obj = array_map(function ($type) {
         if (ComplexTypeParser::isReflectionType($type)) {
             $type = str_replace(array('(', ')'), '', $type);
         } else {
             $type = str_replace('=', ' ', $type);
         }
         $parser = new ParameterParser($type, '');
         return $parser->parse();
     }, $typesArray);
     return $obj;
 }
Exemple #3
0
 /**
  * @return Type
  */
 public function returning()
 {
     preg_match_all('#@return (.+)#', $this->doc, $groupMatches);
     $this->rawReturn = $groupMatches[1];
     return ParameterParser::create($groupMatches[1], $this->getName());
     preg_match('#@return (.+)#', $this->doc, $groupMatches);
     $trimGroupMatches = array_map('trim', $groupMatches);
     if (isset($trimGroupMatches[1])) {
         $this->rawReturn = $trimGroupMatches[1];
     }
     $parameterParser = new ParameterParser($this->rawReturn, $this->getName());
     return $parameterParser->parse();
 }
 /**
  * @test
  */
 public function shouldParseParams()
 {
     $array = array('int $simple1', 'int[] $simple2', 'object $object1 @string=$name1 @int=$id', 'object $object2 @(wrapper $wr1 @className=\\Mocks\\MockUserWrapper) @int=$id', 'object $object3 @string[]=$name2 @int=$id', 'object $object4 @(wrapper[] $wr2 @className=\\Mocks\\MockUserWrapper) @int=$id', 'object[] $object5 @string=$name3 @int=$id', 'object[] $object6 @string[]=$name4 @int=$id', 'object[] $object7 @(wrapper $wr3 @className=\\Mocks\\MockUserWrapper) @int=$id', 'object[] $object8 @(wrapper[] $wr4 @className=\\Mocks\\MockUserWrapper) @int=$id', 'wrapper $wrapp1 @className=\\Mocks\\MockUserWrapper', 'wrapper[] $wrapp2 @className=\\Mocks\\MockUserWrapper');
     ParameterParser::create($array, 'sampleMethod');
 }