1
0
mirror of https://github.com/danog/PHP-Parser.git synced 2024-11-26 20:04:48 +01:00
Commit Graph

1334 Commits

Author SHA1 Message Date
f00092bfee
Update tests 2021-01-09 18:38:34 +01:00
a9282514c8
Properly parenthesise arrow functions 2021-01-09 18:36:41 +01:00
9407d9a4b9
Fix bug in pretty printer 2021-01-08 21:41:39 +01:00
Tomas Votruba
46221a0914 Update Use_ builder to return specific type 2021-01-06 14:30:19 +01:00
Tomas Votruba
3b87eb721c make Namespace_ builder return Namespace_
Hi, just a little detail. This should fix invalid return type of docs
2020-12-30 10:13:54 +01:00
Ayesh Karunaratne
e3471d94d3 Update .gitattributes export-ignore rules
- Adds `.github` directory to `.gitattributes` file with an `export-ignore` rule.
 - This also aligns all `export-ignore` rules for more readability.
 - Removes `.travis.yml` file that is no longer used.
2020-12-22 22:58:39 +01:00
Nikita Popov
c6d052fc58 Release PHP-Parser 4.10.4 2020-12-20 11:01:03 +01:00
Nikita Popov
8008d07bef Remove Travis build badge
We no longer use Travis, so this isn't meaningful... And GitHub
already displays the build status, so there's no value in having
this kind of badge at all.
2020-12-20 10:58:16 +01:00
Nikita Popov
7284a4d019 Remove no longer necessary class parsing workaround
This was split to work around the attribute assignment bug fixed
in the previous commit, and as such is no longer necessary.
2020-12-20 10:53:45 +01:00
Nikita Popov
d3d1ee470a Fix #738 incorrect start line for traits
Empty productions are supposed to be assigned the start attributes
of the lookahead token. Currently, this happens by assigning above
the current stack position when the token it read.

This fails in a situation where we first reduce an empty production
higher up in the stack, and then again reduce an empty production
lower in the stack, without consuming the lookahead token in the
meantime.

Fix this by moving the assignment into the reduction phase. We
also need to do this for error productions, which are effectively
empty.
2020-12-20 10:52:47 +01:00
Nikita Popov
893a5bce3f Fix #741 incorrect varvar positions 2020-12-19 22:03:43 +01:00
Nikita Popov
bec74aceda Remove .travis.yml 2020-12-08 23:22:57 +01:00
Nikita Popov
7c09e096c9 Try to re-enable coveralls 2020-12-08 23:17:41 +01:00
Nikita Popov
0f64504317 Drop -n flag from test_old
In the hope of fixing the failure on GH actions.
2020-12-08 23:05:19 +01:00
Matt Glaman
5e36ef732e
Add GitHub Actions workflow (#740) 2020-12-08 23:00:10 +01:00
Nikita Popov
dbe56d23de Release PHP-Parser 4.10.3 2020-12-03 18:45:45 +01:00
Tommy Quissens
c64986fa55
Allow both '{' and T_CURLY_OPEN as curly bracket (#732) 2020-12-03 18:42:00 +01:00
Stefano Arlandini
bc7a9bf9c2 Remove useless code left from old implementation 2020-12-02 12:54:15 +01:00
James Titcumb
2816485126 Updated README to indicate that parsing PHP 8.0 code is supported 2020-12-01 15:15:26 +01:00
Anders Jürisoo
1d1bc8a364 Upgrade some PrettyPrinter methods to protected
I noticed some methods in the Standard PrettyPrinter is private, can they be upgraded to `protected` to ease when extending it?
2020-10-17 22:04:40 +02:00
Nikita Popov
d520bc9e1d Don't allow failures on PHP 8.0 integration tests
These are passing now.
2020-09-30 21:15:05 +02:00
Nikita Popov
51e0b30843 Test against 8.0.0rc1
This should fix the remaining test failures.
2020-09-30 20:51:01 +02:00
Nikita Popov
eff72eeffa Fix #718: PrettyPrinter breaks nested ternaries
Mark ternary as non-associative operator, as left-associative use
is deprecated in PHP 7.4 and removed in PHP 8.0.
2020-09-30 20:42:58 +02:00
Nikita Popov
658f1be311 Release PHP-Parser 4.10.2 2020-09-26 12:30:38 +02:00
Nikita Popov
b9b65a2996 Fix check for token emulation conflicts 2020-09-26 12:29:16 +02:00
Nikita Popov
1b479e7592 Release PHP-Parser 4.10.1 2020-09-23 20:23:49 +02:00
Nikita Popov
b5351f883a Make keyword emulation check case-insensitive 2020-09-23 20:19:40 +02:00
Nikita Popov
88be6127fa FPPP: Fix remove + add at start of list 2020-09-22 22:41:02 +02:00
Nikita Popov
8a97fa157f Recover from missing semicolon after property or class const
Fixes #712.
2020-09-19 23:11:36 +02:00
Nikita Popov
1c13d05035 Release PHP-Parser 4.10.0 2020-09-19 16:52:48 +02:00
Nikita Popov
c7dc3ce552 Add basic FPPP support for attributes 2020-09-19 16:43:45 +02:00
Nikita Popov
9f6ad686a7 Adjust skip list for moved test
The two remaining test_old failures are due to a bug on the PHP
side.
2020-09-19 15:55:07 +02:00
Nikita Popov
1899471f80 Update test for PHP 8 error behavior
Replace division by zero with a different error condition that
still warns, and adjust the expected message based on PHP version.
2020-09-19 15:52:05 +02:00
Nikita Popov
8505acd151 Correctly handle ?-> in encapsed strings
Followup upstream change.
2020-09-19 15:47:14 +02:00
Nikita Popov
c3e20d9970 Use 8.0.0beta4 to tests against 2020-09-19 15:27:27 +02:00
Tomas Votruba
4c22c62783
[PHP 8.0] Add attributes support (#661)
Adds support for PHP 8 attributes, represented using `AttrGroup` nodes
containing `Attribute` nodes. The `attrGroup` subnode is added to all
nodes that can have attributes.

This is still missing FPPP support.

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2020-09-13 21:01:17 +02:00
Nikita Popov
f66a32e2df Emulate PHP 8 attribute syntax
Perform emulation by replacing #[ with %[, then patching % back
to # and coalescing #[ into T_ATTRIBUTE if it is a freestanding
token.
2020-09-06 17:42:38 +02:00
Nikita Popov
75abbbd2d4 Handle flexible heredoc via TokenEmulator
Extend the interface to support preprocessing.
2020-09-06 17:05:23 +02:00
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