1739 Commits

Author SHA1 Message Date
Nikita Popov
7d3039c378 Update to phpstan 2.0 2024-12-30 12:14:29 +01:00
Nikita Popov
447a020a1f Release PHP-Parser 5.4.0 v5.4.0 2024-12-30 12:07:19 +01:00
Markus Staab
45f70ed80a Simplify NodeTraverser->traverseNode() 2024-12-30 11:10:07 +01:00
Markus Staab
74a361814d Simplify NodeTraverser->traverseArray() 2024-12-30 11:10:07 +01:00
Nikita Popov
6478c5ac53 Fix PropertyHook::getStmts() for set hook
Produce the correct desugaring if the propertyName attribute is
set, and set it in the parser. Otherwise throw an exception.

Fixes #1053.
2024-12-27 16:56:00 +01:00
Nikita Popov
8bb415902e Fix cs 2024-12-27 16:33:38 +01:00
Nikita Popov
48fd76e542 Make PropertyHook::getStmts() less incorrect
Still missing the assignment to the correct property, but at
least we're not returning from a non-void function now...
2024-12-27 16:30:03 +01:00
Ondrej Mirtes
d20a197ca7 Emit error - Multiple properties cannot share the same hooks
Closes GH-1052.
2024-12-27 16:19:46 +01:00
Ondrej Mirtes
62dee28027 Rename ParserAbstract method checkPropertyHookList to checkEmptyPropertyHookList 2024-12-27 16:13:47 +01:00
Nikita Popov
b396e9e0d6 Add missing newline after usage message 2024-12-27 16:13:29 +01:00
Ondrej Mirtes
f212bb7afb Add PropertyHook::isFinal() helper method with tests 2024-12-13 23:15:12 +01:00
Ondrej Mirtes
f43324a074 Missing flags subNode description in PropertyHook constructor PHPDoc 2024-12-13 23:15:12 +01:00
Ondrej Mirtes
73b160f8c4 Add flags helper methods Property::isAbstract() and Property::isFinal() 2024-12-13 23:15:12 +01:00
Ondrej Mirtes
4f9dc8b0f5 Promoted properties with hooks do not need visibility modifier 2024-12-11 10:17:55 +01:00
Nathanael Esayeas
469377f4a8
Fix classmap authoritative autoloading (#1046)
This patch resolves #1045 by adding dummy class definitions
behind if (false) checks that are picked up the authoritative
autoloader.
2024-12-06 22:00:17 +01:00
Jorg Sowa
74d3f7fc24 Removed reudndant token generation 2024-11-24 09:54:02 +01:00
Jorg Sowa
25828ea952 Updated target.php to new PHP-Parser version 2024-11-24 09:54:02 +01:00
Jorg Sowa
05ed79595b Removed unrecheable statement 2024-11-19 21:17:27 +01:00
Markus Staab
954f7a411f More precise toLowerString() return type 2024-11-05 21:19:09 +01:00
Nikita Popov
8eea230464 Release PHP-Parser 5.3.1 v5.3.1 2024-10-08 20:51:32 +02:00
Nikita Popov
9c7a3f8d8f Support declaring functions with name exit/die
For use in stubs.

Fixes #1030.
2024-10-08 20:46:50 +02:00
Markus Staab
26573ea64f Makefile works on windows 2024-10-07 20:54:36 +02:00
Nikita Popov
3abf7425cd Release PHP-Parser 5.3.0 v5.3.0 2024-09-29 15:56:26 +02:00
Nikita Popov
961f158f6d Avoid negative indendation in formatting-preserving printer
Fixes #1015.
2024-09-29 15:34:59 +02:00
Nikita Popov
e50c67b7a9 Add basic support for tab indentation
Add a new "indent" option for the pretty printer, which can be
use to control the indentation width, or switch it to use tabs.

Tab width is currenlty hardcoded to 4, but also shouldn't matter
much.

Possibly the formatting-preserving printer should auto-detect
the indentation in the future.
2024-09-21 20:58:10 +02:00
Nikita Popov
26a0197186 Use PHP 8.4 for the PHP 7.4 integration test 2024-09-21 16:03:21 +02:00
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