Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Property.php

class Property

Same name in this branch
  1. 11.1.x vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Property.php \PhpParser\Node\Scalar\MagicConst\Property
  2. 11.1.x vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Property.php \PhpParser\Node\Stmt\Property
  3. 11.1.x vendor/nikic/php-parser/lib/PhpParser/Builder/Property.php \PhpParser\Builder\Property
  4. 11.1.x vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Property.php \phpDocumentor\Reflection\DocBlock\Tags\Property

A node that represents a property in an object literal. For example "b" in: a = {b: 1}

@author Marco Marchiò <marco.mm89@gmail.com>

Hierarchy

  • class \Peast\Syntax\Node\Node implements \Peast\Syntax\Node\JSONSerializable
    • class \Peast\Syntax\Node\Property extends \Peast\Syntax\Node\Node

Expanded class hierarchy of Property

40 string references to 'Property'
AnnotationHelper::processDocComment in vendor/phpstan/phpstan-phpunit/src/Rules/PHPUnit/AnnotationHelper.php
*
AssignmentProperty::getType in vendor/mck89/peast/lib/Peast/Syntax/Node/AssignmentProperty.php
Returns node's type
AttributeAutoconfigurationPass::process in vendor/symfony/dependency-injection/Compiler/AttributeAutoconfigurationPass.php
You can modify the container here before it is dumped to PHP code.
BlockCustomTranslation::prepareRow in core/modules/block_content/src/Plugin/migrate/source/d7/BlockCustomTranslation.php
Adds additional data to the row.
d6_field_instance_label_description_translation.yml in core/modules/config_translation/migrations/d6_field_instance_label_description_translation.yml
core/modules/config_translation/migrations/d6_field_instance_label_description_translation.yml

... See full list

File

vendor/mck89/peast/lib/Peast/Syntax/Node/Property.php, line 18

Namespace

Peast\Syntax\Node
View source
class Property extends Node {
    
    /**
     * Map of node properties
     * 
     * @var array 
     */
    protected $propertiesMap = array(
        "key" => true,
        "value" => true,
        "kind" => false,
        "method" => false,
        "shorthand" => false,
        "computed" => false,
    );
    
    //Kind constants
    
    /**
     * The default kind for properties
     */
    const KIND_INIT = "init";
    
    /**
     * Getter property
     */
    const KIND_GET = "get";
    
    /**
     * Setter property
     */
    const KIND_SET = "set";
    
    /**
     * Property key
     * 
     * @var Expression 
     */
    protected $key;
    
    /**
     * Property value
     * 
     * @var Expression 
     */
    protected $value;
    
    /**
     * Property kind that is one of the kind constants
     * 
     * @var string
     */
    protected $kind = self::KIND_INIT;
    
    /**
     * Property method flag that is true when the property is a method
     * 
     * @var bool 
     */
    protected $method = false;
    
    /**
     * Property shorthand flag that is true when the property is declared
     * using an identifier and without a value
     * 
     * @var bool 
     */
    protected $shorthand = false;
    
    /**
     * Property computed flag that is true when the property is declared using
     * the square brackets syntax
     * 
     * @var bool 
     */
    protected $computed = false;
    
    /**
     * Returns the property key
     * 
     * @return Expression
     */
    public function getKey() {
        return $this->key;
    }
    
    /**
     * Sets the property key
     * 
     * @param Expression $key Property key
     * 
     * @return $this
     */
    public function setKey(Expression $key) {
        $this->key = $key;
        return $this;
    }
    
    /**
     * Returns the property value
     * 
     * @return Expression
     */
    public function getValue() {
        return $this->value;
    }
    
    /**
     * Sets the property value
     * 
     * @param Expression $value Property value
     * 
     * @return $this
     */
    public function setValue($value) {
        $this->assertType($value, "Expression");
        $this->value = $value;
        return $this;
    }
    
    /**
     * Returns the property kind that is one of the kind constants
     * 
     * @return string
     */
    public function getKind() {
        return $this->kind;
    }
    
    /**
     * Sets the property kind that is one of the kind constants
     * 
     * @param string $kind Property kind
     * 
     * @return $this
     */
    public function setKind($kind) {
        $this->kind = $kind;
        return $this;
    }
    
    /**
     * Returns the property method flag that is true when the property is a
     * method
     * 
     * @return bool
     */
    public function getMethod() {
        return $this->method;
    }
    
    /**
     * Sets the property method flag that is true when the property is a method
     * 
     * @param bool $method Method flag
     * 
     * @return $this
     */
    public function setMethod($method) {
        $this->method = (bool) $method;
        return $this;
    }
    
    /**
     * Returns the property shorthand flag that is true when the property
     * is declared using an identifier and without a value
     * 
     * @return bool 
     */
    public function getShorthand() {
        return $this->shorthand;
    }
    
    /**
     * Sets the property shorthand flag that is true when the property
     * is declared using an identifier and without a value
     * 
     * @param bool $shorthand Property shorthand flag
     * 
     * @return $this
     */
    public function setShorthand($shorthand) {
        $this->shorthand = (bool) $shorthand;
        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;
    }

}

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
Property::$computed protected property Property computed flag that is true when the property is declared using
the square brackets syntax
Property::$key protected property Property key
Property::$kind protected property Property kind that is one of the kind constants
Property::$method protected property Property method flag that is true when the property is a method
Property::$propertiesMap protected property Map of node properties Overrides Node::$propertiesMap
Property::$shorthand protected property Property shorthand flag that is true when the property is declared
using an identifier and without a value
Property::$value protected property Property value
Property::getComputed public function Returns the property computed flag that is true when the property is
declared using the square brackets syntax
Property::getKey public function Returns the property key
Property::getKind public function Returns the property kind that is one of the kind constants
Property::getMethod public function Returns the property method flag that is true when the property is a
method
Property::getShorthand public function Returns the property shorthand flag that is true when the property
is declared using an identifier and without a value
Property::getValue public function Returns the property value
Property::KIND_GET constant Getter property
Property::KIND_INIT constant The default kind for properties
Property::KIND_SET constant Setter property
Property::setComputed public function Sets the property computed flag that is true when the property is
declared using the square brackets syntax
Property::setKey public function Sets the property key
Property::setKind public function Sets the property kind that is one of the kind constants 1
Property::setMethod public function Sets the property method flag that is true when the property is a method 1
Property::setShorthand public function Sets the property shorthand flag that is true when the property
is declared using an identifier and without a value
Property::setValue public function Sets the property value 1
RSS feed
Powered by Drupal