1661 Commits

Author SHA1 Message Date
Tomas Votruba
afdf5839e7
[testing] change provideConfigFileInfo() to provideConfigFilePath() (#5518) 2021-02-12 19:19:40 +01:00
Tomas Votruba
fb1bf1f554
[Privatization] Skip on open-source abstract (#5516) 2021-02-12 02:02:28 +01:00
Abdul Malik Ikhsan
8d97bdc3c5
[DeadCode] Skip RemoveUnusedConstructorParamRector on interface and abstract method (#5515) 2021-02-12 01:34:10 +01:00
Tomas Votruba
1586fa7899
[Privatization] Skip privatization in abstract only on open-source type (#5514) 2021-02-11 22:24:40 +00:00
Tomas Votruba
4735479369
[PHP 5.5] Skip StringClassNameToClassConstantRector for is_a() checks (#5512) 2021-02-11 17:24:08 +00:00
Abdul Malik Ikhsan
9c57f47fa0
[CodeQualityStrict] Handle space in variable new name and assign in if cond at MoveOutMethodCallInsideIfConditionRector (#5509) 2021-02-11 17:47:29 +01:00
Tomas Votruba
82208c0730
[DeadCode] Fix RemoveUnusedPrivatePropertyRector in foreach (#5507)
Co-authored-by: Oliver Nybroe <oliver@worksome.com>
2021-02-11 15:01:41 +00:00
Tomas Votruba
65dfaca287
[Privatization] Add test case to verify property privatization (#5508) 2021-02-11 15:00:43 +00:00
TomasVotruba
fadfdbb4ef remove duplicated class 2021-02-11 13:11:16 +01:00
TomasVotruba
6bf6ced426 allow the test case class too 2021-02-11 13:08:17 +01:00
Tomas Votruba
63ea75cbf5
[testing] Add update tests feature to AbstractCommunityRectorTestCase (#5504) 2021-02-11 11:46:54 +00:00
TomasVotruba
45caffd591 use string for class that might be missing 2021-02-10 19:56:50 +01:00
Tomas Votruba
09af0bd66e
[Transform] Add CommunityTestCaseRector (#5497) 2021-02-10 18:34:06 +00:00
Abdul Malik Ikhsan
8d5706d5ac
[DeadCode] Skip RemoveUnusedClassesRector on class has children (#5498)
Co-authored-by: Tomas Norre Mikkelsen <tomas.mikkelsen@aoe.com>
2021-02-10 19:29:00 +01:00
Abdul Malik Ikhsan
99e5d0a210
[Renaming] Handle RenameMethodRector on new in caller class (#5493)
Co-authored-by: Ruud Kamphuis <ruudk@users.noreply.github.com>
2021-02-10 16:21:14 +01:00
Tomas Votruba
346bacfe19
[Tests] Split main test case and community test case (#5481)
Co-authored-by: kaizen-ci <info@kaizen-ci.org>
2021-02-10 11:57:25 +00:00
Tomas Votruba
69d5980d1d
simplify EnabledRectorsProvider (#5486)
Co-authored-by: kaizen-ci <info@kaizen-ci.org>
2021-02-09 23:54:08 +00:00
Tomas Votruba
560b720b83
[DependencyInjectoin] Add ActionInjectionToConstructorInjectionRector (#5485) 2021-02-09 22:57:20 +00:00
Tomas Votruba
7a3f5a8c0a
remove unused RectorClassesProvider (#5482)
* remove unused RectorClassesProvider

* README: remove ci-checkstyle link, marginal topic, to avoid confusion for first readers
2021-02-09 22:43:04 +00:00
Abdul Malik Ikhsan
6a6ac8332b
[EarlyReturn] Rename ChangeAndIfContinueToMultiContinueRector to ChangeOrIfContinueToMultiContinueRector (#5483)
* [EarlyReturn] Register ChangeAndIfContinueToMultiContinueRector to early-return config set

* try with clone $if

* [EarlyReturn] Rename ChangeAndIfContinueToMultiContinueRector to ChangeOrIfContinueToMultiContinueRector

* re-register

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

* reduce complexity

* [ci-review] Rector Rectify

Co-authored-by: kaizen-ci <info@kaizen-ci.org>
2021-02-09 22:52:57 +01:00
Tomas Votruba
b9f5fe2f3d
[CI] Add PHP 8.0 php linter (#5479) 2021-02-09 21:32:17 +01:00
Abdul Malik Ikhsan
6b8789eeca
[EarlyReturn] Add ChangeAndIfContinueToMultiContinueRector (#5460)
* [EarlyReturn] [WIP] Fixes #5230 Add ChangeAndIfContinueToContinueEarlyRector

* skip multi stmts

* skip not continue

* skip not and

* functional

* cs fix

* negated check

* not identical

* reduce repetitive method

* comment test

* comment fixture

* reduce complexity

* cs fix

* [ci-review] Rector Rectify

* using isIfWithOnly()

* phpstan

* use ConditionInverter service

Co-authored-by: kaizen-ci <info@kaizen-ci.org>
2021-02-09 20:07:20 +01:00
Abdul Malik Ikhsan
1a9544f5f4
[DeadCode] Register RemoveDeadInstanceOfRector to dead-code config set (#5474)
* [DeadCode] Register RemoveDeadInstanceOfRector to dead-code config set

* failing fixture nullable type

* null type check

* handle child check and null check

* failing fixture with php doc type

* debug

* ensure different var

* fix

* fixture rename

* skip assign as may has side effect

* Param check

* clean up

* clean up

* final touch

* final touch

* fix

* fix

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

Co-authored-by: kaizen-ci <info@kaizen-ci.org>
2021-02-09 20:04:20 +01:00
Tomas Votruba
ecbef2bcaa
[Tests] remove getPhpVersion() helped method, use configs instead (#5477) 2021-02-09 17:25:16 +00:00
Tomas Votruba
e822db8625
moving ArrayPartPhpDocTagPrinterTrait and PrintTagValueNodeTrait to services (#5473) 2021-02-09 14:17:25 +00:00
Tomas Votruba
e0ad0f960f
[Tests] Move from getRectorsWithConfiguration() to provideConfigFileInfo() to make test configs more intuitive (#5468)
Co-authored-by: kaizen-ci <info@kaizen-ci.org>
2021-02-09 15:02:29 +01:00
Abdul Malik Ikhsan
31ceccc571
[DeadCode] Add RemoveDeadInstanceOfRector (#5470)
* [DeadCode] [WIP] Fixes #5458 Add RemoveDeadInstanceOfRector

* add failing fixture

* functional for BooleanNot

* skip not instanceof

* skip no previous var

* test do not remove parent child flipped

* skip has else/elseif

* phpstan

* celan up

* clean up

* fix

* implemented use unwrapStmts()

* fixture-a
2021-02-09 14:31:11 +01:00
Ruud Kamphuis
a0e735a652
Add failing test fixture for StringifyStrNeedlesRector (#5461)
* Add failing test fixture for StringifyStrNeedlesRector

# Failing Test for StringifyStrNeedlesRector

Based on https://getrector.org/demo/d2da9632-23c3-4f71-b800-219c8871639c

It should understand that `PHP_EOL` is a constant that is always a `string`. Therefore, no need to cast it to string.

* Support UnionType in NodeTypeAnalyser
2021-02-09 14:07:00 +01:00
Tomas Votruba
9f6834c46e
[DeadCode] Add RemoveUnusedConstructorParamRector (#5467)
Co-authored-by: kaizen-ci <info@kaizen-ci.org>
2021-02-09 04:55:21 +01:00
Tomas Votruba
5e95bbb294
Remove NotifyingNodeRemover, RemovedAndAddedFilesTrait, merge traits to AbstractRector (#5466)
Co-authored-by: kaizen-ci <info@kaizen-ci.org>
2021-02-09 01:52:35 +00:00
Tomas Votruba
f3b05c714c
[PHPUnit] Improve TryCatchToExpectExceptionRector complexity (#5465)
Co-authored-by: kaizen-ci <info@kaizen-ci.org>
2021-02-09 00:42:47 +01:00
Tomas Votruba
50f6adf47e
consolidate AbstractRectorTrait (#5464)
Co-authored-by: kaizen-ci <info@kaizen-ci.org>
2021-02-08 21:00:45 +00:00
Tomas Votruba
1757e83cdc
misc, remove RemoveProjectFileRector (#5463) 2021-02-08 18:26:00 +00:00
Tomas Votruba
d7353baf2c
Misc cleanup (#5456)
Co-authored-by: kaizen-ci <info@kaizen-ci.org>
2021-02-08 12:33:17 +00:00
Tomas Votruba
e9cdf37d16
Decopule nodes docs generator (#5453)
Co-authored-by: kaizen-ci <info@kaizen-ci.org>
2021-02-08 02:04:48 +01:00
Tomas Votruba
4cb16f7406
[DeadCode] Fix RemoveSetterOnlyPropertyAndMethodCallRector for no-read, no-write expression (#5445) 2021-02-07 11:24:53 +01:00
Tomas Votruba
ccd7b3d992
Add failing test fixture for MoveVariableDeclarationNearReferenceRector (#5441)
Co-authored-by: Abdul Malik Ikhsan <samsonasik@gmail.com>
2021-02-07 11:07:59 +01:00
Tomas Votruba
0c830ab123
misc (#5439) 2021-02-06 22:20:57 +00:00
Tomas Votruba
d402f52238
[TypeDeclaratoin] Add ReturnTypeFromStrictTypedPropertyRector (#5438) 2021-02-06 23:09:45 +01:00
Abdul Malik Ikhsan
946b1ac84b
[Privatization] Register MakeOnlyUsedByChildrenProtectedRector to privatization config set (#5434)
Co-authored-by: kaizen-ci <info@kaizen-ci.org>
2021-02-06 20:41:44 +01:00
Ruud Kamphuis
ec66688a8c
Ignore special class names when using Option::AUTO_IMPORT_NAMES (#5427)
This makes sure that special class names like `self, parent, static` are not automatically imported.

Without this fix, it would return an error like:
```
PHPStan\Broker\ClassNotFoundException : Class Rector\Naming\Tests\Rector\ClassMethod\RenameVariableToMatchNewTypeRector\Fixture\AnonymousClassd69b28143ae1ad396a5d30a3fc41b247 was not found while trying to analyse it - discovering symbols is probably not configured properly.
```
2021-02-06 17:12:59 +01:00
Tomas Votruba
e4e4f73fba
[CodeQuality] Add compact override protection (#5428) 2021-02-06 14:20:09 +00:00
Abdul Malik Ikhsan
cd28fa4e3c
[Privatization] Add MakeOnlyUsedByChildrenProtectedRector (#5432)
Co-authored-by: kaizen-ci <info@kaizen-ci.org>
2021-02-06 13:44:11 +00:00
Tomas Votruba
2085291ae9
[CodeQuality] extract CompactFuncCallAnalyzer (#5425) 2021-02-05 15:15:51 +01:00
Tomas Votruba
e04d820bc5
[CodeQuality] Improve CompactToVariablesRector to cover previously defined array (#5424) 2021-02-05 12:40:28 +00:00
Abdul Malik Ikhsan
aa284fe870
[CodeQuality] Reduce ForToForeachRector complexity (#5421)
Co-authored-by: kaizen-ci <info@kaizen-ci.org>
2021-02-05 12:36:42 +01:00
Abdul Malik Ikhsan
3784552b70
[CodeQuality] Add "single" prefix for value var of Foreach on ForToForeachRector when singularize() got same name (#5419) 2021-02-04 15:11:16 +00:00
Abdul Malik Ikhsan
2c8e1ed4b9
[Symfony] Skip construct with param Property Promotion on MakeCommandLazyRector in php 8 (#5417) 2021-02-04 15:45:42 +01:00
Abdul Malik Ikhsan
51a14cc28f
[Renaming] Do not update target new namespace exists on RenameClassRector (#5416) 2021-02-03 22:30:40 +01:00
Abdul Malik Ikhsan
2ace2b4410
[EarlyReturn] Skip ChangeAndIfToEarlyReturnRector when parent if has next statement (#5415)
Co-authored-by: kaizen-ci <info@kaizen-ci.org>
2021-02-03 22:22:11 +01:00