php / php-langspec

PHP Language Specification
http://www.php.net
Other
2.3k stars 271 forks source link

Add grammar for `readonly` property modifier #264

Open ghostwriter opened 8 months ago

ghostwriter commented 8 months ago

This patch adds the grammar for readonly property modifier, via the following changes:

diff --git a/spec/14-classes.md b/spec/14-classes.md

--- a/spec/14-classes.md
+++ b/spec/14-classes.md

property-modifier:
  'var'
-  visibility-modifier static-modifier?
-  static-modifier visibility-modifier?
+  visibility-modifier property-modifiers?
+  property-modifiers visibility-modifier?
+
+property-modifiers:
+  readonly-modifier
+  static-modifier
+
+readonly-modifier:
+  'readonly'

visibility-modifier:
  'public'
ghostwriter commented 8 months ago

or maybe, something like?

property-declaration:
 attributes? modifiers? types? property-elements ';'