function AttributeRouteDiscovery::getAttributes

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Routing/AttributeRouteDiscovery.php \Drupal\Core\Routing\AttributeRouteDiscovery::getAttributes()

Gets the PHP attributes.

Parameters

\ReflectionClass|\ReflectionMethod $reflection: The reflected class or method.

Return value

iterable<int, RouteAttribute> The attributes.

File

core/lib/Drupal/Core/Routing/AttributeRouteDiscovery.php, line 283

Class

AttributeRouteDiscovery
Discovers routes using Symfony's Route attribute.

Namespace

Drupal\Core\Routing

Code

private function getAttributes(\ReflectionClass|\ReflectionMethod $reflection) : iterable {
  foreach ($reflection->getAttributes(RouteAttribute::class, \ReflectionAttribute::IS_INSTANCEOF) as $attribute) {
    yield $attribute->newInstance();
  }
}

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