Mercurial > hg > isophonics-drupal-site
diff vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php @ 13:5fb285c0d0e3
Update Drupal core to 8.4.7 via Composer. Security update; I *think* we've
been lucky to get away with this so far, as we don't support self-registration
which seems to be used by the so-called "drupalgeddon 2" attack that 8.4.5
was vulnerable to.
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:33:26 +0100 |
parents | 4c8ae668cc8c |
children |
line wrap: on
line diff
--- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php Fri Feb 23 15:52:07 2018 +0000 +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php Mon Apr 23 09:33:26 2018 +0100 @@ -1,4 +1,4 @@ -<?php +<?php declare(strict_types=1); namespace PhpParser\Node\Stmt; @@ -15,8 +15,6 @@ const MODIFIER_FINAL = 32; const VISIBILITY_MODIFIER_MASK = 7; // 1 | 2 | 4 - /** @deprecated */ - const VISIBILITY_MODIFER_MASK = self::VISIBILITY_MODIFIER_MASK; /** @var int Type */ public $flags; @@ -25,19 +23,10 @@ /** @var Node\Name[] Names of implemented interfaces */ public $implements; - /** @deprecated Use $flags instead */ - public $type; - - protected static $specialNames = array( - 'self' => 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 @@ * '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 @@ throw new Error('Cannot use the final modifier on an abstract class member'); } } + + public function getType() : string { + return 'Stmt_Class'; + } }