class PropertyDefinition
A node that represents a property definition in class body.
@author Marco Marchiò <marco.mm89@gmail.com>
Hierarchy
- class \Peast\Syntax\Node\Node implements \Peast\Syntax\Node\JSONSerializable
- class \Peast\Syntax\Node\PropertyDefinition extends \Peast\Syntax\Node\Node
Expanded class hierarchy of PropertyDefinition
3 string references to 'PropertyDefinition'
- ClassBody::setBody in vendor/
mck89/ peast/ lib/ Peast/ Syntax/ Node/ ClassBody.php - Sets class methods and properties
- Parser::parseFieldDefinition in vendor/
mck89/ peast/ lib/ Peast/ Syntax/ Parser.php - Parses a field definition
- Renderer::renderNode in vendor/
mck89/ peast/ lib/ Peast/ Renderer.php - Renders a node
File
-
vendor/
mck89/ peast/ lib/ Peast/ Syntax/ Node/ PropertyDefinition.php, line 17
Namespace
Peast\Syntax\NodeView source
class PropertyDefinition extends Node {
/**
* Map of node properties
*
* @var array
*/
protected $propertiesMap = array(
"key" => true,
"value" => true,
"computed" => false,
"static" => false,
);
/**
* Property key
*
* @var Expression|PrivateIdentifier
*/
protected $key;
/**
* Optional property value
*
* @var Expression|null
*/
protected $value;
/**
* Property computed flag that is true when the property is declared using
* the square brackets syntax
*
* @var bool
*/
protected $computed = false;
/**
* Property static flag that is true when the property is declared static
*
* @var bool
*/
protected $static = false;
/**
* Returns the property key
*
* @return Expression|PrivateIdentifier
*/
public function getKey() {
return $this->key;
}
/**
* Sets the property key
*
* @param Expression|PrivateIdentifier $key Property key
*
* @return $this
*/
public function setKey($key) {
$this->assertType($key, array(
"Expression",
"PrivateIdentifier",
));
$this->key = $key;
return $this;
}
/**
* Returns the property value
*
* @return Expression|null
*/
public function getValue() {
return $this->value;
}
/**
* Sets the property value
*
* @param Expression|null $value Property value
*
* @return $this
*/
public function setValue($value) {
$this->assertType($value, "Expression", true);
$this->value = $value;
return $this;
}
/**
* Returns the property computed flag that is true when the property is
* declared using the square brackets syntax
*
* @return bool
*/
public function getComputed() {
return $this->computed;
}
/**
* Sets the property computed flag that is true when the property is
* declared using the square brackets syntax
*
* @param bool $computed Property computed flag
*
* @return $this
*/
public function setComputed($computed) {
$this->computed = (bool) $computed;
return $this;
}
/**
* Returns the property static flag that is true when the property is
* declared static
*
* @return bool
*/
public function getStatic() {
return $this->static;
}
/**
* Sets the property static flag that is true when the property is
* declared static
*
* @param bool $static Property static flag
*
* @return $this
*/
public function setStatic($static) {
$this->static = (bool) $static;
return $this;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
Node::$leadingComments | protected | property | Leading comments array | ||
Node::$location | public | property | Node location in the source code | ||
Node::$trailingComments | protected | property | Trailing comments array | ||
Node::assertArrayOf | protected | function | Asserts that the given value is an array of defined type | ||
Node::assertType | protected | function | Asserts that the given value respects the defined type | ||
Node::getLeadingComments | public | function | Returns leading comments array | ||
Node::getLocation | public | function | Returns node location in the source code | ||
Node::getTrailingComments | public | function | Returns trailing comments array | ||
Node::getType | public | function | Returns node type | 2 | |
Node::jsonSerialize | public | function | Returns a serializable version of the node | 2 | |
Node::render | public | function | Renders the current node | ||
Node::setEndPosition | public | function | Sets the end position of the node in the source code | ||
Node::setLeadingComments | public | function | Sets leading comments array | 1 | |
Node::setStartPosition | public | function | Sets the start position of the node in the source code | ||
Node::setTrailingComments | public | function | Sets trailing comments array | 1 | |
Node::traverse | public | function | Traverses the current node and all its child nodes using the given function |
||
Node::typeError | protected | function | Throws an error if the defined type is not supported b | ||
Node::__construct | public | function | Class constructor | ||
PropertyDefinition::$computed | protected | property | Property computed flag that is true when the property is declared using the square brackets syntax |
||
PropertyDefinition::$key | protected | property | Property key | ||
PropertyDefinition::$propertiesMap | protected | property | Map of node properties | Overrides Node::$propertiesMap | |
PropertyDefinition::$static | protected | property | Property static flag that is true when the property is declared static | ||
PropertyDefinition::$value | protected | property | Optional property value | ||
PropertyDefinition::getComputed | public | function | Returns the property computed flag that is true when the property is declared using the square brackets syntax |
||
PropertyDefinition::getKey | public | function | Returns the property key | ||
PropertyDefinition::getStatic | public | function | Returns the property static flag that is true when the property is declared static |
||
PropertyDefinition::getValue | public | function | Returns the property value | ||
PropertyDefinition::setComputed | public | function | Sets the property computed flag that is true when the property is declared using the square brackets syntax |
||
PropertyDefinition::setKey | public | function | Sets the property key | ||
PropertyDefinition::setStatic | public | function | Sets the property static flag that is true when the property is declared static |
||
PropertyDefinition::setValue | public | function | Sets the property value |