2014-02-06 14:44:16 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace PhpParser\Node\Stmt;
|
|
|
|
|
|
|
|
use PhpParser\Node;
|
|
|
|
|
|
|
|
class PropertyProperty extends Node\Stmt
|
|
|
|
{
|
2017-04-28 19:09:39 +02:00
|
|
|
/** @var Node\VarLikeIdentifier Name */
|
2015-02-28 18:44:28 +01:00
|
|
|
public $name;
|
|
|
|
/** @var null|Node\Expr Default */
|
|
|
|
public $default;
|
|
|
|
|
2014-02-06 14:44:16 +01:00
|
|
|
/**
|
|
|
|
* Constructs a class property node.
|
|
|
|
*
|
2017-04-28 19:09:39 +02:00
|
|
|
* @param string|Node\VarLikeIdentifier $name Name
|
|
|
|
* @param null|Node\Expr $default Default value
|
|
|
|
* @param array $attributes Additional attributes
|
2014-02-06 14:44:16 +01:00
|
|
|
*/
|
2017-08-13 14:06:08 +02:00
|
|
|
public function __construct($name, Node\Expr $default = null, array $attributes = []) {
|
2015-05-02 22:17:34 +02:00
|
|
|
parent::__construct($attributes);
|
2017-04-28 19:09:39 +02:00
|
|
|
$this->name = \is_string($name) ? new Node\VarLikeIdentifier($name) : $name;
|
2015-02-28 18:44:28 +01:00
|
|
|
$this->default = $default;
|
|
|
|
}
|
|
|
|
|
2017-04-28 21:40:59 +02:00
|
|
|
public function getSubNodeNames() : array {
|
2017-08-13 14:06:08 +02:00
|
|
|
return ['name', 'default'];
|
2014-02-06 14:44:16 +01:00
|
|
|
}
|
2015-02-28 18:44:28 +01:00
|
|
|
}
|