Returns name of iterable property specified in PHPDoc comment.

@param string $phpDocComment

@return bool|string
165594
public static function getIterablePropertyName( string $phpDocComment )
	{
		preg_match('/@iterable\s\$([\w]+)/', $phpDocComment, $matches);
		if (isset($matches[1]))
			return $matches[1];

		return false;
	}
311561
protected function getComment($asPhpComment = true)
    {
        $comment = $this->parameters->get('comment');
        // strip hints for mysql-exporter in comments (starting with {d:keyword}
        // or {doctrine:keyword} and ending with {/d:keyword}
        if ($comment = trim(preg_replace(sprintf('/\{(%s):([^\}]+)\}(.+?)\{\/\1:\2\}/si', $this->getFormatter()->getCommentTagPrefix()), '', $comment))) {
            if ($asPhpComment) {
                $comment = implode("\n", Comment::wrap($comment."\n", ' * %s'));
            }

            return $comment;
        }
    }
1035136
protected function findDocBlockReturn(File $phpcsFile, int $docBlockStartIndex, int $docBlockEndIndex): ?int
    {
        $tokens = $phpcsFile->getTokens();

        for ($i = $docBlockStartIndex + 1; $i < $docBlockEndIndex; $i++) {
            if (!$this->isGivenKind(T_DOC_COMMENT_TAG, $tokens[$i])) {
                continue;
            }
            if ($tokens[$i]['content'] !== '@return') {
                continue;
            }

            return $i;
        }

        return null;
    }
298872
private function buildIgnoreSymlinks(SimpleXMLElement $phpDocumentor): bool
    {
        if ((array) $phpDocumentor->files === []) {
            return $this->ignoreSymlinks;
        }

        if ((string) $phpDocumentor->files->{'ignore-symlinks'} === '') {
            return $this->ignoreSymlinks;
        }

        return filter_var($phpDocumentor->files->{'ignore-symlinks'}, FILTER_VALIDATE_BOOLEAN);
    }
1188723
public function getMethodMetaData(\ReflectionFunctionAbstract $pMethod, $pRegMatches = null)
    {
        $file = $pMethod->getFileName();
        $startLine = $pMethod->getStartLine();

        $fh = fopen($file, 'r');
        if (!$fh) return false;

        $lineNr = 1;
        $lines = array();
        while (($buffer = fgets($fh)) !== false) {
            if ($lineNr == $startLine) break;
            $lines[$lineNr] = $buffer;
            $lineNr++;
        }
        fclose($fh);

        $phpDoc = '';
        $blockStarted = false;
        while ($line = array_pop($lines)) {

            if ($blockStarted) {
                $phpDoc = $line.$phpDoc;

                //if start comment block: /*
                if (preg_match('/\s*\t*\/\*/', $line)) {
                    break;
                }
                continue;
            } else {
                //we are not in a comment block.
                //if class def, array def or close bracked from fn comes above
                //then we dont have phpdoc
                if (preg_match('/^\s*\t*[a-zA-Z_&\s]*(\$|{|})/', $line)) {
                    break;
                }
            }

            $trimmed = trim($line);
            if ($trimmed == '') continue;

            //if end comment block: */
            if (preg_match('/\*\//', $line)) {
                $phpDoc = $line.$phpDoc;
                $blockStarted = true;
                //one line php doc?
                if (preg_match('/\s*\t*\/\*/', $line)) {
                    break;
                }
            }
        }

        $phpDoc = $this->parsePhpDoc($phpDoc);

        $refParams = $pMethod->getParameters();
        $params = array();

        $fillPhpDocParam = !isset($phpDoc['param']);

        foreach ($refParams as $param) {
            $params[$param->getName()] = $param;
            if ($fillPhpDocParam) {
                $phpDoc['param'][] = array(
                    'name' => $param->getName(),
                    'type' => $param->isArray()?'array':'mixed'
                );
            }
        }

        $parameters = array();

        if (isset($phpDoc['param'])) {
            if (is_array($phpDoc['param']) && is_string(key($phpDoc['param'])))
                $phpDoc['param'] = array($phpDoc['param']);

            $c = 0;
            foreach ($phpDoc['param'] as $phpDocParam) {

                $param = $params[$phpDocParam['name']];
                if (!$param) continue;
                $parameter = array(
                    'type' => $phpDocParam['type']
                );

                if ($pRegMatches && is_array($pRegMatches) && $pRegMatches[$c]) {
                    $parameter['fromRegex'] = '$'.($c+1);
                }

                $parameter['required'] = !$param->isOptional();

                if ($param->isDefaultValueAvailable()) {
                    $parameter['default'] = str_replace(array("\n", ' '), '', var_export($param->getDefaultValue(), true));
                }
                $parameters[$this->argumentName($phpDocParam['name'])] = $parameter;
                $c++;
            }
        }

        if (!isset($phpDoc['return']))
            $phpDoc['return'] = array('type' => 'mixed');

        $result = array(
            'parameters' => $parameters,
            'return' => $phpDoc['return']
        );

        if (isset($phpDoc['description']))
            $result['description'] = $phpDoc['description'];

        if (isset($phpDoc['url']))
            $result['url'] = $phpDoc['url'];

        return $result;
    }
