PhpCsFixer\Fixer\Phpdoc\PhpdocNoAliasTagFixer::fix PHP Method

fix() public method

public fix ( SplFileInfo $file, Tokens $tokens )
$file SplFileInfo
$tokens PhpCsFixer\Tokenizer\Tokens
    public function fix(\SplFileInfo $file, Tokens $tokens)
    {
        $searchFor = array_keys($this->configuration);
        foreach ($tokens as $token) {
            if (!$token->isGivenKind(T_DOC_COMMENT)) {
                continue;
            }
            $doc = new DocBlock($token->getContent());
            $annotations = $doc->getAnnotationsOfType($searchFor);
            if (empty($annotations)) {
                continue;
            }
            foreach ($annotations as $annotation) {
                $annotation->getTag()->setName($this->configuration[$annotation->getTag()->getName()]);
            }
            $token->setContent($doc->getContent());
        }
    }