src/Fixer/FunctionNotation/NoUnreachableDefaultArgumentValueFixer.php
private function isNonNullableTypehintedNullableVariable(Tokens $tokens, $index)
    {
        $nextToken = $tokens[$tokens->getNextMeaningfulToken($index)];

        if (!$nextToken->equals([T_STRING, 'null'], false)) {
            return false;
        }

        $variableIndex = $tokens->getPrevMeaningfulToken($index);

        $searchTokens = [',', '(', [T_STRING], [CT::T_ARRAY_TYPEHINT], [T_CALLABLE]];
        $typehintKinds = [T_STRING, CT::T_ARRAY_TYPEHINT, T_CALLABLE];

        $prevIndex = $tokens->getPrevTokenOfKind($variableIndex, $searchTokens);

        if (!$tokens[$prevIndex]->isGivenKind($typehintKinds)) {
            return false;
        }

        return !$tokens[$tokens->getPrevMeaningfulToken($prevIndex)]->isGivenKind(CT::T_NULLABLE_TYPE);
    }
private function isNonNullableTypehintedNullableVariable(Tokens $tokens, $index)
    {
        $nextToken = $tokens[$tokens->getNextMeaningfulToken($index)];

        if (!$nextToken->equals([T_STRING, 'null'], false)) {
            return false;
        }

        $variableIndex = $tokens->getPrevMeaningfulToken($index);

        $searchTokens = [',', '(', [T_STRING], [CT::T_ARRAY_TYPEHINT], [T_CALLABLE]];
        $typehintKinds = [T_STRING, CT::T_ARRAY_TYPEHINT, T_CALLABLE];

        $prevIndex = $tokens->getPrevTokenOfKind($variableIndex, $searchTokens);

        if (!$tokens[$prevIndex]->isGivenKind($typehintKinds)) {
            return false;
        }

        return !$tokens[$tokens->getPrevMeaningfulToken($prevIndex)]->isGivenKind(CT::T_NULLABLE_TYPE);
    }
private function isNonNullableTypehintedNullableVariable ( Tokens $ tokens , $ index ) { $ nextToken = $ tokens [ $ tokens -> getNextMeaningfulToken ( $ index ) ] ; if ( ! $ nextToken -> equals ( [ T_STRING , 'null' ] , false ) ) { return false ; } $ variableIndex = $ tokens -> getPrevMeaningfulToken ( $ index ) ; $ searchTokens = [ ',' , '(' , [ T_STRING ] , [ CT :: T_ARRAY_TYPEHINT ] , [ T_CALLABLE ] ] ; $ typehintKinds = [ T_STRING , CT :: T_ARRAY_TYPEHINT , T_CALLABLE ] ; $ prevIndex = $ tokens -> getPrevTokenOfKind ( $ variableIndex , $ searchTokens ) ; if ( ! $ tokens [ $ prevIndex ] -> isGivenKind ( $ typehintKinds ) ) { return false ; } return ! $ tokens [ $ tokens -> getPrevMeaningfulToken ( $ prevIndex ) ] -> isGivenKind ( CT :: T_NULLABLE_TYPE ) ; }
@param Tokens $tokens
@param int    $index  Index of "="

@return bool
@param Tokens $tokens @param int $index Index of =