Releases: nikic/PHP-Parser
Releases Β· nikic/PHP-Parser
PHP-Parser 5.5.0
Added
- [8.5] Added support for attributes on constants.
Stmt\Const_
now has anattrGroups
subnode. - Added
weakReferences
option toNodeConnectingVisitor
andParentConnectingVisitor
. This will create the parent/next/prev references as WeakReferences, to avoid making the AST cyclic and thus increasing GC pressure.
Changed
- Attributes on parameters are now printed on separate lines if the pretty printer target version is PHP 7.4 or older (which is the default). This allows them to be interpreted as comments, instead of causing a parse error. Specify a target version of PHP 8.0 or newer to restore the previous behavior.
PHP-Parser 5.4.0
Added
- Added
Property::isAbstract()
andProperty::isFinal()
methods. - Added
PropertyHook::isFinal()
method. - Emit an error if property hook is used on declaration with multiple properties.
Fixed
- Make legacy class aliases compatible with classmap-authoritative autoloader.
Param::isPromoted()
andParam::isPublic()
now returns true for parameters that have property hooks but no explicit visibility modifier.PropertyHook::getStmts()
now correctly desugars shortset
hooks.set => $value
will be expanded toset { $this->propertyName = $value; }
. This requires thepropertyName
attribute on the hook to be set, which is now also set by the parser. If the attribute is not set,getStmts()
will throw an error for short set hooks, as it is not possible to produce a correct desugaring.
PHP-Parser 5.3.1
Added
- Added support for declaring functions with name
exit
ordie
, to allow their use in stubs.
PHP-Parser 5.3.0
Added
- Added
indent
option to pretty printer, which can be used to specify the indentation to use (defaulting to four spaces). This also allows using tab indentation.
Fixed
- Resolve names in
PropertyHook
s in theNameResolver
. - Include the trailing semicolon inside
Stmt\GroupUse
nodes, making them consistent withStmt\Use_
nodes. - Fixed indentation sometimes becoming negative in formatting-preserving pretty printer, resulting in
ValueError
s.
PHP-Parser 4.19.4
Fixed
- Remove the
Parser\Php8
class from PHP-Parser 5.x that was mistakenly added. It could cause errors when using something likecomposer preload
.
PHP-Parser 4.19.3
Fixed
- Include the trailing semicolon inside
Stmt\GroupUse
nodes, making them consistent withStmt\Use_
nodes. - Fixed indentation sometimes becoming negative in formatting-preserving pretty printer, resulting in
ValueError
s.
PHP-Parser 4.19.2
Added
- Added support for passing enum values to various builder methods, like
BuilderFactory::val()
.
PHP-Parser 5.2.0
Added
- [8.4] Added support for
__PROPERTY__
magic constant, represented using aNode\Scalar\MagicConst\Property
node. - [8.4] Added support for property hooks, which are represented using a new
hooks
subnode onNode\Stmt\Property
andNode\Param
, which contains an array ofNode\PropertyHook
. - [8.4] Added support for asymmetric visibility modifiers. Property
flags
can now hold the additional bitsModifiers::PUBLIC_SET
,Modifiers::PROTECTED_SET
andModifiers::PRIVATE_SET
. - [8.4] Added support for generalized exit function. For backwards compatibility, exit without argument or a single plain argument continues to use a
Node\Expr\Exit_
node. Otherwise (e.g. if a named argument is used) it will be represented as a plainNode\Expr\FuncCall
. - Added support for passing enum values to various builder methods, like
BuilderFactory::val()
.
Removed
- Removed support for alternative array syntax
$array{0}
from the PHP 8 parser. It is still supported by the PHP 7 parser. This is necessary in order to support property hooks.
PHP-Parser 5.1.0
Added
- [8.4] Added support for dereferencing
new
expressions without parentheses.
Fixed
- Fixed redundant parentheses being added when pretty printing ternary expressions.
Changed
- Made some phpdoc types more precise.
PHP-Parser 4.19.1
Fixed
- Fixed "Optional parameter before required parameter" deprecation warning introduced in previous version.