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=7e624da66d70713f090d09c0364d8e30c88d8023;hp=0000000000000000000000000000000000000000;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad diff --git a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php new file mode 100644 index 000000000..7e624da66 --- /dev/null +++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php @@ -0,0 +1,97 @@ + true, + 'parent' => true, + 'static' => true, + ); + + /** + * Constructs a class node. + * + * @param string|null $name Name + * @param array $subNodes Array of the following optional subnodes: + * 'flags' => 0 : Flags + * 'extends' => null : Name of extended class + * 'implements' => array(): Names of implemented interfaces + * 'stmts' => array(): Statements + * @param array $attributes Additional attributes + */ + public function __construct($name, array $subNodes = array(), array $attributes = array()) { + 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(); + } + + public function getSubNodeNames() { + return array('flags', 'name', 'extends', 'implements', 'stmts'); + } + + public function isAbstract() { + return (bool) ($this->flags & self::MODIFIER_ABSTRACT); + } + + public function isFinal() { + return (bool) ($this->flags & self::MODIFIER_FINAL); + } + + public function isAnonymous() { + return null === $this->name; + } + + /** + * @internal + */ + public static function verifyModifier($a, $b) { + if ($a & self::VISIBILITY_MODIFER_MASK && $b & self::VISIBILITY_MODIFER_MASK) { + throw new Error('Multiple access type modifiers are not allowed'); + } + + if ($a & self::MODIFIER_ABSTRACT && $b & self::MODIFIER_ABSTRACT) { + throw new Error('Multiple abstract modifiers are not allowed'); + } + + if ($a & self::MODIFIER_STATIC && $b & self::MODIFIER_STATIC) { + throw new Error('Multiple static modifiers are not allowed'); + } + + if ($a & self::MODIFIER_FINAL && $b & self::MODIFIER_FINAL) { + throw new Error('Multiple final modifiers are not allowed'); + } + + if ($a & 48 && $b & 48) { + throw new Error('Cannot use the final modifier on an abstract class member'); + } + } +}