Nikita Popov
39b046007d
Refactor token emulator registration
...
Only determine needed emulators based on PHP version once, and
add an adaptor that allows treating forward and reverse emulation
the same.
Previously the isEmulationNeeded() check was too conservative,
as it also considered emulators that are not relevant for the
version. Though possibly that check should just be dropped
altogether.
2020-09-06 15:50:52 +02:00
Nikita Popov
e3872b8906
Improve compatibility with other libs defining compat tokens
2020-09-06 15:00:28 +02:00
Ondřej Mirtes
4a40a84cf6
Fixed PHPDoc typo
2020-09-02 12:33:46 +02:00
Nikita Popov
88e519766f
Release PHP-Parser 4.9.1
2020-08-30 18:15:20 +02:00
Nikita Popov
35306de32f
Support visibility modifiers in namespaced names
...
Fixes #704 .
2020-08-29 16:35:31 +02:00
Nikita Popov
ad365b1beb
FPPP: Fix code block detection during removal
...
Instead of checking whether there is a {/} before/after the removed
note, check whether {/} occurs in the between-node range. Dropping
that is what we're really concerned about here.
2020-08-29 16:28:28 +02:00
Nikita Popov
4bc82432de
Only special-case brace handling for statement lists
...
Don't interpret the } before a catch clause as a block statement
and trigger a pretty printing fallback.
2020-08-23 20:57:00 +02:00
Ondrej Mirtes
fd6052e37d
FPPP failing tests
2020-08-23 20:54:01 +02:00
Nikita Popov
bd722809f7
FPPP: Support removing nodes from start of list
2020-08-23 17:35:37 +02:00
Viktor Szépe
56356e4aec
Remove repeated word from PHPDoc in Name
2020-08-23 08:59:38 +02:00
Nikita Popov
aaee038b91
Release PHP-Parser 4.9.0
2020-08-18 21:48:01 +02:00
Nikita Popov
f9d35fe11e
Fix casing of class name
2020-08-10 11:21:16 +02:00
Nikita Popov
8bcaa4261e
Add parens for new/instanceof with complex expression
...
This is not fully accurate because the rules for "new variables"
are different than the rules for dereferenceable LHS.
2020-08-09 22:07:33 +02:00
Nikita Popov
feb6bf7a0c
Wrap class const LHS in parens if necessary
...
This looks like a very old bug in the pretty printer that showed
up in PHP 8 tests.
2020-08-09 21:41:30 +02:00
Nikita Popov
0cee2088ea
Remove self/parent/static restriction for namespace names
...
This no longer applies as of PHP 8.0.
2020-08-09 21:21:22 +02:00
Nikita Popov
78e08fc178
Allow keywords in namespace declaration
2020-08-09 21:19:59 +02:00
Nikita Popov
3aadc15e2e
Support keywords in namespaced names
2020-08-09 21:11:49 +02:00
Nikita Popov
a98350581c
Add support for throw expression
2020-08-09 20:52:55 +02:00
Nikita Popov
7f398769a0
Add support for static return type
2020-08-09 18:52:32 +02:00
Nikita Popov
98f7f39d1c
Add named argument support
...
Not adding any explicit FPPP support, as I don't think add/remove
of names can be handled any better than full reformatting.
2020-08-09 17:37:44 +02:00
Nikita Popov
722119502f
Fine grained version choice for test_old
2020-08-09 16:54:13 +02:00
Graham Campbell
544aee1671
Fix up tests
2020-08-09 16:54:09 +02:00
Nikita Popov
8c58eb4cd4
Release PHP-Parser 4.8.0
2020-08-09 12:23:20 +02:00
Nikita Popov
23d9c17770
Add support for nullsafe operator
2020-08-09 12:08:05 +02:00
Nikita Popov
31be7b4ed9
Update php-yacc, remove unused tokens
2020-08-08 19:22:28 +02:00
Nikita Popov
f6bf041583
Remove last uses of MockBuilder
2020-08-08 11:58:00 +02:00
Nikita Popov
1bf073a76c
Avoid most MockBuilder uses in NodeVisitor testing
...
This removes all the warnings about at() usage ... even though
it is still used. Apparently warnings don't get emitted if the
at() usage is inside a data provider?
2020-08-08 11:49:05 +02:00
Nikita Popov
1721ae155c
Avoid one use of MockBuilder
...
We can just use anon classes here and avoid PHPUnits unreliable
MockBuilder.
2020-08-08 11:49:05 +02:00
Alex
54fc023b25
Update Array_ annotations, items are nullable ( #696 )
...
When used to destructure, items are optional. E.g. `[$a, , $b] = [1, 2, 3];`.
2020-08-08 10:04:21 +02:00
Nikita Popov
f845568e1d
Remove an unnecessary use of at()
2020-08-07 10:19:39 +02:00
Nikita Popov
b4ca4ce0fe
Allow PHPUnit 9
2020-08-07 10:16:19 +02:00
Nikita Popov
303342630d
Fix a token reference
2020-08-01 22:36:49 +02:00
Nikita Popov
1a1300aa2a
Add reverse emulation support
2020-08-01 22:34:36 +02:00
Nikita Popov
3698f4b727
Add common KeywordEmulator
...
The logic for keyword emulation is always going to be the same.
2020-08-01 22:02:52 +02:00
Nikita Popov
7b2ec6703f
Accept a phpVersion option in emulative lexer
...
Testing this will require reverse emulation support.
2020-08-01 21:56:06 +02:00
Nikita Popov
61328f89da
Separate out emulator version info
2020-08-01 21:49:53 +02:00
Nikita Popov
21dce06dfb
Release PHP-Parser 4.7.0
2020-07-25 15:18:53 +02:00
Nikita Popov
acaf3fecad
Implement emulation of PHP 8 T_NAME_* tokens
...
Like comment emulation, this is unconditional, as it is required
for core functionality.
2020-07-23 12:28:13 +02:00
Nikita Popov
a63b495fe6
Migrate grammar to use PHP 8 T_NAME_* tokens
...
This will break everything on PHP < 8.
2020-07-23 12:01:50 +02:00
Nikita Popov
2d1998938c
[PHP 8.0] Support trailing comma in closure use list
...
RFC: https://wiki.php.net/rfc/trailing_comma_in_closure_use_list
2020-07-22 18:43:55 +02:00
Nikita Popov
739b4b4c60
Fix handling of unterminated comment with trailing newline
...
Fixes #688 .
2020-07-22 18:35:55 +02:00
Nikita Popov
17f478107a
Fix file name
2020-07-22 18:30:00 +02:00
Graham Campbell
cd7c058e76
Added missing entry to change log and correct next version indicator ( #685 )
...
* Added missing entry to change log and correct next version indicator
* Update composer.json
2020-07-19 18:36:23 +02:00
Mikaël Mayer
d8b19d7963
Fixed rebuildParsers.php ( #686 )
...
phpyacc is a sh file and should not be run via the php interpreter, but directly.
2020-07-16 21:51:43 +02:00
Tomas Votruba
69c5d48afd
[PHP 8.0] Add match expressions ( #672 )
...
RFC: https://wiki.php.net/rfc/match_expression_v2
Upstream implementation: php/php-src#5371
Closes #671 .
2020-07-15 21:40:05 +02:00
Graham Campbell
6ec527bce7
Corrected license text
2020-07-13 22:32:20 +02:00
Graham Campbell
fc25609ecb
Fixed branch alias
2020-07-13 21:19:31 +02:00
Sebastian Bergmann
f545f18a87
Add ParentConnectingVisitor and NodeConnectingVisitor ( #681 )
2020-07-11 11:31:43 +02:00
Nikita Popov
c346bbfafe
Release PHP-Parser 4.6.0
2020-07-02 19:12:47 +02:00
Nikita Popov
4abc531213
Canonicalize to PHP 8 comment token format
...
The trailing newline is no longer part of the comment token.
2020-06-27 18:53:09 +02:00