1713 Commits

Author SHA1 Message Date
Nikita Popov
aedfcc23cd Include trailing semicolon in GroupUse
Fixes https://github.com/nikic/PHP-Parser/issues/1026.
2024-09-21 15:55:21 +02:00
Nikita Popov
8d09ba87f4 Support PropertyHooks in NameResolver 2024-09-17 21:33:51 +02:00
Nikita Popov
23c79fbbfb Release PHP-Parser 5.2.0 v5.2.0 2024-09-15 18:40:33 +02:00
Nikita Popov
b9c8374498 Run PHP 8.4 integration tests 2024-09-15 18:32:49 +02:00
Nikita Popov
d0826bd3e4 Add changelog entries 2024-09-15 18:28:36 +02:00
Nikita Popov
5ea6c2938b Exclude integration test 2024-09-05 21:41:03 +02:00
Nikita Popov
b493c51cce [8.4] Add support for asymmetric visibility modifiers
Represented using new PRIVATE_SET, PROTECTED_SET and PUBLIC_SET
bits in Modifiers.

RFC: https://wiki.php.net/rfc/asymmetric-visibility-v2
2024-09-05 21:38:16 +02:00
Nikita Popov
54139ca49b Disable fail-fast
PHP 8.4 currently fails because the version is installed version
is too old. Avoid cancelling other CI jobs because of that.
2024-09-01 12:48:37 +02:00
Nikita Popov
cde9bab3bb Add support for PHP 8.4 exit function
For backwards-compatibility, parse the simple single argument
case into an Exit_ node as previously. For more complex
expressions generate a function call.
2024-09-01 12:41:27 +02:00
Nikita Popov
018da15f3a Add token emulation support for asymmetric visibility modifiers 2024-08-31 20:41:07 +02:00
evenevent
ba14437165 chore: fix comment
Signed-off-by: evenevent <digping@icloud.com>
2024-08-15 09:22:56 +02:00
Nikita Popov
4a22c15169 Validate options in test_old
Regularly try to use this one with --version instead of
--php-version, which fails in a non-obvious way.
2024-08-11 17:08:58 +02:00
Nikita Popov
514f71024e Fix for new php-cs-fixer version 2024-08-11 17:03:56 +02:00
Ruud Kamphuis
6a97061265 Normalize enum value to ClassConstFetch
Fixes #930

(cherry picked from commit 8a21ec3182533ee6448a4efb8d238a4163b89297)
2024-08-11 16:58:28 +02:00
Nikita Popov
e3f223f623 Fix expected json dump for old PHP versions 2024-07-28 19:05:16 +02:00
Nikita Popov
03caf4cc99 [8.4] Add support for property hooks
Add hooks subnode to Stmt\Property and Param, which contains an
array of PropertyHook.

The property hook support is considered experimental and subject
to change.

RFC: https://wiki.php.net/rfc/property-hooks
2024-07-28 19:02:18 +02:00
Nikita Popov
b11fc12cce Use ParserFactory in integration test
So we actually use the PHP 8 parser on new versions.
2024-07-28 18:11:46 +02:00
Nikita Popov
3beee6ec77 Add Modifiers::toString() helper
Convert an integer modifier into a string.
2024-07-28 17:09:14 +02:00
Nikita Popov
58de479119 Remove error for abstract/final properties
These are allowed since PHP 8.4, with the introduction of property
hooks. (Abstract properties require hooks, which is not validated
here.)
2024-07-21 18:59:18 +02:00
Nikita Popov
d3ae2ed679 Respect version mode line in pretty printer tests
By default parser uses newest supported and pretty printer uses
its default version. If version is specified, it's used for both
parser and printer. Additionally, parserVersion can be used to
specify a different version for parser and printer.
2024-07-21 18:23:53 +02:00
Nikita Popov
beba9c528f Remove support for alternative array syntax in PHP 8 parser
We cannot support both this syntax and property hooks. Drop
support for the alternative syntax in the PHP 8 parser. The
PHP 7 parser still supports it.
2024-07-19 22:29:35 +02:00
Nikita Popov
fadccead52 Avoid compatibilty token list in parser
Create the mapping using the entries in symbolToName, so we don't
need to repeat the compatibility tokens in another place.
2024-07-14 20:53:13 +02:00
Nikita Popov
d8235a2701 [8.4] Add support for __PROPERTY__ magic constant
Part of property hooks RFC.
2024-07-14 18:52:47 +02:00
Amirreza Nasiri
5973c30a46 Update JSON_representation.markdown
Fix the invalid JSON structure
2024-07-13 15:46:21 +02:00
Nikita Popov
b917ba7b9c Add PHP 8.4 to CI matrix
Not using it in the integration tests yet.
2024-07-13 11:11:15 +02:00
Nikita Popov
caf540443a Declare PHP 8.4 as the newest supported version
As the comment indicates, this includes partially supported
versions. PHP-Parser includes support for all parts of PHP 8.4
that have landed in php-src.
2024-07-13 11:10:30 +02:00
Nikita Popov
683130c2ff Release PHP-Parser 5.1.0 v5.1.0 2024-07-01 22:03:41 +02:00
Nikita Popov
a894652a3d Fix ternary precedence printing
The precedence table set the LHS and RHS precedence for the
ternary to -1, which is the dummy value used for unary operators.
Instead, it should be the same as the operator precedence, as
the ternary is non-associative since PHP 8.

