1: | <?php declare(strict_types=1); |
2: | |
3: | namespace PhpParser\Node\Stmt; |
4: | |
5: | use PhpParser\Node; |
6: | |
7: | class If_ extends Node\Stmt { |
8: | |
9: | public Node\Expr $cond; |
10: | |
11: | public array $stmts; |
12: | |
13: | public array $elseifs; |
14: | |
15: | public ?Else_ $else; |
16: | |
17: | |
18: | |
19: | |
20: | |
21: | |
22: | |
23: | |
24: | |
25: | |
26: | |
27: | |
28: | |
29: | |
30: | |
31: | public function __construct(Node\Expr $cond, array $subNodes = [], array $attributes = []) { |
32: | $this->attributes = $attributes; |
33: | $this->cond = $cond; |
34: | $this->stmts = $subNodes['stmts'] ?? []; |
35: | $this->elseifs = $subNodes['elseifs'] ?? []; |
36: | $this->else = $subNodes['else'] ?? null; |
37: | } |
38: | |
39: | public function getSubNodeNames(): array { |
40: | return ['cond', 'stmts', 'elseifs', 'else']; |
41: | } |
42: | |
43: | public function getType(): string { |
44: | return 'Stmt_If'; |
45: | } |
46: | } |
47: | |