PhpCsFixer\Fixer\Phpdoc\PhpdocToCommentFixer::isValidControl PHP Method

isValidControl() private method

Checks control structures (while, if, foreach, switch) for correct docblock usage.
private isValidControl ( Tokens $tokens, PhpCsFixer\Tokenizer\Token $docsToken, integer $controlIndex ) : boolean
$tokens PhpCsFixer\Tokenizer\Tokens
$docsToken PhpCsFixer\Tokenizer\Token docs Token
$controlIndex integer index of control structure Token
return boolean
    private function isValidControl(Tokens $tokens, Token $docsToken, $controlIndex)
    {
        $index = $tokens->getNextMeaningfulToken($controlIndex);
        $endIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_PARENTHESIS_BRACE, $index);
        $docsContent = $docsToken->getContent();
        for ($index = $index + 1; $index < $endIndex; ++$index) {
            $token = $tokens[$index];
            if ($token->isGivenKind(T_VARIABLE) && false !== strpos($docsContent, $token->getContent())) {
                return true;
            }
        }
        return false;
    }