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