Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to PHPParser 5 and PHPStan 2 #6431

Merged
merged 250 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
250 commits
Select commit Hold shift + click to select a range
4419d2c
Upgrade to PHPParser 5 and PHPStan 2
samsonasik Nov 14, 2024
5271746
patch finally stmt
samsonasik Nov 14, 2024
247620e
patch function stmt
samsonasik Nov 14, 2024
33de91e
patch do stmt
samsonasik Nov 14, 2024
15e99d9
patch catch stmt
samsonasik Nov 14, 2024
9990b06
patch trycatch stmt
samsonasik Nov 14, 2024
cf2dea0
patch for stmt
samsonasik Nov 14, 2024
83c5b17
patch classmethod stmt
samsonasik Nov 14, 2024
c00c8d1
patch else stmt
samsonasik Nov 14, 2024
9716844
patch while stmt
samsonasik Nov 14, 2024
c6fdbee
patch foreach stmt
samsonasik Nov 14, 2024
62526e1
patch case stmt
samsonasik Nov 14, 2024
8fc3038
patch case stmt
samsonasik Nov 14, 2024
664a609
patch elseif stmt
samsonasik Nov 14, 2024
b1c626c
patch namespace stmt
samsonasik Nov 14, 2024
e1c8434
patch node traverser stmt
samsonasik Nov 14, 2024
e1c36bc
regenerate preload
samsonasik Nov 14, 2024
5959cf3
fix build preload generator
samsonasik Nov 14, 2024
c922fd9
trigger patch
samsonasik Nov 14, 2024
c875f6b
fix override param method pExpr_ArrowFunction
samsonasik Nov 14, 2024
50d8ea0
fix override param method pExpr_Ternary
samsonasik Nov 14, 2024
9efe2e5
fix override param method pExpr_Yield
samsonasik Nov 14, 2024
d55ef8e
fix override param method p
samsonasik Nov 14, 2024
98fbdc6
update parameters of RichParser
samsonasik Nov 14, 2024
7b1d69f
Fix IsSuperTypeOfResult usage on ShortenedObjectType
samsonasik Nov 14, 2024
2ac7a3c
disable temporary phpstan extension config
samsonasik Nov 14, 2024
363606e
use ParserFactory::createForVersion()
samsonasik Nov 14, 2024
54014a5
upgrade to phpstan/phpdoc-parser 2.0
samsonasik Nov 14, 2024
73b6b24
register ParserConfig as service
samsonasik Nov 14, 2024
53ffc60
set lines and indexes config
samsonasik Nov 14, 2024
17137e5
remove ltrim on FileProcessor, PhpParser printformat preserving no lo…
samsonasik Nov 15, 2024
b35e32c
remove ltrim on FileProcessor, PhpParser printformat preserving no lo…
samsonasik Nov 15, 2024
f701268
Fix PhpDocTypeMapperTest
samsonasik Nov 15, 2024
4e20309
make PrettyPrinter.php higher priority than PrettyPrinterAbstract.php
samsonasik Nov 15, 2024
0b8dd67
add ConstantArrayTypeMapper
samsonasik Nov 15, 2024
5d75081
Fix native return type on non native call detection
samsonasik Nov 15, 2024
e6e5e12
use parent default indent parameter on pFileWithoutNamespace
samsonasik Nov 15, 2024
5309cb1
override pExpr_ArrowFunction method
samsonasik Nov 15, 2024
74aacdf
remove override pModifiers
samsonasik Nov 15, 2024
74fb818
fix CallableTypeNode parameter construct
samsonasik Nov 15, 2024
7690f90
fix ParamTagValueNode construct parameter
samsonasik Nov 15, 2024
8d661fa
fix use Token as array on CommonNotEqualRector
samsonasik Nov 15, 2024
75e87d9
ConstantArrayType is sub of root PHPStan type
samsonasik Nov 15, 2024
8402708
fix cannot set null of node on PhpDocNodeTraverser
samsonasik Nov 15, 2024
3df0f52
fix use Token as array on VariableInStringInterpolationFixerRector
samsonasik Nov 15, 2024
93bff48
fix use Token as array on CompleteMissingIfElseBracketRector
samsonasik Nov 15, 2024
106bc52
fix IsSuperTypeOfResult usage on ShortenedGenericObjectType
samsonasik Nov 15, 2024
ae07ea5
fix pArray() override parameters
samsonasik Nov 15, 2024
5e46a0a
Fix InstalledPackageResolverTest
samsonasik Nov 15, 2024
70194ec
temporary remove --error-format symplify as phpstan symplify rules te…
samsonasik Nov 15, 2024
ffdb50b
fix SmartPhpParserFactory setup
samsonasik Nov 15, 2024
efc88d4
fix compatible phpstan 2.0.1 on build
samsonasik Nov 15, 2024
f3ad29e
Fix Throw_ from Expr on ThrowWithPreviousExceptionRector
samsonasik Nov 15, 2024
41db223
fix ConstantArrayType usage on ArraySpreadInsteadOfArrayMergeRector
samsonasik Nov 15, 2024
af3b852
fix use Throw_ on Expr on TerminatedNodeAnalyzer
samsonasik Nov 15, 2024
1b70f45
clean up prop
samsonasik Nov 15, 2024
1e0a414
fix pass ArrayItem on Foreach_
samsonasik Nov 15, 2024
a3c8986
fix ArrayItem instance
samsonasik Nov 15, 2024
088be56
Fix ClosureUse from Node on CallUserFuncWithArrowFunctionToInlineRector
samsonasik Nov 15, 2024
20d31c6
Fix union normalize of float, string, integer
samsonasik Nov 15, 2024
b3e69b6
Fix union normalize of float, string, integer
samsonasik Nov 15, 2024
1d78934
remove return by ref param, no longer supported on phpstan 2
samsonasik Nov 15, 2024
d5a8beb
Fix use of DeclareDeclare to DeclareItem on DeclareStrictTypesRector …
samsonasik Nov 15, 2024
a5d27b2
fix replace PropertyProperty to PropertyItem
samsonasik Nov 15, 2024
23b0e5b
fix deprecated traverse constant
samsonasik Nov 15, 2024
9c25940
fix removed FunctionVariantWithPhpDocs over ExtendedFunctionVariant
samsonasik Nov 15, 2024
852a84c
fix use ExtendedNativeParameterReflection over NativeParameterWithPhp…
samsonasik Nov 15, 2024
cfc2aba
replace PropertyProperty with PropertyItem
samsonasik Nov 15, 2024
ebc6241
fix namespacedName init on ClassDependencyManipulatorTest
samsonasik Nov 15, 2024
bb5a0da
Fix Throw_ on expr on RemoveAlwaysElseRector
samsonasik Nov 15, 2024
b08f79b
fix PropertyItem over PropertyProperty on MissingPropertiesFactory
samsonasik Nov 15, 2024
abdca86
fix replace traverser on docs
samsonasik Nov 15, 2024
aad285f
Fix Throw_ stmt to Expr Throw on ChangeSwitchToMatchRector
samsonasik Nov 15, 2024
86d936a
fix Throw_ from expr on SwitchExprsResolver
samsonasik Nov 15, 2024
67e168c
fix next throw to use Expression with Throw_ as expr on MatchSwitchAn…
samsonasik Nov 15, 2024
9327031
fix sort MatchArm conds
samsonasik Nov 15, 2024
7ec8d4b
fix magic __CLASS__ get value
samsonasik Nov 15, 2024
a30af00
fix use token as array on ParenthesizedNestedTernaryAnalyzer
samsonasik Nov 15, 2024
adfc24f
[ci-review] Rector Rectify
actions-user Nov 15, 2024
fa2f9c3
replace deprecated class node to new node
samsonasik Nov 15, 2024
a7446e4
[ci-review] Rector Rectify
actions-user Nov 15, 2024
aa0574d
fix test on FixtureJsonThrowCaseSensitiveConstFetch
samsonasik Nov 15, 2024
f432f35
Fix Throw_ from Expr on ConsecutiveNullCompareReturnsToNullCoalesceQu…
samsonasik Nov 15, 2024
6a5cea6
Fix Throw_ on SilentVoidResolver
samsonasik Nov 15, 2024
5256e29
fix node visitor stop
samsonasik Nov 15, 2024
044e8d0
[ci-review] Rector Rectify
actions-user Nov 15, 2024
3a3dba0
fix Throw_ on Expr
samsonasik Nov 15, 2024
758134b
fix undefined ContantType
samsonasik Nov 15, 2024
c73b646
fix undefined ContantType
samsonasik Nov 15, 2024
4f0485b
fix addVisitor() after call parent::construct()
samsonasik Nov 15, 2024
0a3c8a6
fix check has Throw on AddNeverReturnType
samsonasik Nov 15, 2024
327a4b0
[ci-review] Rector Rectify
actions-user Nov 15, 2024
3828103
fix check has Throw on AddNeverReturnType
samsonasik Nov 15, 2024
3da626b
fix test on JsonThrowCaseSensitiveConstFetchTest
samsonasik Nov 15, 2024
2120d33
fix arrow function text spacing
samsonasik Nov 15, 2024
43082c9
Fix ArrayItem resolve on normalize item value
samsonasik Nov 15, 2024
ebb4822
prepare for doctrine value migration
samsonasik Nov 15, 2024
c344011
setup doctrine
samsonasik Nov 15, 2024
b4503bb
[ci-review] Rector Rectify
actions-user Nov 15, 2024
b936147
use PhpDocTagNode
samsonasik Nov 15, 2024
cc3d0e4
clean up debug
samsonasik Nov 15, 2024
87266ba
fix ConstantArrayType
samsonasik Nov 15, 2024
f32b3ef
import
samsonasik Nov 15, 2024
398c7ae
use createForNewestSupportedVersion
samsonasik Nov 15, 2024
d564281
fix ConstantArrayType cast on RecastingRemovalRector
samsonasik Nov 15, 2024
7930fbc
skip magic call on RecastingRemovalRector
samsonasik Nov 15, 2024
0cdc33c
fix use List_ node over Array_ on Foreach_ valueVar on UnusedForeachV…
samsonasik Nov 15, 2024
b49cca5
[ci-review] Rector Rectify
actions-user Nov 15, 2024
140eca2
fix List_ on Foreach_ valueVar on PHPStanNodeScopeResolver
samsonasik Nov 15, 2024
b0d67e8
fix Array items always ArrayItem
samsonasik Nov 15, 2024
f126ba5
skip instanceof check
samsonasik Nov 15, 2024
6644bbe
skip instanceof check
samsonasik Nov 15, 2024
5eaa034
fix mirror comment on StmtsManipulator
samsonasik Nov 15, 2024
53769c3
fix wrap heredoc print
samsonasik Nov 15, 2024
dfdf761
fix return null next print on ExplicitReturnNullRector
samsonasik Nov 15, 2024
299e80f
fix print float/int override pScalar_int and pScalar_float
samsonasik Nov 15, 2024
d091dfa
re-run rector
samsonasik Nov 15, 2024
d073b3d
fix test with remove unused use on RenameClassRector test
samsonasik Nov 15, 2024
36a5a0f
fix ArrowFunction unnecessary parentheses
samsonasik Nov 15, 2024
0307f95
fix print in test for logical bool
samsonasik Nov 15, 2024
964e74a
fix binary op parentheses
samsonasik Nov 16, 2024
a6806c8
fix on operator string + or -
samsonasik Nov 16, 2024
bf4563b
fix on /, *, ** as well
samsonasik Nov 16, 2024
dc75b96
add note for next todo binary op handling
samsonasik Nov 16, 2024
fcdedd8
fix pow opration with binary op parentheses handling
samsonasik Nov 16, 2024
474baf5
[ci-review] Rector Rectify
actions-user Nov 16, 2024
7c408c5
pull constant from NodeVisitor
samsonasik Nov 16, 2024
c5c9814
only support php 7.4+ since phpstan 2 and php-parser 5 require php 7.4+
samsonasik Nov 16, 2024
2c210d2
downgrade to php 7.4
samsonasik Nov 16, 2024
bc22945
remove php 7.2 e2e
samsonasik Nov 16, 2024
8975dc2
use simple parser for defaultAnalysisParser, with native parser php 7.0
samsonasik Nov 16, 2024
c064d38
Revert "use simple parser for defaultAnalysisParser, with native pars…
samsonasik Nov 17, 2024
5240867
Fix parsing php 7
samsonasik Nov 17, 2024
b63347b
fix Throw_ from Expr on AddOverrideAttributeToOverriddenMethodsRector
samsonasik Nov 17, 2024
d341349
using inner try catch to ensure everything catched from root try
samsonasik Nov 17, 2024
7201260
use constant from NodeVisitor
samsonasik Nov 17, 2024
6e917c9
temporary handle later for doctrine, now focus on php-parser print
samsonasik Nov 17, 2024
c8f975d
fix reprint cond on ParenthesizeNestedTernaryRector
samsonasik Nov 17, 2024
b3385a4
PhpDocParser parent __construct() only have require 3 params now
samsonasik Nov 17, 2024
d41b116
disable native phpdoc-parser doctrine detection
samsonasik Nov 17, 2024
7cfead5
Fix doctrine detection on ReadonlyPropertyRector
samsonasik Nov 17, 2024
06fb96c
differentiate doctrine
samsonasik Nov 17, 2024
6a2b94e
later patch
samsonasik Nov 17, 2024
09ea82b
fix InterpolatedStringPart detection for CreateFunctionToAnonymousFun…
samsonasik Nov 17, 2024
885c461
print arrow function
samsonasik Nov 17, 2024
7ef7a74
print ArrowFunction on Carbon
samsonasik Nov 17, 2024
4264ffc
fix set orig node on nested ternary on SwitchNegatedTernaryRector
samsonasik Nov 17, 2024
5bd5688
Fix BinaryOp right origNode on CombineIfRector (part 1)
samsonasik Nov 17, 2024
59aa9eb
fix print on CombineIfRector (part 2)
samsonasik Nov 17, 2024
0ff4fcc
Fix orig node set on ChangeNestedForeachIfsToEarlyContinueRector
samsonasik Nov 17, 2024
9156f44
[ci-review] Rector Rectify
actions-user Nov 17, 2024
eb9beb7
fix set orig node on SimplifyIfReturnBoolRector
samsonasik Nov 17, 2024
a7b1e66
Add ReprintNodeVisitor, avoid add complexity to AbstractRector
samsonasik Nov 17, 2024
cd8ce7b
fix reprint boolean not on SimplifyEmptyTest
samsonasik Nov 18, 2024
8b02d76
fix right binary op
samsonasik Nov 18, 2024
da00d86
require --dev phpstan-phpunit 2 and phpstan-webmozart-assert 2
samsonasik Nov 18, 2024
45f713d
ignore instanceof phpstanAPi.class notice
samsonasik Nov 18, 2024
e9ac818
ignore instanceof phpstanApi.classConstant notice
samsonasik Nov 18, 2024
490460e
ignore assert notice in test on purpose
samsonasik Nov 18, 2024
7d8ca99
php runtime check notice
samsonasik Nov 18, 2024
150f74a
set treatPhpDocTypesAsCertain: false
samsonasik Nov 18, 2024
1195718
fix usage of ExtendedParametersAcceptor
samsonasik Nov 18, 2024
f95cb6b
ignore notice on provideMinPhpVersion()
samsonasik Nov 18, 2024
5329edb
ignore notice instanceof.alwaysTrue
samsonasik Nov 18, 2024
072ec09
fix List_ node usage on UnusedForeachValueToArrayKeysRector
samsonasik Nov 18, 2024
5e17199
ignore phpstanApi.constructor
samsonasik Nov 18, 2024
f49511a
ignore return.unusedType as follow parent signature
samsonasik Nov 18, 2024
54de06f
ignore varTag.nativeType as enforce native type
samsonasik Nov 18, 2024
e649b69
ignore phpstan notice: deadCode.unreachable as unreliable on runtime
samsonasik Nov 18, 2024
08f4ce2
fix always falsy on RemoveAlwaysElseRector
samsonasik Nov 18, 2024
3d649c4
ignore argumet.type and return.type identifier
samsonasik Nov 18, 2024
b9675eb
fix use Token as array on File value object
samsonasik Nov 18, 2024
056e4f7
fix invalid ConstantScalar type usage on ValueResolver
samsonasik Nov 18, 2024
25faec5
ignore runtime comparison
samsonasik Nov 18, 2024
5f716fc
fix empty array on TernaryToNullCoalescingRector
samsonasik Nov 18, 2024
eeaf95d
fix empty array on JsonThrowOnErrorRector
samsonasik Nov 18, 2024
77964f2
fix never null on RemoveDeadIfForeachForRector
samsonasik Nov 18, 2024
a97705b
fix useless array_values() on OverridenExistingNamesResolver
samsonasik Nov 18, 2024
aae0ceb
fix variable assign
samsonasik Nov 18, 2024
b2dc688
fix ArrayType on TypeNormalizer
samsonasik Nov 18, 2024
34b6fc1
ignore phpstanApi.varTagAssumption
samsonasik Nov 18, 2024
51b753b
fix phpdoc parse error
samsonasik Nov 18, 2024
3e655ff
fix isClassString() usage
samsonasik Nov 18, 2024
9561c96
fix phpstan notice
samsonasik Nov 18, 2024
fbbf586
fix
samsonasik Nov 18, 2024
463e699
fix intersection
samsonasik Nov 18, 2024
d017a5c
reprint fix
samsonasik Nov 18, 2024
8ec812a
fallback scope
samsonasik Nov 18, 2024
2cc5e84
fallback scope
samsonasik Nov 18, 2024
000d4c0
[ci-review] Rector Rectify
actions-user Nov 18, 2024
cc97c23
fix phpstan
samsonasik Nov 18, 2024
9df9112
fix phpstan ArrayItem
samsonasik Nov 18, 2024
6a3b56d
[ci-review] Rector Rectify
actions-user Nov 18, 2024
220134e
First step of Doctrine works: detect doctrine class from use statemen…
samsonasik Nov 18, 2024
9b148e5
fix phpstan
samsonasik Nov 18, 2024
1a13bbc
[ci-review] Rector Rectify
actions-user Nov 18, 2024
eaaf126
Fix alias object detection
samsonasik Nov 18, 2024
a9e9ac8
Fix alias object detection
samsonasik Nov 18, 2024
5cf8568
fix skip nette presenter
samsonasik Nov 18, 2024
fc095ad
no need class exists check on fqcn
samsonasik Nov 18, 2024
1fe3927
fix
samsonasik Nov 18, 2024
e79cece
fix doctrine rename on RenameClassRectorTest
samsonasik Nov 18, 2024
28f0d25
add JoinColumns stubs
samsonasik Nov 18, 2024
6f417a3
add InverseJoinColumn stubs
samsonasik Nov 18, 2024
2a2db8f
Fix named arg on NamedArgsFactory on ArrayItem
samsonasik Nov 19, 2024
327945d
[ci-review] Rector Rectify
actions-user Nov 19, 2024
475dea3
fix shortened object from use
samsonasik Nov 19, 2024
d0bd922
Fix ClassConstFetch as key on AttributeArrayNameInliner
samsonasik Nov 19, 2024
ed6dda6
[ci-review] Rector Rectify
actions-user Nov 19, 2024
e0a1763
fix numeric value in attribute
samsonasik Nov 19, 2024
5638359
fix auto import doctrine
samsonasik Nov 19, 2024
bc9fb48
handle numeric int as key
samsonasik Nov 19, 2024
a96ccbb
[ci-review] Rector Rectify
actions-user Nov 19, 2024
4bcfab4
fix CurlylistNode usage on AnnotationToAttributeRector
samsonasik Nov 19, 2024
36e081f
[ci-review] Rector Rectify
actions-user Nov 19, 2024
aab305e
fix nested attribute group apply
samsonasik Nov 19, 2024
5f537ea
Fix inline array
samsonasik Nov 19, 2024
7988603
Fix inline array
samsonasik Nov 19, 2024
d46ec57
Fix printing generic
samsonasik Nov 19, 2024
aabd0ec
fix printing generic
samsonasik Nov 19, 2024
ca76fbd
add UniqueEntity stub
samsonasik Nov 19, 2024
def3a14
fix from use statement
samsonasik Nov 19, 2024
c951fca
remove unused stub
samsonasik Nov 19, 2024
66cfc10
Fix multiline values
samsonasik Nov 19, 2024
c32240b
Fix multiline values
samsonasik Nov 19, 2024
4664f2c
fix phpstan
samsonasik Nov 19, 2024
893dc6b
fix requirement as php 7.4
samsonasik Nov 19, 2024
d80c190
fix process single quoted
samsonasik Nov 19, 2024
a5ab32d
[ci-review] Rector Rectify
actions-user Nov 19, 2024
befc5a2
fix multi line
samsonasik Nov 19, 2024
b4ac2a8
fix with description
samsonasik Nov 19, 2024
f9d271f
use php 7.4 for linter
samsonasik Nov 19, 2024
9506b7e
temporary update fixture to avoid crash single quote, due to phpstan-…
samsonasik Nov 19, 2024
9de17e1
finally, unit test green
samsonasik Nov 19, 2024
4314e37
Coalesce print
samsonasik Nov 19, 2024
1d9295a
fix interpolat print
samsonasik Nov 19, 2024
93ad16c
[ci-review] Rector Rectify
actions-user Nov 19, 2024
b5a6e92
patch ArrayItem usge on NodeFactory::createArgs()
samsonasik Nov 19, 2024
f630f24
doc indent check
samsonasik Nov 19, 2024
43b15d6
handle doc indentation
samsonasik Nov 19, 2024
15bc0ef
[ci-review] Rector Rectify
actions-user Nov 19, 2024
d637a6e
require-dev phpstan/phpstan-deprecation-rules and fix deprecated meth…
samsonasik Nov 20, 2024
dae49ff
fix variable on full_build.sh
samsonasik Nov 20, 2024
ae01c9f
fix phsptan message return
samsonasik Nov 20, 2024
d4792f4
Conditionally to not require rector/rector-src on PR 6431 for packag…
samsonasik Nov 20, 2024
0b05d10
final touch: enable return.type identifier phpstan
samsonasik Nov 20, 2024
eaf9b37
really final touch: comment
samsonasik Nov 20, 2024
26a2cbb
final touch: clean up always true check
samsonasik Nov 20, 2024
a8aff4c
final touch: clean up ignore config
samsonasik Nov 20, 2024
346c55c
really really final touch: clean up staticMethod.alreadyNarrowedType …
samsonasik Nov 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .github/workflows/build_scoped_rector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ jobs:
# 3. prefix classes
- run: sh build/build-rector-scoped.sh rector-build rector-prefixed-downgraded

