private function isClassCandidate(Tokens $tokens, $index)
    {
        if ($tokens[$tokens->getPrevMeaningfulToken($index)]->isGivenKind([T_ABSTRACT, T_FINAL])) {
            return false; // ignore class; it is abstract or already final
        }

        $docToken = $tokens[$tokens->getPrevNonWhitespace($index)];

        if (!$docToken->isGivenKind(T_DOC_COMMENT)) {
            return false; // ignore class; it has no class-level PHPDoc
        }

        $doc = new DocBlock($docToken->getContent());
        $tags = [];

        foreach ($doc->getAnnotations() as $annotation) {
            $tag = strtolower($annotation->getTag()->getName());
            if (isset($this->configuration['annotation-black-list'][$tag])) {
                return false; // ignore class: class-level PHPDoc contains tag that has been black listed through configuration
            }

            $tags[$tag] = true;
        }

        foreach ($this->configuration['annotation-white-list'] as $tag => $true) {
            if (!isset($tags[$tag])) {
                return false; // ignore class: class-level PHPDoc does not contain all tags that has been white listed through configuration
            }
        }

        return true;
    }
private function isClassCandidate(Tokens $tokens, $index)
    {
        if ($tokens[$tokens->getPrevMeaningfulToken($index)]->isGivenKind([T_ABSTRACT, T_FINAL])) {
            return false; 
        }

        $docToken = $tokens[$tokens->getPrevNonWhitespace($index)];

        if (!$docToken->isGivenKind(T_DOC_COMMENT)) {
            return false; 
        }

        $doc = new DocBlock($docToken->getContent());
        $tags = [];

        foreach ($doc->getAnnotations() as $annotation) {
            $tag = strtolower($annotation->getTag()->getName());
            if (isset($this->configuration['annotation-black-list'][$tag])) {
                return false; 
            }

            $tags[$tag] = true;
        }

        foreach ($this->configuration['annotation-white-list'] as $tag => $true) {
            if (!isset($tags[$tag])) {
                return false; 
            }
        }

        return true;
    }
private function isClassCandidate ( Tokens $ tokens , $ index ) { if ( $ tokens [ $ tokens -> getPrevMeaningfulToken ( $ index ) ] -> isGivenKind ( [ T_ABSTRACT , T_FINAL ] ) ) { return false ; // ignore class; it is abstract or already final } $ docToken = $ tokens [ $ tokens -> getPrevNonWhitespace ( $ index ) ] ; if ( ! $ docToken -> isGivenKind ( T_DOC_COMMENT ) ) { return false ; // ignore class; it has no class-level PHPDoc } $ doc = new DocBlock ( $ docToken -> getContent ( ) ) ; $ tags = [ ] ; foreach ( $ doc -> getAnnotations ( ) as $ annotation ) { $ tag = strtolower ( $ annotation -> getTag ( ) -> getName ( ) ) ; if ( isset ( $ this -> configuration [ 'annotation-black-list' ] [ $ tag ] ) ) { return false ; // ignore class: class-level PHPDoc contains tag that has been black listed through configuration } $ tags [ $ tag ] = true ; } foreach ( $ this -> configuration [ 'annotation-white-list' ] as $ tag => $ true ) { if ( ! isset ( $ tags [ $ tag ] ) ) { return false ; // ignore class: class-level PHPDoc does not contain all tags that has been white listed through configuration } } return true ; }
@param Tokens $tokens
@param int    $index  T_CLASS index

@return bool
@param Tokens $tokens @param int $index T_CLASS index