249370
public function parseCoverAnnotationDocBlock($docBlock)
    {
        $annotations = array('covers' => array(), 'uses' => array());
        $docBlock = substr($docBlock, 3, -2);
        if (preg_match_all('/@(?P<name>[A-Za-z_-]+)(?:[ \t]+(?P<value>.*?))?[ \t]*\r?$/m', $docBlock, $matches)) {
            $numMatches = count($matches[0]);
            for ($i = 0; $i < $numMatches; ++$i) {
                $annotations[$matches['name'][$i]][] = $matches['value'][$i];
            }
        }
        array_walk_recursive(
            $annotations,
            function(&$element) {
                if (substr($element, 0, 1) === '\\') {
                    $element = substr($element, 1);
                }
            }
        );
        return $annotations;
    }
283826
private function buildMarkers(SimpleXMLElement $phpDocumentor): array
    {
        if ((array) $phpDocumentor->parser === []) {
            return $this->markers;
        }

        if ((array) $phpDocumentor->parser->markers === []) {
            return $this->markers;
        }

        return $this->buildArrayFromNode($phpDocumentor->parser->markers);
    }
331547
protected function normalizeDescription(DocBlock $phpdoc)
    {
        //Get the short + long description from the DocBlock
        $description = $phpdoc->getText();

        //Loop through parents/interfaces, to fill in {@inheritdoc}
        if (strpos($description, '{@inheritdoc}') !== false) {
            $inheritdoc = $this->getInheritDoc($this->method);
            $inheritDescription = $inheritdoc->getText();

            $description = str_replace('{@inheritdoc}', $inheritDescription, $description);
            $phpdoc->setText($description);

            $this->normalizeParams($inheritdoc);
            $this->normalizeReturn($inheritdoc);

            //Add the tags that are inherited
            $inheritTags = $inheritdoc->getTags();
            if ($inheritTags) {
                /** @var Tag $tag */
                foreach ($inheritTags as $tag) {
                    $tag->setDocBlock();
                    $phpdoc->appendTag($tag);
                }
            }
        }
    }
1260171
public function getDescription()
    {
        $reflectionClass = new \ReflectionClass($this);
        $lines = explode(chr(10), $reflectionClass->getDocComment());
        foreach ($lines as $line) {
            $line = trim($line);
            if ($line === '' || $line === '/**' || $line === '*' || $line === '*/' || strpos($line, '* @') !== false) {
                continue;
            }
            return preg_replace('/\s*\\/?[\\\\*]*\s?(.*)$/', '$1', $line);
        }
    }
964577
def t_php_START_HEREDOC(t):
    '
    t.lexer.lineno += t.value.count("\n")
    t.lexer.push_state('heredoc')
    t.lexer.heredoc_label = t.lexer.lexmatch.group('label')
    return t