# 4. lint the code for PHP 7.2 - this must happen here, as setup-php allows only one PHP version switch: https://github.com/shivammathur/setup-php/issues/434
# 4. lint the code for PHP 7.4 - this must happen here, as setup-php allows only one PHP version switch: https://github.com/shivammathur/setup-php/issues/434
-
uses: shivammathur/setup-php@v2
with:
php-version: 7.2
php-version: 7.4
coverage: none
- run: composer global require php-parallel-lint/php-parallel-lint --ansi
- run: /home/runner/.composer/vendor/bin/parallel-lint rector-prefixed-downgraded --exclude rector-prefixed-downgraded/stubs --exclude rector-prefixed-downgraded/vendor/tracy/tracy/examples --exclude rector-prefixed-downgraded/vendor/rector/rector-generator/templates --exclude rector-prefixed-downgraded/vendor/symfony/console/Debug/CliRequest.php
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/code_analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:

-
name: 'PHPStan'
run: vendor/bin/phpstan analyse --ansi --error-format symplify
run: vendor/bin/phpstan analyse --ansi

-
name: 'Commented Code'
Expand Down
17 changes: 13 additions & 4 deletions .github/workflows/packages_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,19 @@ jobs:

- run: composer config minimum-stability dev

# test with current commit in a pull-request
-
run: composer require rector/rector-src dev-main#${{github.event.pull_request.head.sha}} --no-update
if: ${{ github.event_name == 'pull_request' }}
# temporary for PR 6431 as rector/rector-* packages already require this PR branch
# so avoid pointed to rector-src main branch composer.json
- name: Conditionally to not require rector/rector-src on PR 6431
if: ${{ github.event_name == 'pull_request' }}
run: |
if [ "${{ github.event.pull_request.number }}" != "6431" ]; then
composer require rector/rector-src dev-main#${{ github.event.pull_request.head.sha }} --no-update
fi

