src/Fixer/ClassNotation/ClassDefinitionFixer.php
private function getClassyDefinitionInfo(Tokens $tokens, $classyIndex)
    {
        $openIndex = $tokens->getNextTokenOfKind($classyIndex, ['{']);
        $prev = $tokens->getPrevMeaningfulToken($classyIndex);
        $startIndex = $tokens[$prev]->isGivenKind([T_FINAL, T_ABSTRACT]) ? $prev : $classyIndex;

        $extends = false;
        $implements = false;
        $anonymousClass = false;

        if (!$tokens[$classyIndex]->isGivenKind(T_TRAIT)) {
            $extends = $tokens->findGivenKind(T_EXTENDS, $classyIndex, $openIndex);
            $extends = \count($extends) ? $this->getClassyInheritanceInfo($tokens, key($extends), 'numberOfExtends') : false;

            if (!$tokens[$classyIndex]->isGivenKind(T_INTERFACE)) {
                $implements = $tokens->findGivenKind(T_IMPLEMENTS, $classyIndex, $openIndex);
                $implements = \count($implements) ? $this->getClassyInheritanceInfo($tokens, key($implements), 'numberOfImplements') : false;
                $tokensAnalyzer = new TokensAnalyzer($tokens);
                $anonymousClass = $tokensAnalyzer->isAnonymousClass($classyIndex);
            }
        }

        return [
            'start' => $startIndex,
            'classy' => $classyIndex,
            'open' => $openIndex,
            'extends' => $extends,
            'implements' => $implements,
            'anonymousClass' => $anonymousClass,
        ];
    }
private function getClassyDefinitionInfo(Tokens $tokens, $classyIndex)
    {
        $openIndex = $tokens->getNextTokenOfKind($classyIndex, ['{']);
        $prev = $tokens->getPrevMeaningfulToken($classyIndex);
        $startIndex = $tokens[$prev]->isGivenKind([T_FINAL, T_ABSTRACT]) ? $prev : $classyIndex;

        $extends = false;
        $implements = false;
        $anonymousClass = false;

        if (!$tokens[$classyIndex]->isGivenKind(T_TRAIT)) {
            $extends = $tokens->findGivenKind(T_EXTENDS, $classyIndex, $openIndex);
            $extends = \count($extends) ? $this->getClassyInheritanceInfo($tokens, key($extends), 'numberOfExtends') : false;

            if (!$tokens[$classyIndex]->isGivenKind(T_INTERFACE)) {
                $implements = $tokens->findGivenKind(T_IMPLEMENTS, $classyIndex, $openIndex);
                $implements = \count($implements) ? $this->getClassyInheritanceInfo($tokens, key($implements), 'numberOfImplements') : false;
                $tokensAnalyzer = new TokensAnalyzer($tokens);
                $anonymousClass = $tokensAnalyzer->isAnonymousClass($classyIndex);
            }
        }

        return [
            'start' => $startIndex,
            'classy' => $classyIndex,
            'open' => $openIndex,
            'extends' => $extends,
            'implements' => $implements,
            'anonymousClass' => $anonymousClass,
        ];
    }
private function getClassyDefinitionInfo ( Tokens $ tokens , $ classyIndex ) { $ openIndex = $ tokens -> getNextTokenOfKind ( $ classyIndex , [ '{' ] ) ; $ prev = $ tokens -> getPrevMeaningfulToken ( $ classyIndex ) ; $ startIndex = $ tokens [ $ prev ] -> isGivenKind ( [ T_FINAL , T_ABSTRACT ] ) ? $ prev : $ classyIndex ; $ extends = false ; $ implements = false ; $ anonymousClass = false ; if ( ! $ tokens [ $ classyIndex ] -> isGivenKind ( T_TRAIT ) ) { $ extends = $ tokens -> findGivenKind ( T_EXTENDS , $ classyIndex , $ openIndex ) ; $ extends = \ count ( $ extends ) ? $ this -> getClassyInheritanceInfo ( $ tokens , key ( $ extends ) , 'numberOfExtends' ) : false ; if ( ! $ tokens [ $ classyIndex ] -> isGivenKind ( T_INTERFACE ) ) { $ implements = $ tokens -> findGivenKind ( T_IMPLEMENTS , $ classyIndex , $ openIndex ) ; $ implements = \ count ( $ implements ) ? $ this -> getClassyInheritanceInfo ( $ tokens , key ( $ implements ) , 'numberOfImplements' ) : false ; $ tokensAnalyzer = new TokensAnalyzer ( $ tokens ) ; $ anonymousClass = $ tokensAnalyzer -> isAnonymousClass ( $ classyIndex ) ; } } return [ 'start' => $ startIndex , 'classy' => $ classyIndex , 'open' => $ openIndex , 'extends' => $ extends , 'implements' => $ implements , 'anonymousClass' => $ anonymousClass , ] ; }
@param Tokens $tokens
@param int    $classyIndex

@return array
@param Tokens $tokens @param int $classyIndex