Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. BuilderHelpers.php

function BuilderHelpers::normalizeAttribute

Normalizes a attribute: Converts attribute to the Attribute Group if needed.

Parameters

Node\Attribute|Node\AttributeGroup $attribute:

Return value

Node\AttributeGroup The Attribute Group

10 calls to BuilderHelpers::normalizeAttribute()
ClassConst::addAttribute in vendor/nikic/php-parser/lib/PhpParser/Builder/ClassConst.php
Adds an attribute group.
Class_::addAttribute in vendor/nikic/php-parser/lib/PhpParser/Builder/Class_.php
Adds an attribute group.
EnumCase::addAttribute in vendor/nikic/php-parser/lib/PhpParser/Builder/EnumCase.php
Adds an attribute group.
Enum_::addAttribute in vendor/nikic/php-parser/lib/PhpParser/Builder/Enum_.php
Adds an attribute group.
Function_::addAttribute in vendor/nikic/php-parser/lib/PhpParser/Builder/Function_.php
Adds an attribute group.

... See full list

File

vendor/nikic/php-parser/lib/PhpParser/BuilderHelpers.php, line 305

Class

BuilderHelpers
This class defines helpers used in the implementation of builders. Don't use it directly.

Namespace

PhpParser

Code

public static function normalizeAttribute($attribute) : Node\AttributeGroup {
    if ($attribute instanceof Node\AttributeGroup) {
        return $attribute;
    }
    if (!$attribute instanceof Node\Attribute) {
        throw new \LogicException('Attribute must be an instance of PhpParser\\Node\\Attribute or PhpParser\\Node\\AttributeGroup');
    }
    return new Node\AttributeGroup([
        $attribute,
    ]);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal