X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fnikic%2Fphp-parser%2Flib%2FPhpParser%2FNode%2FStmt%2FClass_.php;fp=vendor%2Fnikic%2Fphp-parser%2Flib%2FPhpParser%2FNode%2FStmt%2FClass_.php;h=78bd1957053faf7789df6c9016f87af274cff75e;hp=0a65e37403df96e83bc5d7df01a4140bbf9fb49b;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php index 0a65e3740..78bd19570 100644 --- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php @@ -1,4 +1,4 @@ - true, - 'parent' => true, - 'static' => true, - ); - /** * Constructs a class node. * - * @param string|null $name Name + * @param string|Node\Identifier|null $name Name * @param array $subNodes Array of the following optional subnodes: * 'flags' => 0 : Flags * 'extends' => null : Name of extended class @@ -45,30 +34,43 @@ class Class_ extends ClassLike * 'stmts' => array(): Statements * @param array $attributes Additional attributes */ - public function __construct($name, array $subNodes = array(), array $attributes = array()) { + public function __construct($name, array $subNodes = [], array $attributes = []) { parent::__construct($attributes); - $this->flags = isset($subNodes['flags']) ? $subNodes['flags'] - : (isset($subNodes['type']) ? $subNodes['type'] : 0); - $this->type = $this->flags; - $this->name = $name; - $this->extends = isset($subNodes['extends']) ? $subNodes['extends'] : null; - $this->implements = isset($subNodes['implements']) ? $subNodes['implements'] : array(); - $this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array(); + $this->flags = $subNodes['flags'] ?? $subNodes['type'] ?? 0; + $this->name = \is_string($name) ? new Node\Identifier($name) : $name; + $this->extends = $subNodes['extends'] ?? null; + $this->implements = $subNodes['implements'] ?? []; + $this->stmts = $subNodes['stmts'] ?? []; } - public function getSubNodeNames() { - return array('flags', 'name', 'extends', 'implements', 'stmts'); + public function getSubNodeNames() : array { + return ['flags', 'name', 'extends', 'implements', 'stmts']; } - public function isAbstract() { + /** + * Whether the class is explicitly abstract. + * + * @return bool + */ + public function isAbstract() : bool { return (bool) ($this->flags & self::MODIFIER_ABSTRACT); } - public function isFinal() { + /** + * Whether the class is final. + * + * @return bool + */ + public function isFinal() : bool { return (bool) ($this->flags & self::MODIFIER_FINAL); } - public function isAnonymous() { + /** + * Whether the class is anonymous. + * + * @return bool + */ + public function isAnonymous() : bool { return null === $this->name; } @@ -96,4 +98,8 @@ class Class_ extends ClassLike throw new Error('Cannot use the final modifier on an abstract class member'); } } + + public function getType() : string { + return 'Stmt_Class'; + } }