# # test with current commit in a pull-request
# -
# run: composer require rector/rector-src dev-main#${{github.event.pull_request.head.sha}} --no-update
# if: ${{ github.event_name == 'pull_request' }}

- run: composer install --ansi

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Head to [`rectorphp/rector`](http://github.com/rectorphp/rector) for documentati

## Building `rectorphp/rector`

Code of this repository requires PHP 8. For `rector/rector` package the build downgrades code to PHP 7.2+.
Code of this repository requires PHP 8. For `rector/rector` package the build downgrades code to PHP 7.4+.

<br>

Expand Down
27 changes: 27 additions & 0 deletions build/build-preload.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ final class PreloadBuilder
'TokenEmulator.php',
'KeywordEmulator.php',
'Comment.php',
'PrettyPrinter.php',
'PrettyPrinterAbstract.php',
'Parser.php',
'ParserAbstract.php',
Expand Down Expand Up @@ -104,6 +105,21 @@ final class PreloadBuilder
'TypeNode.php',
];

/**
* The classes are deprecated and moved under Node
*
* @var string[]
*/
private const IN_USE_CLASS_FILES = [
'Node/Expr/ArrayItem.php',
'Node/Expr/ClosureUse.php',
'Node/Scalar/EncapsedStringPart.php',
'Node/Scalar/LNumber.php',
'Node/Stmt/DeclareDeclare.php',
'Node/Stmt/PropertyProperty.php',
'Node/Stmt/StaticVar.php',
];

