src/Fixer/Comment/MultilineCommentOpeningClosingFixer.php
protected function applyFix(\SplFileInfo $file, Tokens $tokens)
    {
        foreach ($tokens as $index => $token) {
            $originalContent = $token->getContent();

            if (
                !$token->isGivenKind(T_DOC_COMMENT)
                && !($token->isGivenKind(T_COMMENT) && 0 === strpos($originalContent, '/*'))
            ) {
                continue;
            }

            $newContent = $originalContent;

            // Fix opening
            if ($token->isGivenKind(T_COMMENT)) {
                $newContent = Preg::replace('/^\\/\\*{2,}(?!\\/)/', '/*', $newContent);
            }

            // Fix closing
            $newContent = Preg::replace('/(?<!\\/)\\*{2,}\\/$/', '*/', $newContent);

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

            if (
                !$token->isGivenKind(T_DOC_COMMENT)
                && !($token->isGivenKind(T_COMMENT) && 0 === strpos($originalContent, '/*'))
            ) {
                continue;
            }

            $newContent = $originalContent;

            // Fix opening
            if ($token->isGivenKind(T_COMMENT)) {
                $newContent = Preg::replace('/^\\/\\*{2,}(?!\\/)/', '/*', $newContent);
            }

            // Fix closing
            $newContent = Preg::replace('/(?<!\\/)\\*{2,}\\/$/', '*/', $newContent);

            if ($newContent !== $originalContent) {
                $tokens[$index] = new Token([$token->getId(), $newContent]);
            }
        }
    }
protected function applyFix ( \ SplFileInfo $ file , Tokens $ tokens ) { foreach ( $ tokens as $ index => $ token ) { $ originalContent = $ token -> getContent ( ) ; if ( ! $ token -> isGivenKind ( T_DOC_COMMENT ) && ! ( $ token -> isGivenKind ( T_COMMENT ) && 0 === strpos ( $ originalContent , '/*' ) ) ) { continue ; } $ newContent = $ originalContent ; // Fix opening if ( $ token -> isGivenKind ( T_COMMENT ) ) { $ newContent = Preg :: replace ( '/^\\/\\*{2,}(?!\\/)/' , '/*' , $ newContent ) ; } // Fix closing $ newContent = Preg :: replace ( '/(?<!\\/)\\*{2,}\\/$/' , '*/' , $ newContent ) ; if ( $ newContent !== $ originalContent ) { $ tokens [ $ index ] = new Token ( [ $ token -> getId ( ) , $ newContent ] ) ; } } }
{@inheritdoc}
{