-<?php
+<?php declare(strict_types=1);
namespace PhpParser\Node\Stmt;
{
/** @var Node\Expr Condition expression */
public $cond;
- /** @var Node[] Statements */
+ /** @var Node\Stmt[] Statements */
public $stmts;
/** @var ElseIf_[] Elseif clauses */
public $elseifs;
* 'else' => null : Else clause
* @param array $attributes Additional attributes
*/
- public function __construct(Node\Expr $cond, array $subNodes = array(), array $attributes = array()) {
+ public function __construct(Node\Expr $cond, array $subNodes = [], array $attributes = []) {
parent::__construct($attributes);
$this->cond = $cond;
- $this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array();
- $this->elseifs = isset($subNodes['elseifs']) ? $subNodes['elseifs'] : array();
- $this->else = isset($subNodes['else']) ? $subNodes['else'] : null;
+ $this->stmts = $subNodes['stmts'] ?? [];
+ $this->elseifs = $subNodes['elseifs'] ?? [];
+ $this->else = $subNodes['else'] ?? null;
}
- public function getSubNodeNames() {
- return array('cond', 'stmts', 'elseifs', 'else');
+ public function getSubNodeNames() : array {
+ return ['cond', 'stmts', 'elseifs', 'else'];
+ }
+
+ public function getType() : string {
+ return 'Stmt_If';
}
}