Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PHP 8.4 Support: Asymmetric Visibility v2 (Part 1)
- apache#8035 - https://wiki.php.net/rfc#php_84 - https://wiki.php.net/rfc/asymmetric-visibility-v2 - https://www.php.net/manual/en/language.oop5.final.php - Fix the lexers and the parser(grammar file) - Support for the `final` field(property) - Don't handle modifier errors for methods, constants, and fields in the parser. Instead, handle them in the hint error. Writing all valid cases for each member is very hard and complicated because the current PHP has many modifiers. - Fix the `PHP84UnhandledError` - Add/Fix unit tests for the navigator, lexer, and parser Example: ```php class AsymmetricVisibilityClass { // Constructor Property Promotion public function __construct( public(set) string $field1, // implicit public public private(set) int $field2, public protected(set) readonly int $field3, ) {} // valid fields public(set) string $example1; // implicit public pulbic private(set) int $example2 = 1; public protected(set) readonly int $example3; final private private(set) readonly string|int $example4; // final is available as of PHP 8.4 // invalid cases but the parser doesn't handle them as errors // e.g. public public string $invalid1 = "invalid"; // multiple same modifiers final private private(set) string|int $invalid2; // cannot use both final and private public public(set) $invalid3; // need type private public(set) string $invalid4; // visibility(private) must not be weaker than set visibility } ```
- Loading branch information