For types the use of a string is ambiguous -- it could be either
an Identifier or a Name. Don't guess.
Retain the implicit promotion to Identifier in places where only
Identifier is legal, e.g. various symbol names.
By making flags on the Param builder configurable by providing make(Public|Protected|Private) methods we can promote parameters to properties from the constructor
Doc strings have a trailing \n and these will get interpreted as
\r\n and removed from the string contents.
For nowdoc, fall back to single quote if there's a trailing \r.
For heredoc, escape all isolated \r -- unlike \n and \r\n this is
really a special character, because this is no longer relevant as
an actual newline character.
When detecting whether the string contains the end label, allow
leading whitespace in front of it. This is legal since the
introduction of flexible doc strings.
With the introduction of flexible doc strings, the ending label
is no longer required to be followed by a semicolon or newline.
We need to prevent doc string printing if the label is followed
by any non-label character.
This makes pretty printing round trip to another Float literal,
rather than a constant lookup. The 1e1000 form in particular is
chosen because that seems to be the typical form used in various
tests.
This makes us match the PHP 8.2 handling of readonly. Handling of
"readonly" functions is moved to the parser to allow distinguishing
them from readonly properties with DNF types. We have to uglify the
grammar to avoid some shift/reduce conflicts. Thank you WordPress.
This uses the same semantics as arrays from leaveNode(), i.e. the
returned nodes will not be visited by other visitors. This is open
to change though (but probably should change for both enterNode()
and leaveNode() if it does change?)
In the past, single-line comments were stored together with the
trailing newline. Later we switched to the PHP8 comment
representation, where the trailing newline is not part of the
comment anymore. As such, there is also no need to trim here.
This is split out from GH-867.
This is currently just used to initialize the default for short
array syntax.
The default target version in 7.0, which also means that the
default for short arrays is flipped to on.