Skip to content

Commit e07d0ad

Browse files
committed
Add TODO tracker for PHP 8.3-8.5 support
1 parent 457738c commit e07d0ad

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

TOLERANT_TODO.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Tolerant Parser Update TODO
2+
3+
## Overview
4+
5+
This branch tracks work needed to bring the tolerant PHP parser up to date for PHP 8.3, 8.4, and 8.5 so that downstream consumers (notably Phan) can rely on it when the native `ext-ast` extension is unavailable. The fork currently matches upstream commit `457738cbe` (September 2024) and is missing several recent language features.
6+
7+
## Current Status
8+
9+
- PHPUnit suites `invariants` and `api` pass locally when run with `zend.assertions=1` and `assert.exception=1`.
10+
- Grammar fixtures (`tests/cases/parser*.tree/.diag`) were generated before the latest language changes; they will need regeneration once parser updates land.
11+
- Validation tests that depend on large submodules (`validation/frameworks/*`) remain skipped/not vendored.
12+
13+
## Gaps / Work Items
14+
15+
### PHP 8.3
16+
17+
Most 8.3 constructs parse, but we should explicitly verify:
18+
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.
22+
23+
### PHP 8.4
24+
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.
31+
32+
### PHP 8.5 (in progress)
33+
34+
Monitor RFCs merged into php-src and mirror the token/grammar changes, for example:
35+
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+
40+
### Diagnostics & Node Mapping
41+
42+
- Review `TokenKind`/`TokenStringMaps` for completeness after adding new tokens.
43+
- Ensure node classes record line/column spans needed by language-server features when hooks and new constructs are present.
44+
- Verify edits still map correctly (`TextEdit`, node mapping) for newly supported syntax.
45+
46+
### Tests & Tooling
47+
48+
- Add focused fixtures for property hooks and any new constructs under `tests/cases/parser` (and regenerate `.tree/.diag`).
49+
- Re-enable / update tolerant PHPUnit suites once fixtures are refreshed.
50+
- Consider syncing targeted tests from Phan’s fallback suite to catch divergences early.
51+
52+
### Integration with Phan
53+
54+
- After implementing features, run Phan’s fallback parser tests (`./tests/run_test __FakeSelfFallbackTest`) to ensure parity.
55+
- Publish updated tags / commit references so Phan can subtree merge the changes into `third_party/phan-tolerant`.
56+
57+
## Next Steps
58+
59+
1. Audit existing fixtures vs php-src 8.3/8.4 syntax to catalogue precise failures.
60+
2. Prototype grammar/tokenizer changes for property hooks and regenerate associated AST nodes.
61+
3. Update diagnostics and tolerant AST converter expectations in tandem with Phan.
62+
4. Refresh fixtures and CI to cover the new syntax.
63+
5. Coordinate subtree sync back into Phan once tests pass.
64+

0 commit comments

Comments
 (0)