1
0
mirror of https://github.com/danog/PHP-Parser.git synced 2024-12-12 01:19:47 +01:00
Commit Graph

1237 Commits

Author SHA1 Message Date
Nikita Popov
a167aa2061 Optimize attribue checks in the lexer 2019-05-12 15:26:26 +02:00
Nikita Popov
993f29906b Avoid parent constructor call during node construction
Instead explicitly assign the attributes. This is a minor
performance improvement.
2019-05-12 14:55:21 +02:00
Nikita Popov
9d44edf85d Recover from error inside alternative array deref syntax
This is to improve error recovery for cases like #545.
2019-05-12 11:38:15 +02:00
Nikita Popov
aa97a9bb69 Add changelog entries 2019-05-11 23:08:31 +02:00
Nikita Popov
aa72c5d674 FPPP: Support inserting into empty lists 2019-05-11 22:49:32 +02:00
Nikita Popov
60d025a914 Fix attributes for zero-length nop nodes
Previously zero-length nop nodes used the lookahead start attributes
and current end attributes. This choice ends up being somewhat weird,
because the end attributes will be the at the last non-whitespace,
non-comment token, which might be quite far back. More problematically,
we may not have encountered any non-discarded token if we're at the
start of the file, in which case we will have no end attributes to
assign.

Change things to use a canonical "zero-length" node representation,
where the end position (token & file) will be exactly one before the
start position.

