function StaticReflectionParser::hasAttribute

2 calls to StaticReflectionParser::hasAttribute()
HookCollectorPass::collectModuleHookImplementations in core/lib/Drupal/Core/Hook/HookCollectorPass.php
Collects procedural and Attribute hook implementations.
StaticReflectionParser::hasClassAttribute in core/lib/Drupal/Component/Annotation/Doctrine/StaticReflectionParser.php
Determines if the class has the provided class attribute.

File

core/lib/Drupal/Component/Annotation/Doctrine/StaticReflectionParser.php, line 369

Class

StaticReflectionParser
Parses a file for namespaces/use/class declarations.

Namespace

Drupal\Component\Annotation\Doctrine

Code

public static function hasAttribute(array $existingAttributes, string $attributeLookingFor) : bool {
    foreach ($existingAttributes as $existingAttribute) {
        if (is_a($existingAttribute, $attributeLookingFor, TRUE)) {
            return TRUE;
        }
    }
    return FALSE;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.