summaryrefslogtreecommitdiff
path: root/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php')
-rw-r--r--vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php25
1 files changed, 25 insertions, 0 deletions
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 b290aaf6d..52ed6c6cd 100644
--- a/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php
+++ b/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php
@@ -68,6 +68,10 @@ class Class_ extends ClassLike
return (bool) ($this->flags & self::MODIFIER_FINAL);
}
+ public function isReadonly() : bool {
+ return (bool) ($this->flags & self::MODIFIER_READONLY);
+ }
+
/**
* Whether the class is anonymous.
*
@@ -80,6 +84,27 @@ class Class_ extends ClassLike
/**
* @internal
*/
+ public static function verifyClassModifier($a, $b) {
+ if ($a & self::MODIFIER_ABSTRACT && $b & self::MODIFIER_ABSTRACT) {
+ throw new Error('Multiple abstract modifiers are not allowed');
+ }
+
+ if ($a & self::MODIFIER_FINAL && $b & self::MODIFIER_FINAL) {
+ throw new Error('Multiple final modifiers are not allowed');
+ }
+
+ if ($a & self::MODIFIER_READONLY && $b & self::MODIFIER_READONLY) {
+ throw new Error('Multiple readonly modifiers are not allowed');
+ }
+
+ if ($a & 48 && $b & 48) {
+ throw new Error('Cannot use the final modifier on an abstract class');
+ }
+ }
+
+ /**
+ * @internal
+ */
public static function verifyModifier($a, $b) {
if ($a & self::VISIBILITY_MODIFIER_MASK && $b & self::VISIBILITY_MODIFIER_MASK) {
throw new Error('Multiple access type modifiers are not allowed');