Fixes #589.
2019-05-11 20:01:25 +02:00
Nikita Popov
b2cecec6bc Remove bogus exprStmt mode test
We're always generating expression statements nowadays, this flag
hasn't existed for a long while now...
2019-05-11 18:51:37 +02:00
Tomas Votruba
8012faea54 [PHP 7.4] Add array spread 2019-05-09 19:15:35 +02:00
Tomáš Votruba
f3b19c19ef [PHP 7.4] Add support for arrow functions (#602)
Per RFC https://wiki.php.net/rfc/arrow_functions_v2.
2019-05-09 14:17:28 +02:00
Andrea Cardaci
78d9985d11 Print messages to stderr in bin/php-parse and fix exit status
Close #605.
2019-04-28 22:06:06 +02:00
Nikita Popov
57b8673ea7 Use --ignore-platform-reqs on Travis
Allows testing on nightly, which is PHP 8.
2019-02-16 21:58:22 +01:00
Nikita Popov
5221f49a60 Release PHP-Parser 4.2.1 2019-02-16 21:54:15 +01:00
Nikita Popov
ae4e90d558 Add PHP 7.4 to Travis matrix 2019-02-16 21:52:44 +01:00
Tomas Votruba
9de96821f7 Add support for ??= operator
Introduced in PHP 5.4, represented using an AssignOp\Coalesce node.
2019-02-09 11:16:26 +01:00
Lars Moelleken
b7e6361536 updates via "rectorphp/rector" (#573)
- "global" -> remove unused "use" statements
- "phpunit" -> fix "@covers" comments
- "phpunit" -> replace "->will($this->returnValue()" with "->willReturn()"
- "UseTest.php" -> add missing namespace
- "composer.json" -> use "autoload-dev"
- remove -> "require_once" usage in the tests (use autoload-dev via composer.json)

-> most of the changes are done automatically by "https://github.com/rectorphp/rector"
2019-01-19 11:18:00 +01:00
Nikita Popov
594bcae1fc Release PHP-Parser 4.2.0 2019-01-12 17:31:37 +01:00
Nikita Popov
d5180f0d95 Change test to use correct node type
Class name is an Identifier, not a Name.
2019-01-12 17:31:37 +01:00
Nikita Popov
1f95f9215c Tweak type annotation to include null 2019-01-12 17:31:37 +01:00
Nikita Popov
6b9dd7afe7 Avoid redundant argument 2019-01-12 17:31:37 +01:00
Andreas Möller
ba092652fe Enhancement: Reference phpunit.xsd as installed with composer 2019-01-09 21:50:03 +01:00
Andreas Möller
ec0d834c5f Enhancement: Normalize composer.json 2019-01-09 21:49:38 +01:00
Nikita Popov
ea3657fc5f Bump version to 4.2.0-dev 2019-01-05 21:34:53 +01:00
Tomas Votruba
af8c729603 Add PHP 7.4 typed properties support 2019-01-05 21:34:25 +01:00
Tomas Votruba
0ef61b49bb add float/double/real KIND support to Cast\Double node 2019-01-05 19:23:00 +01:00
Nikita Popov
90ee36a7fc Actually remove assertion... 2018-12-26 14:19:18 +01:00
Nikita Popov
8aae5b59b8 Release PHP-Parser 4.1.1 2018-12-26 12:32:39 +01:00
Nikita Popov
49d73e829f Remove anon class null name assertion
Fixes #554.
2018-12-26 12:23:42 +01:00
Gabriel Caruso
80ead71da2 Use Ubuntu 16.04 2018-12-26 11:37:14 +01:00
Niko
294b93fbca Another Typo 2018-12-24 17:28:52 +01:00
Niko
bc3ac5e5ea Fixed typo 2018-12-24 16:23:47 +01:00
Andrey Bolonin
382ca0128f add php 7.3 to travis 2018-12-08 16:37:28 +01:00
Nikita Popov
f42bbc2403 Avoid default action for error production
error is not necessarily going to have a semantic value, make sure
that the default action $$=$1 is not used.

Fixes #551.
2018-11-30 11:00:48 +01:00
Cosmin Radoi
ebf6b1c33b Fix NodeDecoder => JsonDecoder in docs (#552) 2018-11-29 23:12:33 +01:00
Tomas Votruba
a74b54ce8b [cs] remove unused @var name 2018-11-20 20:31:31 +01:00
Romain Canon
8e4f972036 Fix wrong method call in doc 2018-11-07 17:34:08 +01:00
Nikita Popov
3d0f7843d4 Support error recovery for missing return type
The return type is set to "null" in this case.

Fixes #544.
2018-10-25 16:56:50 +02:00
Phil Davis
69068722b7 Fix typo of DONT_TRAVERSE_CURRENT_AND_CHILDREN 2018-10-11 10:16:31 +02:00
Maks Rafalko
fb3d89e463 Document new DONT_TRAVERSER_CURRENT_AND_CHILDREN constant (#540)
* Document new `DONT_TRAVERSER_CURRENT_AND_CHILDREN` constant

* Rewording sentences, added 1 space indentation to make bullet list correct
2018-10-10 21:56:48 +02:00
Nikita Popov
d0230c5c77 Release PHP-Parser 4.1.0 2018-10-10 11:24:14 +02:00
Maks Rafalko
dc323458b4 Add new constant to be returned from enterNode() to not traverse current and child nodes (#536)
* Add new constant to be returned from enterNode() to not travers current node for subsequent visitors and skip children traversing

* Allow visitors to replace nodes in leaveNode() when DONT_TRAVERSE_CURRENT_AND_CHILDREN is used
2018-10-08 22:26:00 +02:00
Matthew Brown
674c5610fb StaticCall::$name cannot be a string 2018-10-04 21:29:57 +02:00
Nikita Popov
4fb48c0e18 Mark PHP 7.3 as supported
Also bump version to PHP-Parser 4.1.
2018-09-22 10:54:21 +02:00
Tomáš Votruba
d638dd9b25 Use methods instead of annotations for expected exceptions (#533) 2018-09-22 10:43:54 +02:00
Nikita Popov
c5316487a4 Update test_old Symfony runner 2018-09-22 10:41:58 +02:00
Nikita Popov
eebaa94647 Flexible doc strings: Fix some issues, add more tests 2018-09-22 10:09:00 +02:00
Nikita Popov
0ed9065b4c Flexible doc: Validate and strip indentation
If indentation is invalid, we strip on a best-effort basis.

The error position information is not great, but I don't want to
introduce sub-token error positioning at this point in time.
2018-09-21 21:47:01 +02:00
Nikita Popov
5f73c4de80 Flexible doc: Validate end label indentation
Move doc string parsing logic from rebuildParsers.php and
String_::parseDocString() into ParserAbstract. This stuff is
going to get complicated now.

For now only implement the validation of the indentation on the
end label.
2018-09-21 16:31:17 +02:00
Nikita Popov
146411bb86 Ignore one more test...
This one is passing on Windows because the extra \r makes the
opening tag actually valid. Fails on Linux though.
2018-09-21 12:41:10 +02:00
Nikita Popov
e12891a9db Ignore failures in complex flexible doc string tests
These test nesting of flexible heredoc strings. This is too hard for
us to emulate and we do not expect to see these patterns used in the
wild.
2018-09-21 12:35:11 +02:00
Nikita Popov
a5c726bfbf Make sure heredoc end label not followed by label char 2018-09-21 11:44:39 +02:00