978503
private function classStatement($is_abstract) {
    if ($this->currentType === T_FUNCTION) {
      $modifiers = new ModifiersNode();
      $doc_comment = new PartialCommentNode();
      $this->matchDocComment($doc_comment);
      return $this->classMethod($doc_comment, $modifiers);
    }
    elseif ($this->currentType === T_VAR) {
      $doc_comment = new PartialCommentNode();
      $this->matchDocComment($doc_comment);
      $modifiers = new ModifiersNode();
      $this->mustMatch(T_VAR, $modifiers, 'visibility');
      return $this->classMemberList($doc_comment, $modifiers);
    }
    elseif ($this->currentType === T_CONST) {
      return $this->_const();
    }
    elseif ($this->currentType === T_USE) {
      return $this->traitUse();
    }
    // Match modifiers
    $doc_comment = new PartialCommentNode();
    $this->matchDocComment($doc_comment);
    $modifiers = new ModifiersNode();
    while ($this->iterator->hasNext()) {
      switch ($this->currentType) {
        case T_PUBLIC:
        case T_PROTECTED:
        case T_PRIVATE:
          if ($modifiers->getVisibility()) {
            throw new ParserException(
              $this->filename,
              $this->iterator->getLineNumber(),
              $this->iterator->getColumnNumber(),
              "can only have one visibility modifier on class member/method."
            );
          }
          $this->mustMatch($this->currentType, $modifiers, 'visibility');
          break;
        case T_STATIC:
          if ($modifiers->getStatic()) {
            throw new ParserException(
              $this->filename,
              $this->iterator->getLineNumber(),
              $this->iterator->getColumnNumber(),
              "duplicate modifier");
          }
          $this->mustMatch(T_STATIC, $modifiers, 'static');
          break;
        case T_FINAL:
          if ($modifiers->getFinal()) {
            throw new ParserException(
              $this->filename,
              $this->iterator->getLineNumber(),
              $this->iterator->getColumnNumber(),
              "duplicate modifier");
          }
          if ($modifiers->getAbstract()) {
            throw new ParserException(
              $this->filename,
              $this->iterator->getLineNumber(),
              $this->iterator->getColumnNumber(),
              "can not use final modifier on abstract method");
          }
          $this->mustMatch(T_FINAL, $modifiers, 'final');
          break;
        case T_ABSTRACT:
          if ($modifiers->getAbstract()) {
            throw new ParserException(
              $this->filename,
              $this->iterator->getLineNumber(),
              $this->iterator->getColumnNumber(),
              "duplicate modifier");
          }
          if ($modifiers->getFinal()) {
            throw new ParserException(
              $this->filename,
              $this->iterator->getLineNumber(),
              $this->iterator->getColumnNumber(),
              "can not use abstract modifier on final method");
          }
          if (!$is_abstract) {
            throw new ParserException(
              $this->filename,
              $this->iterator->getLineNumber(),
              $this->iterator->getColumnNumber(),
              "can not use abstract modifier in non-abstract class");
          }
          $this->mustMatch(T_ABSTRACT, $modifiers, 'abstract');
          break;
        case T_FUNCTION:
          return $this->classMethod($doc_comment, $modifiers);
        case T_VARIABLE:
          return $this->classMemberList($doc_comment, $modifiers);
        default:
          throw new ParserException(
            $this->filename,
            $this->iterator->getLineNumber(),
            $this->iterator->getColumnNumber(),
            "invalid class statement");
      }
    }
    throw new ParserException(
      $this->filename,
      $this->iterator->getLineNumber(),
      $this->iterator->getColumnNumber(),
      "invalid class statement");
  }
1272993
public function getDocComment($type = 'class', $name = '')
    {
        $this->parse();

        return $name ? $this->docComment[$type][$name] : $this->docComment[$type];
    }
17533
public function getTipoDocumento()
    {
        $cpf_cnpj_cei = Util::onlyNumbers($this->documento);

        if (strlen($cpf_cnpj_cei) == 11) {
            return 'CPF';
        } elseif (strlen($cpf_cnpj_cei) == 10) {
            return 'CEI';
        }
        
        return 'CNPJ';
    }
1150159
public function php($baseIndent = 0) {
    $php = $this->phpDocBlock($baseIndent);
    
    $php .= str_repeat(' ',$baseIndent);
    
    $php .= 'const '.$this->name;
    $php .= ' = '.$this->exportPropertyValue($this->getValue());
    
    return $php;
  }
772326
public function getDocComment()
    {
        if ($this->docComment === null) {
            $this->docComment = parent::getDocComment();
        }
        return $this->docComment;
    }
632359
protected function normalizeReturn(DocBlock $phpdoc)
    {
        //Get the return type and adjust them for beter autocomplete
        $returnTags = $phpdoc->getTagsByName('return');
        if ($returnTags) {
            /** @var ReturnTag $tag */
            $tag = reset($returnTags);
            // Get the expanded type
            $returnValue = $tag->getType();

            // Replace the interfaces
            foreach ($this->interfaces as $interface => $real) {
                $returnValue = str_replace($interface, $real, $returnValue);
            }

            // Set the changed content
            $tag->setContent($returnValue . ' ' . $tag->getDescription());
            $this->return = $returnValue;

            if ($tag->getType() === '$this') {
                $tag->setType($this->root);
            }
        } else {
            $this->return = null;
        }
    }
332659
protected function extractExceptionAnnotations(File $phpCsFile, int $docBlockStartIndex): array
    {
        $tokens = $phpCsFile->getTokens();

        $throwTags = [];
        foreach ($tokens[$docBlockStartIndex]['comment_tags'] as $index) {
            if ($tokens[$index]['content'] !== '@throws') {
                continue;
            }

            if ($tokens[($index + 2)]['code'] !== T_DOC_COMMENT_STRING) {
                continue;
            }

            $fullClass = $tokens[($index + 2)]['content'];
            $space = strpos($fullClass, ' ');
            if ($space !== false) {
                $fullClass = substr($fullClass, 0, $space);
            }

            $class = $fullClass;
            $lastSeparator = strrpos($class, '\\');
            if ($lastSeparator !== false) {
                $class = substr($class, $lastSeparator + 1);
            }

            $throwTags[] = [
                'index' => $index,
                'fullClass' => $fullClass,
                'class' => $class,
            ];
        }

        return $throwTags;
    }