Fixes #1009.
2024-07-01 21:51:42 +02:00
Jing Xu(RainX)
3ef0811e45 Fix a typo: Dereferencable to Dereferenceable 2024-06-12 20:31:58 +02:00
Jing Xu(RainX)
db1963f9ea Fix a typo: Dereferenceing to Dereferencing 2024-06-12 20:29:11 +02:00
Jorg Adam Sowa
daaadc3bae
Adjust tests to be compatible with PHPUnit 10 (#998)
This avoids warnings on PHPUnit 10, without actually
switching to PHPUnit 10.
2024-06-03 08:24:19 +02:00
Nikita Popov
7b0384cdbe [8.4] Add support for new deref without parens
RFC: https://wiki.php.net/rfc/new_without_parentheses
2024-05-31 23:07:44 +02:00
Jorg Adam Sowa
d57da64d7c
Add missing void return types (#997) 2024-05-31 09:32:45 +02:00
Jorg Sowa
d327cf2acf Updated actions/checkout to v4 2024-05-21 18:12:19 +02:00
Markus Staab
c5ee33df86
Declare more precise phpdoc types (#993) 2024-04-19 21:04:10 +09:00
Nikita Popov
46be4560c4 Use PHP 8.3 for more CI jobs 2024-03-17 11:24:36 +01:00
Markus Staab
f2e037f8ea Make phpunit fail on deprecation warnings (#989)
(cherry picked from commit 4d36e9c16f4820c2ed9360bc818982f3c02a08f5)
2024-03-17 10:06:45 +01:00
Nikita Popov
b43758e9e9 Remove PHPUnit 7 and 8
PHPUnit 9 supports all the PHP versions that we need. Also update
the PHPUnit config schema.
2024-03-17 09:31:05 +01:00
Markus Staab
09691fc86e Prevent off-by-one errors in line-number related methods 2024-03-13 20:24:50 +01:00
Nikita Popov
139676794d Release PHP-Parser 5.0.2 v5.0.2 2024-03-05 21:51:40 +01:00
Nikita Popov
70c96493b4 Fix indentation detection after opening tag
Fixes #982.
2024-03-02 18:59:44 +01:00
Maarten Buis
ec02613432 Update PhpVersion::getNewestSupported() to PHP 8.3 2024-03-02 08:27:21 +01:00
Nikita Popov
af14fdb282 Avoid cyclic reference in parser
Pass $this as an explicit $self argument to the reduce callbacks,
so we can make them static. This avoids a circular reference in
the parser, so that it can be immediately destroyed when it goes
out of scope.

Fixes #980.
2024-02-21 21:13:45 +01:00
Nikita Popov
2218c2252c Release PHP-Parser 5.0.1 v5.0.1 2024-02-21 20:24:10 +01:00
sasezaki
ce019e9ad7 Add dev tool files to export-ignore 2024-01-14 10:02:54 +01:00
Nikita Popov
ff095c3c65 Check for tokens with non-integer ID
Fixes #974.
2024-01-10 20:34:09 +01:00
Nikita Popov
d619c8b4e6 Fix typo in upgrading guide
Fixes #973.
2024-01-09 20:23:09 +01:00
Nikita Popov
eb036d5a09 Add instructions for adding new syntax support 2024-01-07 18:54:10 +01:00
Nikita Popov
4a21235f7e Update documentation links in README v5.0.0 2024-01-07 18:17:35 +01:00
Nikita Popov
fba1d621c0 Release PHP-Parser 5.0.0 2024-01-07 18:14:20 +01:00