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\StmtView 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. |