1719 Commits

Author SHA1 Message Date
Nikita Popov
f7b448fa15 Bail out on list insertion of non-Node
PhpStan correctly detected that this is not supported. We could
add support for it, but for now just make sure it doesn't crash.
2022-09-17 21:14:31 +02:00
Nikita Popov
b3ad14b938 Fix some types 2022-09-17 20:33:04 +02:00
Nikita Popov
9f9c2ea81b Use PhpStan level 6
New baseline errors are array types that I prefer to leave alone,
as well as one PhpStan bug:
https://github.com/phpstan/phpstan/issues/4526
2022-09-17 18:49:51 +02:00
Nikita Popov
f98341f688 Specify more types 2022-09-17 18:48:56 +02:00
Nikita Popov
fc6b4890ef Specify more types 2022-09-17 16:45:25 +02:00
Nikita Popov
032b102146 Remove deprecated Error constructor
And use this chance to provide accurate position information for
namespace errors.
2022-09-11 22:05:47 +02:00
Nikita Popov
40c89cf924 Specify some more types 2022-09-11 21:54:39 +02:00
Nikita Popov
a099803d01 Use array<string, mixed> type for $attributes
Slightly more accurate, and stops PHPStan from complaining about
the missing array type information.
2022-09-11 20:51:31 +02:00
Nikita Popov
c595989e4d Support adding class constants in trait builder
These are allowed as of PHP 8.2.
2022-09-11 19:34:27 +02:00
Nikita Popov
6af204467c Add some missing property types 2022-09-11 19:30:14 +02:00
Nikita Popov
48f470eac7 Add missing return types 2022-09-11 18:17:05 +02:00
Nikita Popov
43d6332dce Add return types to PrettyPrinter\Standard 2022-09-11 17:49:41 +02:00
Nikita Popov
9b46dffb12 Fix formatting preservation for alternative elseif/else syntax
Test taken from PR #797.
2022-09-11 16:58:35 +02:00
Nikita Popov
205bd75aa8 Add isPublic() etc methods on Param node
Also isPromoted() to check for any flags.
2022-09-11 16:11:32 +02:00
Nikita Popov
031c5e6ed0 Move verifyModifier/verifyClassModifier to Modifiers class
Now that the Modifiers are in a separate class, these *internal*
verification methods should also be moved there.
2022-09-11 16:05:21 +02:00
Christopher Hertel
36b2a996ca Add isReadonly on Param node 2022-09-11 16:05:10 +02:00
Nikita Popov
b9fe3449e8 Add missing parameter types 2022-09-11 15:22:23 +02:00
Nikita Popov
e9800cf7d3 Add tools/ directory
With php-cs-fixer and phpstan. Also reformat one file.
2022-09-11 13:17:17 +02:00
Nikita Popov
2070cb7cb2 Drop phpstan from composer.json
It does not support PHP 7.1, so we should not include it
unconditionally.
2022-09-11 12:45:59 +02:00
Nikita Popov
9b5a2c8991 Use PHPStan level 5 2022-09-11 12:40:08 +02:00
Nikita Popov
8dfce13d77 Add phpstan baseline 2022-09-11 12:31:50 +02:00
Nikita Popov
f59f226f65 Fix some phpstan warnings 2022-09-11 12:16:12 +02:00
Jaroslav Hanslík
468c0ef6bc Fixed type in UnionType
(cherry picked from commit 2f1fd784fe5560675722a1e5cbbcece5f43bf3a0)
2022-09-10 22:42:32 +02:00
Nikita Popov
b4b60c8460 Remove phpunit 6.5
With the minimum version raised to PHP 7.1, there should be no
more need for PHPUnit 6.
2022-09-06 20:29:27 +02:00
Nikita Popov
636f066b76 Use Node\ClosureUse instead of Expr\ClosureUse in parser
Fixes #883.
2022-09-05 18:35:39 +02:00
Ondřej Mirtes
7362f2b2d0 Fix pretty printing example 2022-09-05 10:32:21 +02:00
Nikita Popov
96037b3d33 Release PHP-Parser 5.0.0-alpha1 v5.0.0alpha1 2022-09-04 18:58:01 +02:00
Nikita Popov
8d02d37e42 More docs updates 2022-09-04 18:55:27 +02:00
Nikita Popov
e68b17cc3b Add --version flag to php-parse 2022-09-04 16:31:39 +02:00
Nikita Popov
f63081a57c Partial documentation update 2022-09-04 16:16:25 +02:00
Nikita Popov
44c6a97705 Fix empty list insertion of multiple attributes 2022-09-04 09:25:36 +02:00
Nikita Popov
9a230cd333 Update changelog 2022-09-03 22:14:41 +02:00
Nikita Popov
a772853307 Fix formatting preservation for match 2022-09-03 21:02:34 +02:00
Nikita Popov
c585a2d766 Switch list insertion maps to use class name
Also highlights that the list insertion entry for Expr\Match
was not used.
2022-09-03 20:56:06 +02:00
Nikita Popov
8ed76726aa Switch modifierChangeMap to use class name
For better refactoring support, prefer class name over node type.
2022-09-03 19:12:25 +02:00
Nikita Popov
5f3ad31501 Fix ArrayItem entries in pretty printer maps
The tests were written in such a way that the regression was not
caught.
2022-09-03 19:04:22 +02:00
Nikita Popov
4917c71a91 Rename Stmt\UseUse to UseItem 2022-09-03 18:59:48 +02:00
Nikita Popov
e1345f0c09 Rename Stmt\PropertyProperty to PropertyItem 2022-09-03 18:55:22 +02:00
Nikita Popov
03ccfa3dd4 Rename Stmt\DeclareDeclare to DeclareItem 2022-09-03 18:45:28 +02:00
Nikita Popov
a3b0541c71 Support array return from enterNode()
This uses the same semantics as arrays from leaveNode(), i.e. the
returned nodes will not be visited by other visitors. This is open
to change though (but probably should change for both enterNode()
and leaveNode() if it does change?)
2022-09-03 18:38:22 +02:00
Nikita Popov
c42290ae42 Support REMOVE_NODE from enterNode() 2022-09-03 18:15:36 +02:00
Nikita Popov
a44faa6328 Rename Scalar\Encapsed to Scalar\InterpolatedString 2022-09-03 15:14:04 +02:00
Nikita Popov
11caa3b9cc Add compat shim for EncapsedStringPart 2022-09-03 15:08:39 +02:00
Nikita Popov
f4ec6a1e53 Rename Scalar\EncapsedStringPart to InterpolatedStringPart
It is no longer an expression node, which unfortunately does
require a more awkward type for the Encaps node.
2022-09-03 13:25:23 +02:00
Nikita Popov
23835d20ef Rename Scalar\LNumber to Scalar\Int_ 2022-09-03 12:07:38 +02:00
Nikita Popov
66b20bd6bc Rename Scalar\DNumber to Scalar\Float_ 2022-09-03 11:56:06 +02:00
Nikita Popov
2b562b72a8 Update default of ClassMethod::$flags in docs
This defaults to 0, not Modifiers::PUBLIC.
2022-09-03 11:02:16 +02:00
Nikita Popov
f5b56a5c4c Remove MODIFIER_ prefix from node dumps
These constants are now called Modifiers::PUBLIC rather than
Class_::MODIFIER_PUBLIC etc, so update the dumped name as well.
2022-09-03 11:00:13 +02:00
Nikita Popov
a2608f0b74 Support empty list insertion for attributes 2022-09-03 10:52:01 +02:00
Nikita Popov
9dca6f1d37 Add test for StaticVar rename
Also run these in separate processes, they're not really meaningful
if the classes are already loaded.
2022-09-02 22:54:29 +02:00