src/Fixer/ClassNotation/NoNullPropertyInitializationFixer.php
protected function applyFix(\SplFileInfo $file, Tokens $tokens)
    {
        for ($index = 0, $count = $tokens->count(); $index < $count; ++$index) {
            if (!$tokens[$index]->isGivenKind([T_PUBLIC, T_PROTECTED, T_PRIVATE, T_VAR])) {
                continue;
            }

            while (true) {
                $varTokenIndex = $index = $tokens->getNextMeaningfulToken($index);

                if (!$tokens[$index]->isGivenKind(T_VARIABLE)) {
                    break;
                }

                $index = $tokens->getNextMeaningfulToken($index);

                if ($tokens[$index]->equals('=')) {
                    $index = $tokens->getNextMeaningfulToken($index);

                    if ($tokens[$index]->isGivenKind(T_NS_SEPARATOR)) {
                        $index = $tokens->getNextMeaningfulToken($index);
                    }

                    if ($tokens[$index]->equals([T_STRING, 'null'], false)) {
                        for ($i = $varTokenIndex + 1; $i <= $index; ++$i) {
                            if (
                                !($tokens[$i]->isWhitespace() && false !== strpos($tokens[$i]->getContent(), "\n"))
                                && !$tokens[$i]->isComment()
                            ) {
                                $tokens->clearAt($i);
                            }
                        }
                    }

                    ++$index;
                }

                if (!$tokens[$index]->equals(',')) {
                    break;
                }
            }
        }
    }
protected function applyFix(\SplFileInfo $file, Tokens $tokens)
    {
        for ($index = 0, $count = $tokens->count(); $index < $count; ++$index) {
            if (!$tokens[$index]->isGivenKind([T_PUBLIC, T_PROTECTED, T_PRIVATE, T_VAR])) {
                continue;
            }

            while (true) {
                $varTokenIndex = $index = $tokens->getNextMeaningfulToken($index);

                if (!$tokens[$index]->isGivenKind(T_VARIABLE)) {
                    break;
                }

                $index = $tokens->getNextMeaningfulToken($index);

                if ($tokens[$index]->equals('=')) {
                    $index = $tokens->getNextMeaningfulToken($index);

                    if ($tokens[$index]->isGivenKind(T_NS_SEPARATOR)) {
                        $index = $tokens->getNextMeaningfulToken($index);
                    }

                    if ($tokens[$index]->equals([T_STRING, 'null'], false)) {
                        for ($i = $varTokenIndex + 1; $i <= $index; ++$i) {
                            if (
                                !($tokens[$i]->isWhitespace() && false !== strpos($tokens[$i]->getContent(), "\n"))
                                && !$tokens[$i]->isComment()
                            ) {
                                $tokens->clearAt($i);
                            }
                        }
                    }

                    ++$index;
                }

                if (!$tokens[$index]->equals(',')) {
                    break;
                }
            }
        }
    }
protected function applyFix ( \ SplFileInfo $ file , Tokens $ tokens ) { for ( $ index = 0 , $ count = $ tokens -> count ( ) ; $ index < $ count ; ++ $ index ) { if ( ! $ tokens [ $ index ] -> isGivenKind ( [ T_PUBLIC , T_PROTECTED , T_PRIVATE , T_VAR ] ) ) { continue ; } while ( true ) { $ varTokenIndex = $ index = $ tokens -> getNextMeaningfulToken ( $ index ) ; if ( ! $ tokens [ $ index ] -> isGivenKind ( T_VARIABLE ) ) { break ; } $ index = $ tokens -> getNextMeaningfulToken ( $ index ) ; if ( $ tokens [ $ index ] -> equals ( '=' ) ) { $ index = $ tokens -> getNextMeaningfulToken ( $ index ) ; if ( $ tokens [ $ index ] -> isGivenKind ( T_NS_SEPARATOR ) ) { $ index = $ tokens -> getNextMeaningfulToken ( $ index ) ; } if ( $ tokens [ $ index ] -> equals ( [ T_STRING , 'null' ] , false ) ) { for ( $ i = $ varTokenIndex + 1 ; $ i <= $ index ; ++ $ i ) { if ( ! ( $ tokens [ $ i ] -> isWhitespace ( ) && false !== strpos ( $ tokens [ $ i ] -> getContent ( ) , "\n" ) ) && ! $ tokens [ $ i ] -> isComment ( ) ) { $ tokens -> clearAt ( $ i ) ; } } } ++ $ index ; } if ( ! $ tokens [ $ index ] -> equals ( ',' ) ) { break ; } } } }
{@inheritdoc}
{