A PHP parser written in PHP
See UPGRADE-5.0 for detailed migration instructions.
NodeVisitor::REPLACE_WITH_NULL
.newline
option.else if { }
instead of else { if { } }
.leaveNode()
method on visitors is now invoked in reverse order of enterNode()
.NodeTraverser::REMOVE_NODE
etc. to NodeVisitor::REMOVE_NODE
. The old constants are still available for compatibility.Name
subnode parts
has been replaced by name
, which stores the name as a string rather than an array of parts separated by namespace separators. The getParts()
method returns the old representation.Identifier
, Name
or ComplexType
must be passed.Comment::getReformattedText()
now normalizes CRLF newlines to LF newlines.Differ
.See UPGRADE-5.0 for detailed migration instructions.
isPromoted()
, isPublic()
, isProtected()
, isPrivate()
and isReadonly()
methods on Param
.PrettyPrinter
interface.php-parse
binary now accepts -
as the file name, in which case it will read from stdin.clone
, throw
and arrow functions.yield
in parentheses, unless the target version is set to older than PHP 7.0.->
and ::
are now taken into account.\r
at the end of a doc string could be incorrectly merged into a CRLF sequence with a following \n
.__halt_compiler
is no longer recognized as a semi-reserved keyword, in line with PHP behavior.<?=
is no longer recognized as a semi-reserved keyword.\u
escape sequences.Error
constructor taking a line number instead of an attributes array.See UPGRADE-5.0 for detailed migration instructions.
PhpParser\Token
class, which is compatible with PHP 8 token representation (PhpToken
).Expr\List_
nodes, even if it uses []
syntax.Expr
/Stmt
hierarchy. Compatibility shims for the old names have been retained.PhpVersion
class, which is accepted in a number of places (e.g. ParserFactory, Parser, Lexer, PrettyPrinter) and gives more precise control over the PHP version being targeted.Parser::getLexer()
method.Modifiers
class, as a replacement for Stmt\Class_::MODIFIER_*
.REMOVE_NODE
from NodeVisitor::enterNode()
.true
type.readonly
as a function name.__serialize
and __unserialize
to magic method list.Name::slice()
.