public function buildPreloadScript(string $buildDirectory, string $preloadFile): void
{
$this->buildPreloadScriptPhpParser($buildDirectory, $preloadFile);
Expand Down Expand Up @@ -315,6 +331,17 @@ private function findPhpParserFilesAndSortThem(string $vendorDir): array
// 2. put first-class usages first
$fileInfos = $this->sortFileInfos($fileInfos);

foreach ($fileInfos as $key => $fileInfo) {
foreach (self::IN_USE_CLASS_FILES as $inUseClassFile) {
if (str_ends_with($fileInfo->getPathname(), $inUseClassFile)) {
unset($fileInfos[$key]);
continue 2;
}
}
}

$fileInfos = array_values($fileInfos);

$stmtsAwareInterface = new SplFileInfo(__DIR__ . '/../src/Contract/PhpParser/Node/StmtsAwareInterface.php');
array_splice($fileInfos, 1, 0, [$stmtsAwareInterface]);

Expand Down
2 changes: 1 addition & 1 deletion build/config/config-downgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
return RectorConfig::configure()
->withSkip(DowngradeRectorConfig::DEPENDENCY_EXCLUDE_PATHS)
->withPHPStanConfigs([__DIR__ . '/phpstan-for-downgrade.neon'])
->withDowngradeSets(php72: true);
->withDowngradeSets(php74: true);

/**
* Configuration consts for the different rector.php config files
Expand Down
4 changes: 0 additions & 4 deletions build/config/phpstan-for-downgrade.neon
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,3 @@ parameters:
scanDirectories:
# this is needed for symfony/dependendency-injection as it has hidden dependency on symfony/expression-language that we don't use here
- ../../stubs

# see https://github.com/rectorphp/rector/issues/3490#issue-634342324
featureToggles:
disableRuntimeReflectionProvider: true
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php_version: ['7.2', '7.3', '7.4', '8.0', '8.1']
php_version: ['7.4', '8.0', '8.1']
commands:
-
name: 'Composer Dependency'
Expand Down
2 changes: 1 addition & 1 deletion build/target-repository/.github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php_version: ['7.2', '7.3', '7.4', '8.0', '8.1']
php_version: ['7.4', '8.0', '8.1']
directory:
- 'e2e/define-constant'
- 'e2e/dont-execute-code'
Expand Down
2 changes: 1 addition & 1 deletion build/target-repository/.github/workflows/e2e_diff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php_version: ['7.2', '7.3', '7.4', '8.0', '8.1']
php_version: ['7.4', '8.0', '8.1']
directory:
- 'e2e/attributes'

Expand Down
2 changes: 1 addition & 1 deletion build/target-repository/.github/workflows/e2e_global.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php_version: ['7.2', '7.3', '7.4', '8.0', '8.1']
php_version: ['7.4', '8.0', '8.1']
directory:
- 'e2e/global-install'

Expand Down
31 changes: 0 additions & 31 deletions build/target-repository/.github/workflows/e2e_php72.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php_version: ['7.3']
php_version: ['7.4']
directory:
- 'e2e/rector-prefixed-rule-test'

Expand Down
4 changes: 2 additions & 2 deletions build/target-repository/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"bin/rector"
],
"require": {
"php": "^7.2|^8.0",
"phpstan/phpstan": "^1.12.5"
"php": "^7.4|^8.0",
"phpstan/phpstan": "^2.0.1"
},
"autoload": {
"files": [
Expand Down
11 changes: 0 additions & 11 deletions build/target-repository/e2e/reflection-union-php72/composer.json

This file was deleted.

17 changes: 0 additions & 17 deletions build/target-repository/e2e/reflection-union-php72/rector.php

This file was deleted.

14 changes: 0 additions & 14 deletions build/target-repository/e2e/reflection-union-php72/src/foo.php

This file was deleted.

50 changes: 23 additions & 27 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
"doctrine/inflector": "^2.0.10",
"illuminate/container": "^11.25",
"nette/utils": "^4.0",
"nikic/php-parser": "^4.19.4",
"nikic/php-parser": "^5.3.1",
"ocramius/package-versions": "^2.9",
"ondram/ci-detector": "^4.2",
"phpstan/phpdoc-parser": "^1.32",
"phpstan/phpstan": "^1.12.5",
"phpstan/phpdoc-parser": "^2.0",
"phpstan/phpstan": "^2.0.1",
"react/event-loop": "^1.5",
"react/promise": "^3.2",
"react/socket": "^1.15",
Expand All @@ -45,21 +45,17 @@
"require-dev": {
"php-parallel-lint/php-parallel-lint": "^1.4",
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan-deprecation-rules": "^1.2",
"phpstan/phpstan-phpunit": "^1.4",
"phpstan/phpstan-webmozart-assert": "^1.2.6",
"phpstan/phpstan-deprecation-rules": "^2.0",
"phpstan/phpstan-phpunit": "^2.0",
"phpstan/phpstan-webmozart-assert": "^2.0",
"phpunit/phpunit": "^10.5",
"rector/release-notes-generator": "^0.3.0",
"rector/swiss-knife": "^0.2.16",
"rector/type-perfect": "^1.0",
"shipmonk/composer-dependency-analyser": "^1.8",
"symplify/easy-coding-standard": "^12.3",
"symplify/phpstan-extensions": "^11.4",
"symplify/phpstan-rules": "^13.0",
"symplify/rule-doc-generator": "^12.2.5",
"symplify/vendor-patches": "^11.3",
"tomasvotruba/class-leak": "^1.1.2",
"tomasvotruba/unused-public": "^1.0",
"tracy/tracy": "^2.9"
},
"replace": {
Expand Down Expand Up @@ -111,7 +107,7 @@
],
"check-cs": "vendor/bin/ecs check --ansi",
"fix-cs": "vendor/bin/ecs check --fix --ansi",
"phpstan": "vendor/bin/phpstan analyse --ansi --error-format symplify --memory-limit=512M",
"phpstan": "vendor/bin/phpstan analyse --ansi --memory-limit=512M",
"docs": "vendor/bin/rule-doc-generator validate rules",
"rector": "bin/rector process --ansi",
"preload": "php build/build-preload.php .",
Expand All @@ -126,22 +122,22 @@
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/illuminate-container-container-php.patch"
],
"nikic/php-parser": [
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-expr-closure-php.patch",
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-finally-php.patch",
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-function-php.patch",
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-do-php.patch",
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-catch-php.patch",
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-trycatch-php.patch",
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-for-php.patch",
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-classmethod-php.patch",
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-else-php.patch",
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-while-php.patch",
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-foreach-php.patch",
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-if-php.patch",
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-case-php.patch",
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-elseif-php.patch",
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-node-stmt-namespace-php.patch",
"https://raw.githubusercontent.com/rectorphp/vendor-patches/main/patches/nikic-php-parser-lib-phpparser-nodetraverser-php.patch"
"https://raw.githubusercontent.com/rectorphp/vendor-patches/php-parser-5-latest/patches/nikic-php-parser-lib-phpparser-node-expr-closure-php.patch",
"https://raw.githubusercontent.com/rectorphp/vendor-patches/php-parser-5-latest/patches/nikic-php-parser-lib-phpparser-node-stmt-finally-php.patch",
"https://raw.githubusercontent.com/rectorphp/vendor-patches/php-parser-5-latest/patches/nikic-php-parser-lib-phpparser-node-stmt-function-php.patch",
"https://raw.githubusercontent.com/rectorphp/vendor-patches/php-parser-5-latest/patches/nikic-php-parser-lib-phpparser-node-stmt-do-php.patch",
"https://raw.githubusercontent.com/rectorphp/vendor-patches/php-parser-5-latest/patches/nikic-php-parser-lib-phpparser-node-stmt-catch-php.patch",
"https://raw.githubusercontent.com/rectorphp/vendor-patches/php-parser-5-latest/patches/nikic-php-parser-lib-phpparser-node-stmt-trycatch-php.patch",
"https://raw.githubusercontent.com/rectorphp/vendor-patches/php-parser-5-latest/patches/nikic-php-parser-lib-phpparser-node-stmt-for-php.patch",
"https://raw.githubusercontent.com/rectorphp/vendor-patches/php-parser-5-latest/patches/nikic-php-parser-lib-phpparser-node-stmt-classmethod-php.patch",
"https://raw.githubusercontent.com/rectorphp/vendor-patches/php-parser-5-latest/patches/nikic-php-parser-lib-phpparser-node-stmt-else-php.patch",
"https://raw.githubusercontent.com/rectorphp/vendor-patches/php-parser-5-latest/patches/nikic-php-parser-lib-phpparser-node-stmt-while-php.patch",
"https://raw.githubusercontent.com/rectorphp/vendor-patches/php-parser-5-latest/patches/nikic-php-parser-lib-phpparser-node-stmt-foreach-php.patch",
"https://raw.githubusercontent.com/rectorphp/vendor-patches/php-parser-5-latest/patches/nikic-php-parser-lib-phpparser-node-stmt-if-php.patch",
"https://raw.githubusercontent.com/rectorphp/vendor-patches/php-parser-5-latest/patches/nikic-php-parser-lib-phpparser-node-stmt-case-php.patch",
"https://raw.githubusercontent.com/rectorphp/vendor-patches/php-parser-5-latest/patches/nikic-php-parser-lib-phpparser-node-stmt-elseif-php.patch",
"https://raw.githubusercontent.com/rectorphp/vendor-patches/php-parser-5-latest/patches/nikic-php-parser-lib-phpparser-node-stmt-namespace-php.patch",
"https://raw.githubusercontent.com/rectorphp/vendor-patches/php-parser-5-latest/patches/nikic-php-parser-lib-phpparser-nodetraverser-php.patch"
]
},
"composer-exit-on-patch-failure": true,
Expand Down
1 change: 0 additions & 1 deletion config/phpstan/parser.neon
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,4 @@ services:
class: PHPStan\Parser\RichParser
arguments:
parser: @currentPhpVersionPhpParser
lexer: @currentPhpVersionLexer
autowired: no
6 changes: 0 additions & 6 deletions config/phpstan/static-reflection.neon
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
parameters:
# see https://github.com/rectorphp/rector/issues/3490#issue-634342324
featureToggles:
disableRuntimeReflectionProvider: false
nodeConnectingVisitorCompatibility: false

services:
- Rector\NodeTypeResolver\Reflection\BetterReflection\RectorBetterReflectionSourceLocatorFactory
- Rector\NodeTypeResolver\Reflection\BetterReflection\SourceLocator\IntermediateSourceLocator
Expand Down
10 changes: 5 additions & 5 deletions full_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# usage:
#
# export PHP72_BIN_PATH=/opt/local/bin/php72 && sh ./full_build.sh
# export PHP74_BIN_PATH=/opt/local/bin/php74 && sh ./full_build.sh

# see https://stackoverflow.com/questions/66644233/how-to-propagate-colors-from-bash-script-to-github-action?noredirect=1#comment117811853_66644233
export TERM=xterm-color
Expand Down Expand Up @@ -37,14 +37,14 @@ php -d memory_limit=-1 bin/rector process rector-build/bin rector-build/config r

sh build/build-rector-scoped.sh rector-build rector-prefixed-downgraded

# verify syntax valid in php 7.2
# verify syntax valid in php 7.4
composer global require php-parallel-lint/php-parallel-lint

if test -z ${PHP72_BIN_PATH+y}; then
if test -z ${PHP74_BIN_PATH+y}; then
~/.config/composer/vendor/bin/parallel-lint rector-prefixed-downgraded --exclude rector-prefixed-downgraded/stubs --exclude rector-prefixed-downgraded/vendor/tracy/tracy/examples --exclude rector-prefixed-downgraded/vendor/rector/rector-generator/templates --exclude rector-prefixed-downgraded/vendor/symfony/console/Debug/CliRequest.php
else
echo "verify syntax valid in php 7.2 with specify PHP72_BIN_PATH env";
$PHP72_BIN_PATH ~/.composer/vendor/bin/parallel-lint rector-prefixed-downgraded --exclude rector-prefixed-downgraded/stubs --exclude rector-prefixed-downgraded/vendor/tracy/tracy/examples --exclude rector-prefixed-downgraded/vendor/rector/rector-generator/templates --exclude rector-prefixed-downgraded/vendor/symfony/console/Debug/CliRequest.php
echo "verify syntax valid in php 7.4 with specify PHP74_BIN_PATH env";
$PHP74_BIN_PATH ~/.composer/vendor/bin/parallel-lint rector-prefixed-downgraded --exclude rector-prefixed-downgraded/stubs --exclude rector-prefixed-downgraded/vendor/tracy/tracy/examples --exclude rector-prefixed-downgraded/vendor/rector/rector-generator/templates --exclude rector-prefixed-downgraded/vendor/symfony/console/Debug/CliRequest.php
fi

# rollback, done testing succeed
Expand Down
Loading