1425 Commits

Author SHA1 Message Date
Nikita Popov
6bb5176bc4 Release PHP-Parser 4.15.4 v4.15.4 2023-03-05 20:49:14 +01:00
Nikita Popov
cad49f8ed3 Fix formatting preservation for alternative elseif/else syntax
Test taken from PR #797.

(cherry picked from commit 9b46dffb12c6c83d33b993ae81b9a2895293dee8)
2023-03-05 20:44:50 +01:00
Nikita Popov
570e980a20 Release PHP-Parser 4.15.3 v4.15.3 2023-01-16 23:05:37 +01:00
Nikita Popov
a50b4310f7 Test PHP 8.2 in CI 2023-01-16 22:27:18 +01:00
Nikita Popov
8863f92b58 Support readonly before DNF type
This makes us match the PHP 8.2 handling of readonly. Handling of
"readonly" functions is moved to the parser to allow distinguishing
them from readonly properties with DNF types. We have to uglify the
grammar to avoid some shift/reduce conflicts. Thank you WordPress.

(cherry-picked from 0dd85ebd34d7463d53ec92035105b04799a687e1)
2023-01-16 22:19:17 +01:00
Nikita Popov
3182d12b55 Fix attrGroups/attributes confusion in EnumCase builder
Found by staabm in #907.

(cherry picked from commit 21a3e8cac52b1d3d0ea0e91c34d112cf53716732)
2022-12-14 21:51:15 +01:00
AlessandroMinoccheri
1df465cd90 added type int to argument of addAlias function 2022-11-13 16:33:17 +01:00
Nikita Popov
f59bbe44bf Release PHP-Parser 4.15.2 v4.15.2 2022-11-12 16:38:23 +01:00
Nikita Popov
2e11deec46 Bail out on PHP tags in removed code
If dropping a node would drop PHP tags, bail out of formatting
preservation. This will lose formatting, but at least produce
legal code.

Closes GH-884.

(cherry picked from commit b0edd4c41111042d43bb45c6c657b2e0db367d9e)
2022-11-12 16:33:34 +01:00
Nikita Popov
a4fe65bf60 Add more tests for formatting preservation with InlineHTML
It's all broken...

(cherry picked from commit bad10e16181422f8d50409e5d0b5baab41231279)
2022-11-12 16:33:21 +01:00
Nikita Popov
e072fd2c30 Adjust tests to work on 32-bit
Fixes #662.

(cherry picked from commit 950bf8f1d1865cfd0d248e13a3455db0be1d870c)
2022-11-12 16:24:01 +01:00
Nikita Popov
7027899d7f Fix parsing of large hex floats containing "e"
These ended up taking the code path for normal floats and being
cast to zero.

(cherry picked from commit 4ce978126044b868ecfc350c065f6d1703f60db5)
2022-11-12 16:24:01 +01:00
Jaroslav Hanslík
2f1fd784fe Fixed type in UnionType 2022-09-10 22:41:13 +02:00
Nikita Popov
0ef6c55a3f Release PHP-Parser 4.15.1 v4.15.1 2022-09-04 09:30:47 +02:00
Nikita Popov
8216e878be Fix empty list insertion of multiple attributes
(cherry picked from commit 44c6a97705a5611c6c2f3b4f20105bcb1aab666b)
2022-09-04 09:29:05 +02:00
Nikita Popov
617d0220b9 Release PHP-Parser 4.15.0 v4.15.0 2022-09-03 21:54:32 +02:00
George Peter Banyard
a951e9e24d Add support for DNF types (#862)
(cherry picked from commit 9b2a01aa0cd0f97cd2d10ec5e17a1bf8b3fe142a)
2022-09-03 21:50:20 +02:00
Nikita Popov
b30e7e73d5 Support empty list insertion for attributes
(cherry picked from commit a2608f0b742b711d24de914d41c0162e37494ea6)
2022-09-03 21:48:21 +02:00
Nikita Popov
ff24d1d61a Fix length bounds check in Name::slice()
The length check did not take into account that there may be a
non-zero offset at this point.

Fixes #875.

(cherry picked from commit 53b907d40533c27535a0cf60cc9c38305700ff0e)
2022-09-03 21:47:28 +02:00
Anton
e55f8c6b30 Add __serialize/__unserialize to ClassMethod::$magicNames
(cherry picked from commit a3f2bb634d7d675e7036d06e3e18aa2c606559b6)
2022-09-03 21:46:15 +02:00
Nikita Popov
3ee592b6aa Handle true/false/null types in builder APIs
(cherry picked from commit 71ed641cd49ee9df3ee29405c0d25fcc2e15b47e)
2022-09-03 21:45:46 +02:00
Nikita Popov
3fe2422e34 Add support for true type
The null/false types were alread accepted previously, even though
they are only legal as standalone types since PHP 8.2.

Non-trivial backport from 1eba33d4124a248dd5c970fa7d6064d2e31b8635.
2022-09-03 21:36:40 +02:00
Nikita Popov
2d589921f2 Fix incorrect doc type 2022-06-04 12:44:36 +02:00
Nikita Popov
cdb731fa8b Update integration test target to 8.1 2022-05-31 23:18:52 +02:00
Nikita Popov
e727475d08 Support readonly as function name
This special case was added after the PHP 8.1 release.
2022-05-31 23:18:52 +02:00
Nikita Popov
34bea19b6e Release PHP-Parser 4.14.0 v4.14.0 2022-05-31 22:59:12 +02:00
Tomas Votruba
678ccbe072
[PHP 8.2] Add readonly class support (#834)
RFC: https://wiki.php.net/rfc/readonly_classes

PHP implementation: php/php-src#7305
2022-05-15 23:19:31 +02:00
Tomas Votruba
5d83adcc0e
[String_] Add rawValue attribute (#831) 2022-05-15 23:04:59 +02:00
Tomas Votruba
3bf0082455
[DNumber] Add rawValue attribute to hold the original value (#833) 2022-05-15 18:12:28 +02:00
Tomas Votruba
d3eb10aca1
[LNumber] Add rawValue attribute to LNumber to allow numeric separator etc. (#832) 2022-05-15 18:09:05 +02:00
Marijn van Wezel
a6e34665fd Reflect support for PHP 8.1 in the README 2022-01-03 21:20:19 +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 v4.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 v4.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 v4.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