src/Fixer/Phpdoc/PhpdocVarWithoutNameFixer.php
protected function applyFix(\SplFileInfo $file, Tokens $tokens)
    {
        foreach ($tokens as $index => $token) {
            if (!$token->isGivenKind(T_DOC_COMMENT)) {
                continue;
            }

            $doc = new DocBlock($token->getContent());

            // don't process single line docblocks
            if (1 === \count($doc->getLines())) {
                continue;
            }

            $annotations = $doc->getAnnotationsOfType(['param', 'return', 'type', 'var']);

            // only process docblocks where the first meaningful annotation is @type or @var
            if (!isset($annotations[0]) || !\in_array($annotations[0]->getTag()->getName(), ['type', 'var'], true)) {
                continue;
            }

            $this->fixLine($doc->getLine($annotations[0]->getStart()));

            $tokens[$index] = new Token([T_DOC_COMMENT, $doc->getContent()]);
        }
    }
protected function applyFix(\SplFileInfo $file, Tokens $tokens)
    {
        foreach ($tokens as $index => $token) {
            if (!$token->isGivenKind(T_DOC_COMMENT)) {
                continue;
            }

            $doc = new DocBlock($token->getContent());

            // don't process single line docblocks
            if (1 === \count($doc->getLines())) {
                continue;
            }

            $annotations = $doc->getAnnotationsOfType(['param', 'return', 'type', 'var']);

            // only process docblocks where the first meaningful annotation is @type or @var
            if (!isset($annotations[0]) || !\in_array($annotations[0]->getTag()->getName(), ['type', 'var'], true)) {
                continue;
            }

            $this->fixLine($doc->getLine($annotations[0]->getStart()));

            $tokens[$index] = new Token([T_DOC_COMMENT, $doc->getContent()]);
        }
    }
protected function applyFix ( \ SplFileInfo $ file , Tokens $ tokens ) { foreach ( $ tokens as $ index => $ token ) { if ( ! $ token -> isGivenKind ( T_DOC_COMMENT ) ) { continue ; } $ doc = new DocBlock ( $ token -> getContent ( ) ) ; // don't process single line docblocks if ( 1 === \ count ( $ doc -> getLines ( ) ) ) { continue ; } $ annotations = $ doc -> getAnnotationsOfType ( [ 'param' , 'return' , 'type' , 'var' ] ) ; // only process docblocks where the first meaningful annotation is @type or @var if ( ! isset ( $ annotations [ 0 ] ) || ! \ in_array ( $ annotations [ 0 ] -> getTag ( ) -> getName ( ) , [ 'type' , 'var' ] , true ) ) { continue ; } $ this -> fixLine ( $ doc -> getLine ( $ annotations [ 0 ] -> getStart ( ) ) ) ; $ tokens [ $ index ] = new Token ( [ T_DOC_COMMENT , $ doc -> getContent ( ) ] ) ; } }
{@inheritdoc}
{