Commit d5f9216
Upgrade to PHPParser 5 and PHPStan 2 (#6431)
* Upgrade to PHPParser 5 and PHPStan 2
* patch finally stmt
* patch function stmt
* patch do stmt
* patch catch stmt
* patch trycatch stmt
* patch for stmt
* patch classmethod stmt
* patch else stmt
* patch while stmt
* patch foreach stmt
* patch case stmt
* patch case stmt
* patch elseif stmt
* patch namespace stmt
* patch node traverser stmt
* regenerate preload
* fix build preload generator
* trigger patch
* fix override param method pExpr_ArrowFunction
* fix override param method pExpr_Ternary
* fix override param method pExpr_Yield
* fix override param method p
* update parameters of RichParser
* Fix IsSuperTypeOfResult usage on ShortenedObjectType
* disable temporary phpstan extension config
* use ParserFactory::createForVersion()
* upgrade to phpstan/phpdoc-parser 2.0
* register ParserConfig as service
* set lines and indexes config
* remove ltrim on FileProcessor, PhpParser printformat preserving no longer ltrim
* remove ltrim on FileProcessor, PhpParser printformat preserving no longer ltrim
* Fix PhpDocTypeMapperTest
* make PrettyPrinter.php higher priority than PrettyPrinterAbstract.php
* add ConstantArrayTypeMapper
* Fix native return type on non native call detection
* use parent default indent parameter on pFileWithoutNamespace
* override pExpr_ArrowFunction method
* remove override pModifiers
* fix CallableTypeNode parameter construct
* fix ParamTagValueNode construct parameter
* fix use Token as array on CommonNotEqualRector
* ConstantArrayType is sub of root PHPStan type
* fix cannot set null of node on PhpDocNodeTraverser
* fix use Token as array on VariableInStringInterpolationFixerRector
* fix use Token as array on CompleteMissingIfElseBracketRector
* fix IsSuperTypeOfResult usage on ShortenedGenericObjectType
* fix pArray() override parameters
* Fix InstalledPackageResolverTest
* temporary remove --error-format symplify as phpstan symplify rules temporary disabled
* fix SmartPhpParserFactory setup
* fix compatible phpstan 2.0.1 on build
* Fix Throw_ from Expr on ThrowWithPreviousExceptionRector
* fix ConstantArrayType usage on ArraySpreadInsteadOfArrayMergeRector
* fix use Throw_ on Expr on TerminatedNodeAnalyzer
* clean up prop
* fix pass ArrayItem on Foreach_
* fix ArrayItem instance
* Fix ClosureUse from Node on CallUserFuncWithArrowFunctionToInlineRector
* Fix union normalize of float, string, integer
* Fix union normalize of float, string, integer
* remove return by ref param, no longer supported on phpstan 2
* Fix use of DeclareDeclare to DeclareItem on DeclareStrictTypesRector and IncreaseDeclareStrictTypesRector
* fix replace PropertyProperty to PropertyItem
* fix deprecated traverse constant
* fix removed FunctionVariantWithPhpDocs over ExtendedFunctionVariant
* fix use ExtendedNativeParameterReflection over NativeParameterWithPhpDocsReflection
* replace PropertyProperty with PropertyItem
* fix namespacedName init on ClassDependencyManipulatorTest
* Fix Throw_ on expr on RemoveAlwaysElseRector
* fix PropertyItem over PropertyProperty on MissingPropertiesFactory
* fix replace traverser on docs
* Fix Throw_ stmt to Expr Throw on ChangeSwitchToMatchRector
* fix Throw_ from expr on SwitchExprsResolver
* fix next throw to use Expression with Throw_ as expr on MatchSwitchAnalyzer
* fix sort MatchArm conds
* fix magic __CLASS__ get value
* fix use token as array on ParenthesizedNestedTernaryAnalyzer
* [ci-review] Rector Rectify
* replace deprecated class node to new node
* [ci-review] Rector Rectify
* fix test on FixtureJsonThrowCaseSensitiveConstFetch
* Fix Throw_ from Expr on ConsecutiveNullCompareReturnsToNullCoalesceQueueRector
* Fix Throw_ on SilentVoidResolver
* fix node visitor stop
* [ci-review] Rector Rectify
* fix Throw_ on Expr
* fix undefined ContantType
* fix undefined ContantType
* fix addVisitor() after call parent::construct()
* fix check has Throw on AddNeverReturnType
* [ci-review] Rector Rectify
* fix check has Throw on AddNeverReturnType
* fix test on JsonThrowCaseSensitiveConstFetchTest
* fix arrow function text spacing
* Fix ArrayItem resolve on normalize item value
* prepare for doctrine value migration
* setup doctrine
* [ci-review] Rector Rectify
* use PhpDocTagNode
* clean up debug
* fix ConstantArrayType
* import
* use createForNewestSupportedVersion
* fix ConstantArrayType cast on RecastingRemovalRector
* skip magic call on RecastingRemovalRector
* fix use List_ node over Array_ on Foreach_ valueVar on UnusedForeachValueToArrayKeysRector
* [ci-review] Rector Rectify
* fix List_ on Foreach_ valueVar on PHPStanNodeScopeResolver
* fix Array items always ArrayItem
* skip instanceof check
* skip instanceof check
* fix mirror comment on StmtsManipulator
* fix wrap heredoc print
* fix return null next print on ExplicitReturnNullRector
* fix print float/int override pScalar_int and pScalar_float
* re-run rector
* fix test with remove unused use on RenameClassRector test
* fix ArrowFunction unnecessary parentheses
* fix print in test for logical bool
* fix binary op parentheses
* fix on operator string + or -
* fix on /, *, ** as well
* add note for next todo binary op handling
* fix pow opration with binary op parentheses handling
* [ci-review] Rector Rectify
* pull constant from NodeVisitor
* only support php 7.4+ since phpstan 2 and php-parser 5 require php 7.4+
* downgrade to php 7.4
* remove php 7.2 e2e
* use simple parser for defaultAnalysisParser, with native parser php 7.0
* Revert "use simple parser for defaultAnalysisParser, with native parser php 7.0"
This reverts commit b3d6c45.
* Fix parsing php 7
* fix Throw_ from Expr on AddOverrideAttributeToOverriddenMethodsRector
* using inner try catch to ensure everything catched from root try
* use constant from NodeVisitor
* temporary handle later for doctrine, now focus on php-parser print
* fix reprint cond on ParenthesizeNestedTernaryRector
* PhpDocParser parent __construct() only have require 3 params now
* disable native phpdoc-parser doctrine detection
* Fix doctrine detection on ReadonlyPropertyRector
* differentiate doctrine
* later patch
* fix InterpolatedStringPart detection for CreateFunctionToAnonymousFunctionRector on ValueResolver
* print arrow function
* print ArrowFunction on Carbon
* fix set orig node on nested ternary on SwitchNegatedTernaryRector
* Fix BinaryOp right origNode on CombineIfRector (part 1)
* fix print on CombineIfRector (part 2)
* Fix orig node set on ChangeNestedForeachIfsToEarlyContinueRector
* [ci-review] Rector Rectify
* fix set orig node on SimplifyIfReturnBoolRector
* Add ReprintNodeVisitor, avoid add complexity to AbstractRector
* fix reprint boolean not on SimplifyEmptyTest
* fix right binary op
* require --dev phpstan-phpunit 2 and phpstan-webmozart-assert 2
* ignore instanceof phpstanAPi.class notice
* ignore instanceof phpstanApi.classConstant notice
* ignore assert notice in test on purpose
* php runtime check notice
* set treatPhpDocTypesAsCertain: false
* fix usage of ExtendedParametersAcceptor
* ignore notice on provideMinPhpVersion()
* ignore notice instanceof.alwaysTrue
* fix List_ node usage on UnusedForeachValueToArrayKeysRector
* ignore phpstanApi.constructor
* ignore return.unusedType as follow parent signature
* ignore varTag.nativeType as enforce native type
* ignore phpstan notice: deadCode.unreachable as unreliable on runtime
* fix always falsy on RemoveAlwaysElseRector
* ignore argumet.type and return.type identifier
* fix use Token as array on File value object
* fix invalid ConstantScalar type usage on ValueResolver
* ignore runtime comparison
* fix empty array on TernaryToNullCoalescingRector
* fix empty array on JsonThrowOnErrorRector
* fix never null on RemoveDeadIfForeachForRector
* fix useless array_values() on OverridenExistingNamesResolver
* fix variable assign
* fix ArrayType on TypeNormalizer
* ignore phpstanApi.varTagAssumption
* fix phpdoc parse error
* fix isClassString() usage
* fix phpstan notice
* fix
* fix intersection
* reprint fix
* fallback scope
* fallback scope
* [ci-review] Rector Rectify
* fix phpstan
* fix phpstan ArrayItem
* [ci-review] Rector Rectify
* First step of Doctrine works: detect doctrine class from use statement via ObjectTypeSpecifier service
* fix phpstan
* [ci-review] Rector Rectify
* Fix alias object detection
* Fix alias object detection
* fix skip nette presenter
* no need class exists check on fqcn
* fix
* fix doctrine rename on RenameClassRectorTest
* add JoinColumns stubs
* add InverseJoinColumn stubs
* Fix named arg on NamedArgsFactory on ArrayItem
* [ci-review] Rector Rectify
* fix shortened object from use
* Fix ClassConstFetch as key on AttributeArrayNameInliner
* [ci-review] Rector Rectify
* fix numeric value in attribute
* fix auto import doctrine
* handle numeric int as key
* [ci-review] Rector Rectify
* fix CurlylistNode usage on AnnotationToAttributeRector
* [ci-review] Rector Rectify
* fix nested attribute group apply
* Fix inline array
* Fix inline array
* Fix printing generic
* fix printing generic
* add UniqueEntity stub
* fix from use statement
* remove unused stub
* Fix multiline values
* Fix multiline values
* fix phpstan
* fix requirement as php 7.4
* fix process single quoted
* [ci-review] Rector Rectify
* fix multi line
* fix with description
* use php 7.4 for linter
* temporary update fixture to avoid crash single quote, due to phpstan-phpdoc-parser internal error
* finally, unit test green
* Coalesce print
* fix interpolat print
* [ci-review] Rector Rectify
* patch ArrayItem usge on NodeFactory::createArgs()
* doc indent check
* handle doc indentation
* [ci-review] Rector Rectify
* require-dev phpstan/phpstan-deprecation-rules and fix deprecated method call
* fix variable on full_build.sh
* fix phsptan message return
* Conditionally to not require rector/rector-src on PR 6431 for packages tests CI
* final touch: enable return.type identifier phpstan
* really final touch: comment
* final touch: clean up always true check
* final touch: clean up ignore config
* really really final touch: clean up staticMethod.alreadyNarrowedType notice
---------
Co-authored-by: GitHub Action <[email protected]>1 parent cb76a5f commit d5f9216
File tree
327 files changed
+1647
-1179
lines changed- .github/workflows
- build
- config
- target-repository
- .github/workflows
- e2e/reflection-union-php72
- src
- config/phpstan
- rules-tests
- Carbon/Rector/FuncCall/TimeFuncCallToCarbonRector/Fixture
- CodeQuality/Rector
- ClassMethod/ExplicitReturnNullRector/Fixture
- If_/SimplifyIfReturnBoolRector/Fixture
- LogicalAnd/LogicalToBooleanRector/Fixture
- DeadCode/Rector/ClassMethod/RemoveEmptyClassMethodRector/Fixture
- EarlyReturn/Rector/Foreach_/ChangeNestedForeachIfsToEarlyContinueRector/Fixture
- Naming/Rector/ClassMethod/RenameParamToMatchTypeRector/Fixture
- Php56/Rector/FuncCall/PowToExpRector/Fixture
- Php73/Rector/String_/SensitiveHereNowDocRector/Fixture
- Php74/Rector/Closure/ClosureToArrowFunctionRector/Fixture
- Php80/Rector/Class_/AnnotationToAttributeRector
- FixturePhp81
- Fixture
- config
- Renaming/Rector/Name/RenameClassRector/Fixture
- Transform/Rector/Scalar/ScalarValueToConstFetchRector/config
- TypeDeclaration/Rector
- ClassMethod/ReturnTypeFromReturnNewRector/Fixture
- Class_/ReturnTypeFromStrictTernaryRector/Fixture
- rules
- Arguments/NodeAnalyzer
- Carbon/NodeFactory
- CodeQuality
- NodeAnalyzer
- NodeFactory
- Rector
- Catch_
- ClassMethod
- Class_
- Foreach_
- FuncCall
- If_
- LogicalAnd
- NotEqual
- Ternary
- CodingStyle
- ClassNameImport
- NodeAnalyzer
- NodeFactory
- Rector
- Assign
- Catch_
- ClassMethod
- Encapsed
- Foreach_
- FuncCall
- Property
- Use_
- DeadCode
- NodeAnalyzer
- NodeManipulator
- PhpDoc
- Rector
- Array_
- Cast
- ClassConst
- ClassMethod
- ConstFetch
- Expression
- For_
- If_
- Node
- Property
- TryCatch
- EarlyReturn/Rector
- Foreach_
- If_
- Naming
- ExpectedNameResolver
- Naming
- PropertyRenamer
- Rector/Foreach_
- ValueObject
- Php52/Rector/Switch_
- Php54/Rector/Break_
- Php55/Rector/String_
- Php70/Rector
- Assign
- Break_
- ClassMethod
- FuncCall
- List_
- MethodCall
- Ternary
- Php71/Rector
- Assign
- BinaryOp
- FuncCall
- Php72
- NodeFactory
- Rector
- Assign
- FuncCall
- Unset_
- While_
- Php73/Rector/FuncCall
- Php74
- Guard
- NodeAnalyzer
- Rector
- ArrayDimFetch
- FuncCall
- LNumber
- Property
- Ternary
- Tokenizer
- Php80
- DocBlock
- MatchAndRefactor/StrStartsWithMatchAndRefactor
- NodeAnalyzer
- NodeFactory
- NodeResolver
- Rector
- ClassMethod
- Class_
- Identical
- NotIdentical
- Switch_
- Php81
- NodeAnalyzer
- NodeFactory
- Rector
- Array_
- FuncCall
- Property
- Php82/Rector/Encapsed
- Php83/Rector
- ClassConst
- ClassMethod
- FuncCall
- Privatization/NodeManipulator
- Removing/Rector/FuncCall
- Renaming
- NodeManipulator
- Rector/FunctionLike
- Strict/NodeFactory
- Transform
- Rector
- ClassMethod
- FileWithoutNamespace
- Scalar
- String_
- ValueObject
- TypeDeclaration
- AlreadyAssignDetector
- Guard
- NodeManipulator
- PHPStan
- PhpDocParser
- Rector
- ClassMethod
- Class_
- FunctionLike
- StmtsAwareInterface
- TypeAnalyzer
- TypeInferer
- PropertyTypeInferer
- src
- Application
- BetterPhpDocParser
- PhpDocNodeVisitor
- PhpDocParser
- Comments/NodeTraverser
- Config
- CustomRules
- DependencyInjection
- NodeAnalyzer
- NodeCollector/NodeAnalyzer
- NodeManipulator
- NodeNameResolver
- NodeNameResolver
- NodeTypeResolver
- NodeTypeResolver
- PHPStan
- Scope
- NodeVisitor
- Type
- TypeComparator
- PHPStanStaticTypeMapper/TypeMapper
- PhpAttribute
- AnnotationToAttributeMapper
- Contract
- NodeFactory
- ValueObject
- PhpDocParser
- NodeVisitor
- PhpDocParser
- PhpParser
- PhpParser
- Node
- Value
- Parser
- Printer
- PostRector
- Rector
- ValueObject
- Rector
- StaticTypeMapper
- Naming
- PhpDocParser
- ValueObject/Type
- ValueObject
- Application
- VendorLocker
- NodeVendorLocker
- stubs/Doctrine
- Nette/Security
- ORM/Mapping
- tests
- BetterPhpDocParser
- Composer
- Issues
- AutoImport/Fixture/DocBlock
- FqcnAnnotationToAttribute/Fixture
- InfiniteLoop/Rector/MethodCall
- PlainValueParser/Fixture
- NodeManipulator
- PhpAttribute
- AnnotationToAttributeMapper
- PhpParser/Node
- StaticTypeMapper/PhpDoc
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
327 files changed
+1647
-1179
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
57 | 66 | | |
58 | 67 | | |
59 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
79 | 80 | | |
80 | 81 | | |
81 | 82 | | |
| |||
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
107 | 123 | | |
108 | 124 | | |
109 | 125 | | |
| |||
315 | 331 | | |
316 | 332 | | |
317 | 333 | | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
318 | 345 | | |
319 | 346 | | |
320 | 347 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
0 commit comments