Releases: jorgsowa/rust-php-parser
Releases · jorgsowa/rust-php-parser
v0.14.0
Added
- Owned (lifetime-free) parse API:
parse()andparse_versioned()return a fully-ownedParseResultwith no lifetime parameters; existing arena API is nowparse_arena()/parse_arena_versioned()(php-rs-parser). php_ast::ownedmodule — every AST type mirrored withBox<str>/Box<[T]>instead of arena references; JSON serialisation is byte-for-byte identical to arena types (php-ast).OwnedVisitor,OwnedScopeVisitor,OwnedScopeWalker, andwalk_owned_*free functions for traversing owned ASTs without managing lifetimes (php-ast).FoldOwnedtrait andfold_owned_*free functions for transforming owned ASTs; identity defaults rebuild the tree identically (php-ast).pretty_print_owned,pretty_print_owned_file, and related helpers for printing owned ASTs directly — converts owned→arena via a short-lived bump arena internally (php-printer).ParserContext::reparse_ownedandreparse_owned_versionedfor lifetime-free re-parses (php-rs-parser).
v0.13.0
Added
ParseError::ForbiddenWarningvariant andseverity()method onParseError— non-fatal diagnostics for constructs that PHP itself treats as warnings rather than hard errors (php-rs-parser).
Fixed
- Parser rejects incompatible
set-hook parameter types (php-rs-parser). - Parser rejects
voidcast in value-consuming (expression) context (php-rs-parser). - Parser rejects standalone parenthesized intersection types (
php-rs-parser). - Parser rejects
newin constant, property, and static-variable initializers (php-rs-parser). - Parser rejects curly-brace array/string offset access (
$a{'b'}) (php-rs-parser). - Parser rejects mixing
list()and[]in destructuring (php-rs-parser). - Parser rejects empty
list()/[, ,]destructuring (php-rs-parser). - Parser rejects non-writable destructure targets (
php-rs-parser). - Parser rejects temporary expression in write context (
php-rs-parser). - Parser rejects
returnvalue invoid/neverfunctions (php-rs-parser). - Parser rejects
new ClassName(...)first-class callable syntax (php-rs-parser). - Parser rejects property hooks on static properties (
php-rs-parser). - Parser rejects empty property hook list and
getwith any parameters (php-rs-parser). - Parser rejects non-hooked properties in interfaces (
php-rs-parser). - Parser enforces asymmetric visibility rules: type required,
setvisibility cannot be wider thanget(php-rs-parser). - Parser rejects
finalmodifier on properties andreadonlymodifier on methods (php-rs-parser). - Parser rejects duplicate property declarations (
php-rs-parser). - Parser rejects return type and
staticmodifier on__construct(php-rs-parser). - Parser rejects
staticmodifier on__destructand__clone(php-rs-parser). - Parser rejects
staticmodifier on parameters (php-rs-parser). - Parser rejects promoted property modifiers outside
__construct(php-rs-parser). - Parser rejects duplicate methods and enum cases (
php-rs-parser). - Parser rejects reserved type names (
int,string, etc.) as class names (php-rs-parser). - Parser rejects standalone
null/falsetypes below PHP 8.2 andClosurein attribute arguments (php-rs-parser). - Parser enforces program-level namespace layout rules (
php-rs-parser). - Parser rejects multiple
defaultarms inswitch, variadic parameters with default values, andisset(expr)with non-variable arguments (php-rs-parser). - Operator precedence aligned with PHP 8 — three additional opt-out gaps closed (
php-rs-parser). - Parser warns on non-compound
usenames and detects cross-statement duplicate imports (php-rs-parser). - Parser warns on
final privatemethods (php-rs-parser). - Playground project dropdown stays open while scrolling the list (
playground). ast-statstool counts files with warnings-only as parsed; only hard errors are skipped (ast-stats).
v0.12.2
Added
- Project stats playground expanded from 10 to 50 open-source PHP projects with per-directory breakdown and expandable node-variant rows.
- Per-project stats pages with interactive directory tree navigation.
- AST node comparison page for side-by-side project analysis.
Fixed
- Parser no longer consumes
[index]after->propin string interpolation (php-rs-parser). - Parser now correctly handles single-keyword asymmetric visibility (
private(set)) (php-rs-parser).
v0.12.1
Added
visit_commenthook in theVisitortrait for traversing doc comments on declarations (php-ast).
Fixed
- Doc comments no longer leak across scope boundaries during parsing — scoped comments are properly isolated to their declaration context (
php-rs-parser).
Tests
- Comprehensive comment fixture coverage across all supported PHP versions (
php-rs-parser).
v0.12.0
Added
Foldtrait for arena-to-arena AST transformations — enables efficient rewriting of AST nodes with the bump arena as the target allocation context (php-ast).- Printer now preserves blank lines from source in switch cases and enum members, maintaining semantic formatting hints from the original code (
php-printer).
Fixed
- Printer now correctly tracks
has_php_contentstate across blank lines, preventing spurious<?phptags from being emitted (php-printer).
v0.11.0
Added
pretty_printand all printer variants now emit<?php\nat the start of PHP-first programs, making the output valid standalone PHP (php-printer).pretty_print_filesimplified topretty_print+ trailing newline — no longer duplicates the<?phpheader logic (php-printer).
Fixed
- Printer correctly emits
?>before inline HTML following alternative-syntax closing keywords (endforeach,endfor,endwhile,endif,endswitch,enddeclare) — previously thehas_php_contentflag was leftfalseafter the loop body, suppressing the close tag (php-printer). - Printer no longer emits a spurious trailing
<?phpafter the last inline HTML node in a file (php-printer). - Printer suppresses
?>for empty<?php ?>blocks that produce no PHP output (php-printer). - Round-trip stability verified across the full parser corpus —
pretty_print(parse(pretty_print(parse(src))))is always identical topretty_print(parse(src))(php-printer).
Changed
phpdoc-parsercrate replaced with a structural-only implementation that parses PHPDoc blocks without external dependencies (phpdoc-parser).- README expanded with full API coverage;
docs/directory removed in favour of inline documentation.
v0.10.0
Added
- Enhanced parser validation for constructor promotion modifiers — explicitly rejects multiple modifiers on promoted parameters in anonymous classes and refines declare -r BASHOPTS="checkwinsize:cmdhist:complete_fullquote:extquote:force_fignore:globasciiranges:globskipdots:hostcomplete:interactive_comments:patsub_replacement:progcomp:promptvars:sourcepath"
declare -ar BASH_VERSINFO=([0]="5" [1]="2" [2]="21" [3]="1" [4]="release" [5]="x86_64-pc-linux-gnu")
declare -ir EUID="1001"
declare -ir PPID="2160"
declare -r SHELLOPTS="braceexpand:hashall:interactive-comments"
declare -ir UID="1001" validation on properties (). - Improved error diagnostics with proper error context in recovery paths — error recovery now preserves more meaningful context for debugging ().
- CI validation: printer output now validated against No syntax errors detected in Standard input code to ensure round-trip output is syntactically valid PHP ().
- Comprehensive printer edge-case coverage including expressions with empty arguments, property hooks, DNF types, pipe operator expressions, and clone with list arguments ().
Fixed
- Parser validates parenthesized arrow functions in pipe operator () expressions — prevents invalid syntax like ().
- Parser now rejects invalid PHP constructs during parsing rather than silently accepting them and potentially dropping AST nodes ().
- Control characters in heredoc/nowdoc and braces in string interpolation now properly escaped in printer output ().
- Variadic parameter modifiers now print in correct order ( before ) to match PHP syntax ().
- Printer now always emits parentheses for expressions, ensuring valid PHP output in all contexts ().
- Property hooks printer fixture updated with valid PHP syntax and edge cases ().
Changed
- All calls replaced with with documented invariants explaining why panic is guaranteed not to occur ().
- Clippy warnings in example binaries resolved ().
- Test fixtures now include sections where appropriate to validate against PHP's own syntax validation ().
- Fixture test runner parallelized with for faster test execution ().
Documentation
- Added inline documentation explaining dead-code suppressions in test utilities ().
- Parser recursion depth limits and error recovery behavior documented in source ().
Tests
- Comprehensive edge cases for variadic parameter modifiers ().
- Printer fixtures expanded to cover expressions, property hooks, and DNF type combinations ().
v0.9.8
v0.9.8
Added
- Support for parenthesized unions in type hints (e.g.,
(A|B)) — parser now accepts parenthesized unions in parameter types, return types, and property types for better type expression flexibility (php-rs-parser). - Comprehensive test coverage for DNF (Disjunctive Normal Form) edge cases and parenthesized type combinations (
php-rs-parser).
v0.9.7
v0.9.7
Added
- Context-aware anchor sets for error recovery — parser now maintains contextual error recovery anchors to improve diagnostics in various syntactic contexts (issue #276) (
php-rs-parser).
Fixed
- Declaration docblocks are now preserved during parsing instead of being dropped (
php-rs-parser). - Parse errors for invalid names now emit
ExprKind::Errorinstead ofIdentifier("<error>"), improving error diagnostics (php-rs-parser). Name::Errorvariant added for synthesized error names during error recovery (php-ast,php-rs-parser).- Enum constant validation: private enum constants now properly reject the
finalmodifier (php-rs-parser). - Enum constant validation: static and abstract modifiers on enum constants now properly validated (
php-rs-parser). - PHP version-specific error message handling aligned across all PHP 8.1–8.5 error recovery fixtures (
php-rs-parser).
Changed
- Internal refactoring:
ERROR_PLACEHOLDERstring literals replaced with typedIdentat declaration name sites (php-rs-parser).
Tests
- Comprehensive enum constant parser and printer coverage (
php-rs-parser,php-printer). - Expression span edge-case fixtures from parser audit (
php-rs-parser). - Version-specific interface and trait error recovery fixtures for PHP 8.1–8.5 coverage (
php-rs-parser). - Comprehensive error recovery fixtures for various syntactic contexts (issue #276) (
php-rs-parser).
v0.9.6
[0.9.6] - 2026-04-27
Added
- Playground AST tree is now interactive with collapsible nodes — click any node to expand or collapse its subtree (
playground).
Fixed
- Workspace dependency versions in
Cargo.tomlwere still pinned to0.9.4after the 0.9.5 release; corrected to0.9.5(Cargo.toml).