zephir_parser

Zephir code parser.


Zephir Parser is a code parser, delivered as a C extension for the PHP language.

License: MIT

Latest releases

Version Release Download
2.5.0 2026-07-20 zephir_parser-2.5.0.tgz
2.4.0 2026-07-19 zephir_parser-2.4.0.tgz
2.3.0 2026-07-19 zephir_parser-2.3.0.tgz
2.2.0 2026-07-18 zephir_parser-2.2.0.tgz
2.1.0 2026-07-03 zephir_parser-2.1.0.tgz
Show all releases

Changelog

Version Message
2.5.0 ### Added
- Support the `readonly` modifier on class and trait properties: `readonly` is a property modifier keyword that appears in the property `visibility` list (e.g. `public readonly int x`), independent of position relative to `public`/`protected`/`private` and combining with every property type prefix (builtin, `?type`, `` cast and union). The parser only records the modifier; the typed / no-default / no-static rules are enforced by the compiler ([zephir-lang/zephir#2614](https://github.com/zephir-lang/zephir/issues/2614)).

### Changed
- `readonly` is now a reserved keyword; identifiers named `readonly` are a syntax error.
2.4.0 ### Added
- Support union types on parameters and class/trait properties: a `type | type | ...` prefix (builtin scalars, `null`/`false`, and `` casts) is emitted as an ordered `data-types` member list. Parameters additionally carry `data-type: "variable"`; the single-type and single-cast forms are unchanged. Mirrors the union return-type syntax already accepted after `->` ([zephir-lang/zephir#2613](https://github.com/zephir-lang/zephir/issues/2613)).
2.3.0 ### Added
- Support typed class and trait properties: a property may now carry a builtin type (`public array items`, `private int count`), a class type (`public response`), and an optional nullable marker (`protected ?string name`). The type prefix is emitted on the property node as a `data-type` string or a `` `cast` node, plus a `nullable` flag for `?type`, mirroring how parameters encode their types. Type prefixes combine with existing default values, `{ get, set }` shortcuts, docblocks and all-caps names ([zephir-lang/zephir#2608](https://github.com/zephir-lang/zephir/issues/2608)).
2.2.0 ### Added
- Support the `::class` magic constant: `self::class`, `parent::class`, `static::class` and `ClassName::class` now parse into a `static-constant-access` node whose member value is `class`, which the compiler resolves to the fully-qualified class name ([zephir-lang/zephir#2527](https://github.com/zephir-lang/zephir/issues/2527)).
2.1.0 ### Added
- Add trait support: top-level `trait Name { }` declarations (AST `type: "trait"`) and in-class `use A, B;` statement. ([zephir-lang/php-zephir-parser#195](https://github.com/zephir-lang/php-zephir-parser/issues/195)).

### Changed
- `trait` is now a reserved keyword; identifiers named `trait` are a syntax error.
Show complete changelog