Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Releases: jorgsowa/rust-php-parser

v0.14.0

21 May 15:15

Choose a tag to compare

Added

  • Owned (lifetime-free) parse API: parse() and parse_versioned() return a fully-owned ParseResult with no lifetime parameters; existing arena API is now parse_arena() / parse_arena_versioned() (php-rs-parser).
  • php_ast::owned module — every AST type mirrored with Box<str> / Box<[T]> instead of arena references; JSON serialisation is byte-for-byte identical to arena types (php-ast).
  • OwnedVisitor, OwnedScopeVisitor, OwnedScopeWalker, and walk_owned_* free functions for traversing owned ASTs without managing lifetimes (php-ast).
  • FoldOwned trait and fold_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_owned and reparse_owned_versioned for lifetime-free re-parses (php-rs-parser).

v0.13.0

17 May 11:43

Choose a tag to compare

Added

  • ParseError::ForbiddenWarning variant and severity() method on ParseError — 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 void cast in value-consuming (expression) context (php-rs-parser).
  • Parser rejects standalone parenthesized intersection types (php-rs-parser).
  • Parser rejects new in 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 return value in void/never functions (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 get with any parameters (php-rs-parser).
  • Parser rejects non-hooked properties in interfaces (php-rs-parser).
  • Parser enforces asymmetric visibility rules: type required, set visibility cannot be wider than get (php-rs-parser).
  • Parser rejects final modifier on properties and readonly modifier on methods (php-rs-parser).
  • Parser rejects duplicate property declarations (php-rs-parser).
  • Parser rejects return type and static modifier on __construct (php-rs-parser).
  • Parser rejects static modifier on __destruct and __clone (php-rs-parser).
  • Parser rejects static modifier 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/false types below PHP 8.2 and Closure in attribute arguments (php-rs-parser).
  • Parser enforces program-level namespace layout rules (php-rs-parser).
  • Parser rejects multiple default arms in switch, variadic parameters with default values, and isset(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 use names and detects cross-statement duplicate imports (php-rs-parser).
  • Parser warns on final private methods (php-rs-parser).
  • Playground project dropdown stays open while scrolling the list (playground).
  • ast-stats tool counts files with warnings-only as parsed; only hard errors are skipped (ast-stats).

v0.12.2

16 May 14:36

Choose a tag to compare

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 ->prop in string interpolation (php-rs-parser).
  • Parser now correctly handles single-keyword asymmetric visibility (private(set)) (php-rs-parser).

v0.12.1

15 May 19:04

Choose a tag to compare

Added

  • visit_comment hook in the Visitor trait 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

15 May 18:53
cde33a3

Choose a tag to compare

Added

  • Fold trait 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_content state across blank lines, preventing spurious <?php tags from being emitted (php-printer).

v0.11.0

11 May 21:47

Choose a tag to compare

Added

  • pretty_print and all printer variants now emit <?php\n at the start of PHP-first programs, making the output valid standalone PHP (php-printer).
  • pretty_print_file simplified to pretty_print + trailing newline — no longer duplicates the <?php header logic (php-printer).

Fixed

  • Printer correctly emits ?> before inline HTML following alternative-syntax closing keywords (endforeach, endfor, endwhile, endif, endswitch, enddeclare) — previously the has_php_content flag was left false after the loop body, suppressing the close tag (php-printer).
  • Printer no longer emits a spurious trailing <?php after 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 to pretty_print(parse(src)) (php-printer).

Changed

  • phpdoc-parser crate 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

09 May 13:52

Choose a tag to compare

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

07 May 12:30
249218b

Choose a tag to compare

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

06 May 17:55

Choose a tag to compare

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::Error instead of Identifier("<error>"), improving error diagnostics (php-rs-parser).
  • Name::Error variant added for synthesized error names during error recovery (php-ast, php-rs-parser).
  • Enum constant validation: private enum constants now properly reject the final modifier (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_PLACEHOLDER string literals replaced with typed Ident at 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

27 Apr 21:35
5d04a03

Choose a tag to compare

[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.toml were still pinned to 0.9.4 after the 0.9.5 release; corrected to 0.9.5 (Cargo.toml).