This test was working on a dynamic "subNode" property, rather
than an actual subnode (either subNode1 or subNode2).
This test is generally not very valuable, I think it dates back
to a time where __get()/__set() were used.
The names were easy to get wrong, because the corresponding names
in zend_language_parser.y are T_STRING/identifier, so just copying
identifier from upstream gives the wrong behavior.
I'm somewhat unsure about the AST structure here.
VariadicPlaceholder is not a general expression. Maybe Arg->expr
should be Expr|VariadicPlaceholder? Or possibly the call arguments
should be an array of Arg|VariadicPlaceholder?
With the upcoming addition of intersection types, a type can
be Identifier|Name|NullableType|UnionType|IntersectionType, which
is quite the mouthful. Give NullableType and UnionType a common
base class ComplexType, which does not have any behavior, but
allows to write these types (and check them in instanceof) more
easily.
In order to get rid of the flag in `BuilderHelpers::normalizeNameCommon()` I have moved all the logic related to the normalization of the name to the `BuilderHelpers::normalizeName()` method and expr-related stuff to the `BuilderHelpers::normalizeNameOrExpr()` method which later calls the basic `normalizeName()` as well
With the introduction of intersection types, PHP now lexes the
token '&' either as T_AMPERSAND_(NOT_)FOLLOWED_BY_VAR_OR_VARARG.
This completely breaks parsing of any code containing '&'.
Fix this by canonicalizing to the new token format (unconditionally,
independent of emulation) and adjusting the parser to use the two
new tokens.
This doesn't add actual support for intersection types yet.
Adds addAttribute() method to Builders of all nodes supporting attributes with BuilderHelpers::normalizeAttribute() usage inside so we can pass both Node\Attribute and Node\AttributeGroup instances.