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

Breadcrumb

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

class If_

Hierarchy

  • class \PhpParser\Node\Stmt\If_ extends \Node\Stmt

Expanded class hierarchy of If_

1 file declares its use of If_
CyclomaticComplexityCalculatingVisitor.php in vendor/sebastian/complexity/src/Visitor/CyclomaticComplexityCalculatingVisitor.php

File

vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/If_.php, line 7

Namespace

PhpParser\Node\Stmt
View source
class If_ extends Node\Stmt {
    
    /** @var Node\Expr Condition expression */
    public Node\Expr $cond;
    
    /** @var Node\Stmt[] Statements */
    public array $stmts;
    
    /** @var ElseIf_[] Elseif clauses */
    public array $elseifs;
    
    /** @var null|Else_ Else clause */
    public ?Else_ $else;
    
    /**
     * Constructs an if node.
     *
     * @param Node\Expr $cond Condition
     * @param array{
     *     stmts?: Node\Stmt[],
     *     elseifs?: ElseIf_[],
     *     else?: Else_|null,
     * } $subNodes Array of the following optional subnodes:
     *             'stmts'   => array(): Statements
     *             'elseifs' => array(): Elseif clauses
     *             'else'    => null   : Else clause
     * @param array<string, mixed> $attributes Additional attributes
     */
    public function __construct(Node\Expr $cond, array $subNodes = [], array $attributes = []) {
        $this->attributes = $attributes;
        $this->cond = $cond;
        $this->stmts = $subNodes['stmts'] ?? [];
        $this->elseifs = $subNodes['elseifs'] ?? [];
        $this->else = $subNodes['else'] ?? null;
    }
    public function getSubNodeNames() : array {
        return [
            'cond',
            'stmts',
            'elseifs',
            'else',
        ];
    }
    public function getType() : string {
        return 'Stmt_If';
    }

}

Members

Title Sort descending Modifiers Object type Summary
If_::$cond public property @var Node\Expr Condition expression
If_::$else public property @var null|Else_ Else clause
If_::$elseifs public property @var ElseIf_[] Elseif clauses
If_::$stmts public property @var Node\Stmt[] Statements
If_::getSubNodeNames public function
If_::getType public function
If_::__construct public function Constructs an if node.

API Navigation

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