PhpParser\Node\Stmt\Property::__construct PHP Method

__construct() public method

Constructs a class property list node.
public __construct ( integer $flags, array $props, array $attributes = [] )
$flags integer Modifiers
$props array Properties
$attributes array Additional attributes
    public function __construct($flags, array $props, array $attributes = array())
    {
        parent::__construct($attributes);
        $this->flags = $flags;
        $this->type = $flags;
        $this->props = $props;
    }

Usage Example

Example #1
0
 /**
  * @param \ReflectionProperty $accessedProperty
  * @param string              $nameSuffix
  */
 public function __construct(\ReflectionProperty $accessedProperty, $nameSuffix)
 {
     $this->accessedProperty = $accessedProperty;
     $originalName = $accessedProperty->getName();
     $name = UniqueIdentifierGenerator::getIdentifier($originalName . $nameSuffix);
     parent::__construct(Class_::MODIFIER_PRIVATE, [new PropertyProperty($name)]);
 }