- An alternate approach would be to make arrayElementList contain a class
that is either an ArrayElement or an UnpackExpression (new Node used
only for this).
That would also work for me,
but changing ArrayElement seemed simpler and less likely to cause crashes in
other existing applications.
Add tests of this operator and error handling.
See https://wiki.php.net/rfc/spread_operator_for_array
Speeds up parsing speed by a few percentage points.
- Move skipping prefix out of the loop.
It isn't used except when getting doc comments, which is much less
common than getting all tokens
- Handle strings separately from arrays in token_get_all.
- Move `if` within a switch to its own case.
This is due to limitations of the lexer and token_get_all().
It's possible to manually add compatibility
by joining adjacent `??` and `=` tokens if `??=`
occurs anywhere in the file contents.
- I'm not sure if this project would choose to do that.
Right now, it doesn't have a way to provide the target PHP version.
- T_COALESCE_EQUAL is a new constant; add a substitute for older PHP
versions
Fixes#277
Token->getText() will probably be called frequently in some applications.
This is slightly more efficient; the php interpreter can cache the address of the C implementation when the function is unambiguous.
Add tests of typed properties and tolerating errors in edge cases.
To maintain invariants
(and to avoid creating PropertyDeclaration without a name),
the questionToken and type were added to MissingMemberDeclaration.
Fixes#276
This fixes the most common cases for #19
(there may be other edge cases I haven't considered yet)
This also fixes incorrect precedence for `<=>`.
It has the same precedence as `==` -
https://secure.php.net/manual/en/language.operators.precedence.php
has correct information for the `<=>` operator.
E.g. `unset($x)/2` is a syntax error.
Previously, this parser would not treat that as a syntax error.
This is similar to how `echo` can only be used as a top level statement.
- Tools using this parser may expect `unset` only as a top level statement
See
https://secure.php.net/manual/en/function.unset.php#refsect1-function.unset-notes
The included test files can be executed.
They will always print the inline HTML,
indicating that PHP is doing the equivalent of inserting semicolons.
Fixes#246
Also, ignore temporary files created by vim