src/Fixer/Phpdoc/NoSuperfluousPhpdocTagsFixer.php
private function getArgumentsInfo(Tokens $tokens, $start, $end)
    {
        $argumentsInfo = [];

        for ($index = $start; $index <= $end; ++$index) {
            $token = $tokens[$index];

            if (!$token->isGivenKind(T_VARIABLE)) {
                continue;
            }

            $beforeArgumentIndex = $tokens->getPrevTokenOfKind($index, ['(', ',']);
            $typeIndex = $tokens->getNextMeaningfulToken($beforeArgumentIndex);

            if ($typeIndex !== $index) {
                $info = $this->parseTypeHint($tokens, $typeIndex);
            } else {
                $info = [
                    'type' => null,
                    'allows_null' => true,
                ];
            }

            if (!$info['allows_null']) {
                $nextIndex = $tokens->getNextMeaningfulToken($index);
                if (
                    $tokens[$nextIndex]->equals('=')
                    && $tokens[$tokens->getNextMeaningfulToken($nextIndex)]->equals([T_STRING, 'null'])
                ) {
                    $info['allows_null'] = true;
                }
            }

            $argumentsInfo[$token->getContent()] = $info;
        }

        return $argumentsInfo;
    }
private function getArgumentsInfo(Tokens $tokens, $start, $end)
    {
        $argumentsInfo = [];

        for ($index = $start; $index <= $end; ++$index) {
            $token = $tokens[$index];

            if (!$token->isGivenKind(T_VARIABLE)) {
                continue;
            }

            $beforeArgumentIndex = $tokens->getPrevTokenOfKind($index, ['(', ',']);
            $typeIndex = $tokens->getNextMeaningfulToken($beforeArgumentIndex);

            if ($typeIndex !== $index) {
                $info = $this->parseTypeHint($tokens, $typeIndex);
            } else {
                $info = [
                    'type' => null,
                    'allows_null' => true,
                ];
            }

            if (!$info['allows_null']) {
                $nextIndex = $tokens->getNextMeaningfulToken($index);
                if (
                    $tokens[$nextIndex]->equals('=')
                    && $tokens[$tokens->getNextMeaningfulToken($nextIndex)]->equals([T_STRING, 'null'])
                ) {
                    $info['allows_null'] = true;
                }
            }

            $argumentsInfo[$token->getContent()] = $info;
        }

        return $argumentsInfo;
    }
private function getArgumentsInfo ( Tokens $ tokens , $ start , $ end ) { $ argumentsInfo = [ ] ; for ( $ index = $ start ; $ index <= $ end ; ++ $ index ) { $ token = $ tokens [ $ index ] ; if ( ! $ token -> isGivenKind ( T_VARIABLE ) ) { continue ; } $ beforeArgumentIndex = $ tokens -> getPrevTokenOfKind ( $ index , [ '(' , ',' ] ) ; $ typeIndex = $ tokens -> getNextMeaningfulToken ( $ beforeArgumentIndex ) ; if ( $ typeIndex !== $ index ) { $ info = $ this -> parseTypeHint ( $ tokens , $ typeIndex ) ; } else { $ info = [ 'type' => null , 'allows_null' => true , ] ; } if ( ! $ info [ 'allows_null' ] ) { $ nextIndex = $ tokens -> getNextMeaningfulToken ( $ index ) ; if ( $ tokens [ $ nextIndex ] -> equals ( '=' ) && $ tokens [ $ tokens -> getNextMeaningfulToken ( $ nextIndex ) ] -> equals ( [ T_STRING , 'null' ] ) ) { $ info [ 'allows_null' ] = true ; } } $ argumentsInfo [ $ token -> getContent ( ) ] = $ info ; } return $ argumentsInfo ; }
@param Tokens $tokens
@param int    $start
@param int    $end

@return array<string, array>
@param Tokens $tokens @param int $start @param int $end