Commit Graph

1403 Commits

Author SHA1 Message Date
8a1acbe4e1
Add await support 2021-12-15 14:09:31 +01:00
2f3765f090
play around 2021-12-15 14:09:30 +01:00
f1c87b8ea5
Add custom script 2021-12-15 14:09:30 +01:00
e7ffe0928a
Disable plugins 2021-12-15 14:09:30 +01:00
8e5b179ba7
Update package 2021-12-15 14:09:30 +01:00
bef3682b19
Add conversion script 2021-12-15 14:09:30 +01:00
e472ac72c2
Update tests 2021-12-15 14:09:30 +01:00
79ec0bd1bd
Properly parenthesise arrow functions 2021-12-15 14:09:29 +01:00
c83d2cda80
Fix bug in pretty printer 2021-12-15 14:09:29 +01:00
Ondrej Mirtes
f4b835f7d8 Fix PHPDoc type of namespacedName properties 2021-12-06 21:33:02 +01:00
Nikita Popov
210577fe3c Release PHP-Parser 4.13.2 2021-11-30 20:35:32 +01:00
Nikita Popov
f09f22760e Declare namespacedName property
For historical reasons, this property is used by the NameResolver
(in default mode). Declare it explicitly, rather than using a doc
comment.
2021-11-27 21:02:58 +01:00
Nikita Popov
d4cb98ae38 Fix typo in property name
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.
2021-11-27 20:57:41 +01:00
Nikita Popov
68d2a52b42 Avoid creation of dynamic property in test
This test requires a property that is not a subnode -- but it does
not need to be dynamic, a declared property works just as well.
2021-11-27 20:53:55 +01:00
Nikita Popov
63f8699143 Add CallLike test for NullsafeMethodCall 2021-11-14 17:44:47 +01:00
Nikita Popov
4122ff3a91 Make NullsafeMethodCall extend from CallLike 2021-11-14 17:43:29 +01:00
Hassan Tariq
6f1f206862 Fix minor typo 2021-11-13 22:39:16 +01:00
Jaroslav Hanslík
99a24b6a55 Added builders for enum and enum case 2021-11-05 22:26:04 +01:00
Nikita Popov
63a79e8daa Release PHP-Parser 4.13.1 2021-11-03 21:52:16 +01:00
Ilhan Yumer
6a21234e58 Code highlighting 2021-10-31 09:11:00 +01:00
Nikita Popov
7064539974 Rename identifier/identifier_ex productions
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.
2021-10-17 20:26:06 +02:00
Nikita Popov
4bfc4595ed Support reserved keywords as enum cases
Fixes #807.
2021-10-17 20:20:35 +02:00
Jaroslav Hanslík
54f19a0a66 Fixed array value evaluation with unpacked array 2021-10-11 21:35:21 +02:00
Jaroslav Hanslík
8da6d7ac62 Fixed ArrowFunction::$expr 2021-10-09 11:26:27 +02:00
Sam Reed
f6e1fbf3a2 Update .gitattributes 2021-10-08 21:23:55 +02:00
Nikita Popov
50953a2691 Release PHP-Parser 4.13.0 2021-09-20 14:20:58 +02:00
Jaroslav Hanslík
0a20979a62 Unified builder methods for setting types 2021-09-14 18:09:07 +02:00
Nikita Popov
a45fb2a621 Add CallLike parent class
This provides a helper to determine whether a call is a first-class
callable, and a way to strip the args type to Arg[] if it isn't.
2021-09-12 22:29:08 +02:00
Nikita Popov
08501991d4 Don't make VariadicPlaceholder an expression
And don't store it in an Arg.
2021-09-12 21:59:26 +02:00
Nikita Popov
b5234eacd0 Tweak coding style 2021-09-12 21:54:03 +02:00
Shalvah
632ead3a82
Print comma before comments for new array item (#805)
Print comma before rather than after comments. Also switch to multiline mode if inserting an item with comments.

Fixes #804.
2021-09-12 21:51:25 +02:00
Nikita Popov
13549aa794 Add support for first-class callables
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?
2021-09-03 17:18:40 +02:00
Nikita Popov
d2c645f163 Adjust token count in octal emulator 2021-09-03 16:35:10 +02:00
Nikita Popov
def24f2224 Add support for explicit octal literals 2021-09-03 16:29:30 +02:00
Nikita Popov
cfeb195205 Add test for new in initializer
This already works because we don't validate initializer contents,
everything is accepted from a parser perspective.
2021-09-03 15:10:29 +02:00
Nikita Popov
ace6c67a8a Add support for intersection types 2021-09-03 15:06:33 +02:00
Nikita Popov
0483391aca Introduce ComplexType base class
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.
2021-09-02 18:35:05 +02:00
Nikita Popov
9aebf377fc Allow multiple modifiers for property promotion
Fixes issue #800.
2021-08-08 19:12:44 +02:00
simivar
5a43015499 Simplify BuilderHelpers::normalizeName() implementation
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
2021-07-21 12:51:18 +02:00
Nikita Popov
6608f01670 Release PHP-Parser 4.12.0 2021-07-21 12:44:31 +02:00
Máté Kocsis
55c4269232
Add support for new PHP 8.1 modifiers (#796)
Implement support for readonly properties (https://wiki.php.net/rfc/readonly_properties_v2) and
final class contstants (https://wiki.php.net/rfc/final_class_const).
2021-07-21 12:43:29 +02:00
Nikita Popov
c4304c76bd Try to pass --ignore-platform-req=php on 8.1 only 2021-07-21 12:11:59 +02:00
Nikita Popov
b099e8fc76 Pass --ignore-platform-req=php 2021-07-21 12:08:11 +02:00
Nikita Popov
acf16edc8e Add PHP 8.1 to GH actions 2021-07-21 11:58:38 +02:00
Nikita Popov
a8b5ed4306 Fix JSON encoding test on PHP 8.1
Duplicate the test expectation for a different order.
2021-07-21 11:49:28 +02:00
Nikita Popov
c758510a37 Add support for PHP 8.1
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.
2021-07-09 16:52:58 +02:00
Nikita Popov
feed91cf0f Avoid ctype_alnum() on integer
This is deprecated in PHP 8.1
2021-07-09 15:46:50 +02:00
Nikita Popov
fe14cf3672 Release PHP-Parser 4.11.0 2021-07-03 15:36:55 +02:00
Bob Weinand
3fb73520c1 Add handling for Enum(Case)s in NameResolver 2021-07-03 15:09:11 +02:00
simivar
c35cc4b2cb Add support for "never" type in the BuilderHelpers::normalizeType() 2021-06-18 17:25:28 +02:00