Skip to content

Commit 65030d7

Browse files
committed
Refine PHP 8.x roadmap from RFC review
1 parent e07d0ad commit 65030d7

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

TOLERANT_TODO.md

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,34 @@ This branch tracks work needed to bring the tolerant PHP parser up to date for P
1414

1515
### PHP 8.3
1616

17-
Most 8.3 constructs parse, but we should explicitly verify:
17+
Double-check tolerant against the language changes that shipped with 8.3:
1818

19-
- `readonly` refinements (interfaces, class constants) – ensure new modifiers propagate through `Parser` and AST classes.
20-
- Enum improvements (interface inheritance rules, optional `implements` lists) – confirm grammar and diagnostics still match php-src.
21-
- Property initialisers inside `readonly` classes behave the same as php-ast output.
19+
- **Dynamic class constant fetch** (`Foo::{expr}`): ensure tokenizer/grammar accept brace-wrapped expressions after `::`, add fixtures, and mirror php-ast node structure.
20+
- **Typed class constants / readonly amendments**: confirm class-constant declarations propagate their type information and `readonly` constraints into tolerant AST output.
21+
- **`#[\Override]` attribute**: attributes already parse, but we should add fixtures to verify tolerant preserves them on methods.
22+
- **Arbitrary static variable initialisers**: while this is largely semantic, tolerant should accept the new grammar in function-level `static` declarations and update diagnostics if necessary.
2223

2324
### PHP 8.4
2425

25-
- **Property hooks** (`public int $count { get => $this->value; set { ... } }`).
26-
- Extend the tokenizer/grammar so `get`/`set` in this context become dedicated tokens (not identifiers).
27-
- Update AST node classes to represent hook lists and bodies.
28-
- Adjust diagnostics and tolerant AST converter (in Phan) to populate the `hooks` child.
29-
- New attribute placements (e.g. attributes on `class const`, hook blocks) must be accepted and serialized.
30-
- `readonly` class improvements and intersection types: confirm parser emits the correct flags and up-to-date diagnostics.
26+
- **Property access hooks** (`public int $count { get => ...; set { ... } }`):
27+
- Tokenizer must recognise `get`/`set` (and hook modifiers) in this context.
28+
- Introduce AST nodes for hook lists/bodies that align with php-ast’s `AST_PROP_ELEM` `hooks` child.
29+
- Update diagnostics to catch invalid hook combinations.
30+
- **Asymmetric visibility v2** (`public(set) private(get) $prop;`): extend the modifier grammar, update `TokenKind`, and cover tolerant AST flag handling.
31+
- **`new Foo()->bar()` without wrapping parentheses**: confirm parser handles the reduced precedence and add regression tests.
32+
- **Property hook improvements** (hook attributes, multiple hooks per property, etc.): ensure attribute placement and hook ordering are represented correctly.
33+
- Audit additional 8.4 deprecations that change parsing (e.g. implicit nullable parameters) to ensure tolerant still emits matching diagnostics.
3134

3235
### PHP 8.5 (in progress)
3336

3437
Monitor RFCs merged into php-src and mirror the token/grammar changes, for example:
3538

36-
- Asymmetric property visibility.
37-
- Additional keywords or attribute positions.
38-
- New `T_*` tokens introduced in php-src; update `TokenKind.php` and `TokenStringMaps.php` accordingly.
39+
- **Pipe operator** (`expr |> func(...)`): add new tokens, precedence rules, AST nodes, and fixtures.
40+
- **`clone with`** expressions: model the new syntax (`clone $obj with { prop: value }`) and ensure node mapping covers the initializer list.
41+
- **Final property promotion** (`final public function __construct(private final string $x) {}`): allow `final` in promoted parameters and carry flags into tolerant AST.
42+
- **Attributes on constants / extended attribute targets**: verify attributes on constants and traits are preserved.
43+
- **Extend `#[\Override]` to properties / `#[\NoDiscard]` / `#[\DelayedTargetValidation]`**: attributes already parse, but add regression coverage to ensure tolerant does not misclassify their targets.
44+
- Track any additional keywords (`with`, operator tokens, etc.) and update `TokenKind.php` / `TokenStringMaps.php` accordingly.
3945

4046
### Diagnostics & Node Mapping
4147

@@ -61,4 +67,3 @@ Monitor RFCs merged into php-src and mirror the token/grammar changes, for examp
6167
3. Update diagnostics and tolerant AST converter expectations in tandem with Phan.
6268
4. Refresh fixtures and CI to cover the new syntax.
6369
5. Coordinate subtree sync back into Phan once tests pass.
64-

0 commit comments

Comments
 (0)