@@ -620,13 +620,19 @@ public function process(string $algorithm, &...$parts)
620
620
}
621
621
```
622
622
623
- ### 4.6 ` abstract ` , ` final ` , and ` static `
623
+ ### 4.6 Modifier Keywords
624
624
625
- When present, the ` abstract ` and ` final ` declarations MUST precede the
626
- visibility declaration.
625
+ Properties and methods of a class have numerous keyword modifiers that alter how the
626
+ engine and language handles them. When present, they MUST be in the following order:
627
627
628
- When present, the ` static ` declaration MUST come after the visibility
629
- declaration.
628
+ * Inheritance modifier: ` abstract ` or ` final `
629
+ * Visibility modifier: ` public ` , ` protected ` , or ` private `
630
+ * Scope modifier: ` static `
631
+ * Mutation modifier: ` readonly `
632
+ * Type declaration
633
+ * Name
634
+
635
+ All keywords MUST be on a single line, and MUST be separated by a single space.
630
636
631
637
``` php
632
638
<?php
@@ -635,7 +641,9 @@ namespace Vendor\Package;
635
641
636
642
abstract class ClassName
637
643
{
638
- protected static $foo;
644
+ protected static readonly string $foo;
645
+
646
+ final protected int $beep;
639
647
640
648
abstract protected function zim();
641
649
@@ -644,6 +652,11 @@ abstract class ClassName
644
652
// method body
645
653
}
646
654
}
655
+
656
+ readonly class ValueObject
657
+ {
658
+ // ...
659
+ }
647
660
```
648
661
649
662
### 4.7 Method and Function Calls
0 commit comments