Skip to content

Commit 9fc365c

Browse files
committed
Update the abstract/final section to cover all modifier keywords.
1 parent b5cac84 commit 9fc365c

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

spec.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -579,13 +579,19 @@ public function process(string $algorithm, &...$parts)
579579
}
580580
```
581581

582-
### 4.6 `abstract`, `final`, and `static`
582+
### 4.6 Modifier keywords
583583

584-
When present, the `abstract` and `final` declarations MUST precede the
585-
visibility declaration.
584+
Properties and methods of a class have numerous keyword modifiers that alter how the
585+
engine and language handles them. When present, they MUST be in the following order:
586586

587-
When present, the `static` declaration MUST come after the visibility
588-
declaration.
587+
* Inheritance modifier: `abstract` or `final`
588+
* Visibility modifier: `public`, `protected`, or `private`
589+
* Scope modifier: `static`
590+
* Mutation modifier: `readonly`
591+
* Type declaration
592+
* Name
593+
594+
All keywords MUST be on a single line, and MUST be separated by a single space.
589595

590596
```php
591597
<?php
@@ -594,7 +600,9 @@ namespace Vendor\Package;
594600

595601
abstract class ClassName
596602
{
597-
protected static $foo;
603+
protected static readonly string $foo;
604+
605+
final protected int $beep;
598606

599607
abstract protected function zim();
600608

0 commit comments

Comments
 (0)