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

Breadcrumb

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

class PropertyHook

Hierarchy

  • class \PhpParser\NodeAbstract implements \PhpParser\Node, \PhpParser\JsonSerializable
    • class \PhpParser\Node\PropertyHook extends \PhpParser\NodeAbstract implements \PhpParser\Node\FunctionLike

Expanded class hierarchy of PropertyHook

2 files declare their use of PropertyHook
ParserAbstract.php in vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php
PrettyPrinterAbstract.php in vendor/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php
1 string reference to 'PropertyHook'
PropertyHook::getType in vendor/nikic/php-parser/lib/PhpParser/Node/PropertyHook.php
Gets the type of the node.

File

vendor/nikic/php-parser/lib/PhpParser/Node/PropertyHook.php, line 8

Namespace

PhpParser\Node
View source
class PropertyHook extends NodeAbstract implements FunctionLike {
    
    /** @var AttributeGroup[] PHP attribute groups */
    public array $attrGroups;
    
    /** @var int Modifiers */
    public int $flags;
    
    /** @var bool Whether hook returns by reference */
    public bool $byRef;
    
    /** @var Identifier Hook name */
    public Identifier $name;
    
    /** @var Param[] Parameters */
    public array $params;
    
    /** @var null|Expr|Stmt[] Hook body */
    public $body;
    
    /**
     * Constructs a property hook node.
     *
     * @param string|Identifier $name Hook name
     * @param null|Expr|Stmt[] $body Hook body
     * @param array{
     *     flags?: int,
     *     byRef?: bool,
     *     params?: Param[],
     *     attrGroups?: AttributeGroup[],
     * } $subNodes Array of the following optional subnodes:
     *             'byRef'      => false  : Whether hook returns by reference
     *             'params'     => array(): Parameters
     *             'attrGroups' => array(): PHP attribute groups
     * @param array<string, mixed> $attributes Additional attributes
     */
    public function __construct($name, $body, array $subNodes = [], array $attributes = []) {
        $this->attributes = $attributes;
        $this->name = \is_string($name) ? new Identifier($name) : $name;
        $this->body = $body;
        $this->flags = $subNodes['flags'] ?? 0;
        $this->byRef = $subNodes['byRef'] ?? false;
        $this->params = $subNodes['params'] ?? [];
        $this->attrGroups = $subNodes['attrGroups'] ?? [];
    }
    public function returnsByRef() : bool {
        return $this->byRef;
    }
    public function getParams() : array {
        return $this->params;
    }
    public function getReturnType() {
        return null;
    }
    public function getStmts() : ?array {
        if ($this->body instanceof Expr) {
            return [
                new Return_($this->body),
            ];
        }
        return $this->body;
    }
    public function getAttrGroups() : array {
        return $this->attrGroups;
    }
    public function getType() : string {
        return 'PropertyHook';
    }
    public function getSubNodeNames() : array {
        return [
            'attrGroups',
            'flags',
            'byRef',
            'name',
            'params',
            'body',
        ];
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
NodeAbstract::$attributes protected property @var array&lt;string, mixed&gt; Attributes
NodeAbstract::getAttribute public function Returns the value of an attribute. Overrides Node::getAttribute
NodeAbstract::getAttributes public function Returns all the attributes of this node. Overrides Node::getAttributes
NodeAbstract::getComments public function Gets all comments directly preceding this node. Overrides Node::getComments
NodeAbstract::getDocComment public function Gets the doc comment of the node. Overrides Node::getDocComment
NodeAbstract::getEndFilePos public function Gets the file offset of the last character that is part of this node. Overrides Node::getEndFilePos
NodeAbstract::getEndLine public function Gets the line the node ended in. Overrides Node::getEndLine
NodeAbstract::getEndTokenPos public function Gets the token offset of the last token that is part of this node. Overrides Node::getEndTokenPos
NodeAbstract::getLine public function Gets line the node started in (alias of getStartLine). Overrides Node::getLine
NodeAbstract::getStartFilePos public function Gets the file offset of the first character that is part of this node. Overrides Node::getStartFilePos
NodeAbstract::getStartLine public function Gets line the node started in. Overrides Node::getStartLine
NodeAbstract::getStartTokenPos public function Gets the token offset of the first token that is part of this node. Overrides Node::getStartTokenPos
NodeAbstract::hasAttribute public function Returns whether an attribute exists. Overrides Node::hasAttribute
NodeAbstract::jsonSerialize public function
NodeAbstract::setAttribute public function Sets an attribute on a node. Overrides Node::setAttribute
NodeAbstract::setAttributes public function Replaces all the attributes of this node. Overrides Node::setAttributes
NodeAbstract::setDocComment public function Sets the doc comment of the node. Overrides Node::setDocComment
PropertyHook::$attrGroups public property @var AttributeGroup[] PHP attribute groups
PropertyHook::$body public property @var null|Expr|Stmt[] Hook body
PropertyHook::$byRef public property @var bool Whether hook returns by reference
PropertyHook::$flags public property @var int Modifiers
PropertyHook::$name public property @var Identifier Hook name
PropertyHook::$params public property @var Param[] Parameters
PropertyHook::getAttrGroups public function Get PHP attribute groups. Overrides FunctionLike::getAttrGroups
PropertyHook::getParams public function List of parameters Overrides FunctionLike::getParams
PropertyHook::getReturnType public function Get the declared return type or null Overrides FunctionLike::getReturnType
PropertyHook::getStmts public function The function body Overrides FunctionLike::getStmts
PropertyHook::getSubNodeNames public function Gets the names of the sub nodes. Overrides Node::getSubNodeNames
PropertyHook::getType public function Gets the type of the node. Overrides Node::getType
PropertyHook::returnsByRef public function Whether to return by reference Overrides FunctionLike::returnsByRef
PropertyHook::__construct public function Constructs a property hook node. Overrides NodeAbstract::__construct

API Navigation

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