208 Commits

Author SHA1 Message Date
Abdul Malik Ikhsan
f515c8e3b2
[DeadCode] Typo Fix Imlemented -> Implemented (#5336) 2021-01-27 17:01:38 +01:00
Abdul Malik Ikhsan
8767a57040
[DeadCode] Skip RemoveUnusedPublicMethodRector for all magic methods (#5311) 2021-01-25 17:51:56 +01:00
Tomas Votruba
94dedf4bb3
[PHP 7.0] Update self in final class (#5304) 2021-01-24 20:12:02 +00:00
Tomas Votruba
0dc20048ae
Cleanup too detailed order rules + add TypedPropertyFromStrictConstructorRector (#5288) 2021-01-22 18:47:02 +00:00
Tomas Votruba
87494ce3a6
Print only changed docblocks 🎉🎉🎉 (#5251) 2021-01-20 16:17:59 +00:00
Abdul Malik Ikhsan
c2c5228199
[TypeDeclaration] Improve FlipTypeControlToUseExclusiveTypeRector : add Nullable support for Assign expr (#5254)
Co-authored-by: rector-bot <tomas@getrector.org>
2021-01-20 11:41:35 +00:00
Abdul Malik Ikhsan
d5fc2cb8f5
[DeadCode] Skip RemoveUnusedPublicMethodRector on __construct (#5258)
* Add failing test fixture for RemoveUnusedPublicMethodRector

# Failing Test for RemoveUnusedPublicMethodRector

Based on https://getrector.org/demo/48213d30-8e42-4f9f-885b-30906a78970f

#5256

* Close #5257 Fixes #5256

Co-authored-by: Jan Lohage <j2L4e@users.noreply.github.com>
2021-01-20 12:19:11 +01:00
Tomas Votruba
05356b393a
Getting rid of attribute (#5246)
Co-authored-by: rector-bot <tomas@getrector.org>
2021-01-19 22:32:28 +01:00
Tomas Votruba
4b7f6f4a72
use PhpDocTagRemoer as a service (#5242)
Co-authored-by: rector-bot <tomas@getrector.org>
2021-01-19 19:45:30 +00:00
Tomas Votruba
66d0b61a9d
[Comments] Decouple new package (#5239)
* [Comments] Decopule new package

* fix RemoveNonExistingVarAnnotationRector

* decopule PropertyFetchFinder

* misc

* fix fixed printer

* fix import

* remove dead code

* fix comparing nodes with tokens instead of identical compare

* remove complexity

* decouple IndentCharacterDetector

* [ci-review] Rector Rectify

Co-authored-by: rector-bot <tomas@getrector.org>
2021-01-19 19:11:10 +00:00
Tomas Votruba
133322cc65
cherry pick (#5238)
* misc

* decopule DocBlockManipulator misc

* make use static instnaceof

* add markAsChanged() to PhpDocInfo

* decopule DocBlockTagReplacer

* change static annotation naming to service

* misc
2021-01-19 15:03:26 +00:00
Abdul Malik Ikhsan
6b196a96ea
[TypeDeclaration] Register FlipTypeControlToUseExclusiveTypeRector to type-declaration set (#5223)
Co-authored-by: rector-bot <tomas@getrector.org>
Co-authored-by: Tomas Votruba <tomas.vot@gmail.com>
2021-01-19 12:24:48 +01:00
Tomas Votruba
bbe758ab60
phpdoc info refactor part 4 (#5231)
* remove useless docblocks

* misc

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

Co-authored-by: rector-bot <tomas@getrector.org>
2021-01-19 01:15:32 +00:00
Tomas Votruba
ad9448018c
[PhpDocInfo Decouple] Use php doc info from factories, not from attribute (#5229)
* use single method to create docs

* use phpDocInfoFactory instead of getAttribte php doc info in Rectors

* move callig to phpDocInfoFactory

* misc
2021-01-18 21:45:13 +00:00
Tomas Votruba
a7550337f0
Add promoted property in PHP 8.0, when adding a ctor dependency (#5222)
* add PHP 8.0 test

* Add promoted property adding in constructor injection on PHP 8

* update tests to use propert promotion

* fix promoted property adding

* decopule Doctrine registry to manager

* shorter naming

* fix parent ctor completion

* nette promotion fixes

* fixes

* fix property inject

* misc

* misc
2021-01-18 13:09:48 +00:00
Tomas Votruba
cfbe014d67
[PHP 7.3] Fix stirng retype on intersections (#5216)
* [PHP 7.3] Fix stirng retype on intersections

* remove unneeded command layer for showing not enough args

* make sure there is application

* misc
2021-01-17 23:39:13 +00:00
TomasVotruba
5f975f48f6 [DeadCode] Skip unused class constant in case of api on class 2021-01-17 20:30:11 +01:00
Tomas Votruba
ea1f7bd758
Lower class complexity (#5208)
Co-authored-by: rector-bot <tomas@getrector.org>
2021-01-17 15:43:47 +00:00
Tomas Votruba
024a97d019
[RemovingStatic] Decouple static (#5207)
Co-authored-by: rector-bot <tomas@getrector.org>
2021-01-16 22:45:18 +01:00
Tomas Votruba
c0105bde25
Change maximal Rector complexity to 35 to avoid hard coupling to Rector classes (#5206)
* complexity

* decopule GetSubscriberEventsClassMethodFactory and ListenerServiceDefinitionProvider

* decopule UnusedParameterResolver, AssertMethodCallFactory, PropertyFetchWithVariableReplacer

* decopule ParamAndArgFromArrayResolver

* decopule JsonArrayFactory and JsonEncodeStaticCallFactory

* [ci-review] Rector Rectify

Co-authored-by: rector-bot <tomas@getrector.org>
2021-01-16 19:11:11 +00:00
Tomas Votruba
04db98620a
Refactor composer modifier to ComposerRector (#5198) 2021-01-16 13:23:37 +01:00
Abdul Malik Ikhsan
ac677c9f3e
[DeadCode] Add RemoveDeadConditionAboveReturnRector (#5194)
* [DeadCode][WIP] Fixes #4925 Add RemoveDeadConditionAboveReturnRector

* apply

* functional

* skip prev not if

* skip prev has elseif

* skip prev has else

* skip prev has multi stmt

* skip prev not return

* skip prev different return

* cs fix

* class name fixture fix

* skip prev empty stmt

* remove prev empty stmt

* add different cond
2021-01-15 20:16:44 +01:00
Jan Lohage
deafb51503
(fix) RemoveDoubleAssignRector: properly skip if the assigned expression is a call (#5191) 2021-01-15 16:13:02 +01:00
Abdul Malik Ikhsan
8a739f2ce6
[DeadCode] Failing fixture remove unused variable assign in expr (#5165)
* [DeadCode] Failing fixture remove unused variable assign in expr

* Fix #5152

* fixture namespace fix-a

* cs fix

* ensure type of expr is one of FuncCall,MethodCall,StaticCall,NullsafeMethodCall,or New_

* fixture skip multi args

* phpstan

* skip in expr
2021-01-14 11:07:38 +01:00
Abdul Malik Ikhsan
0ba497eb71
[DeadCode] Skip when $this->isOpenSourceProjectType() on RemoveUnusedPublicMethodRector (#5155)
* [DeadCode] Skip when $this->isOpenSourceProjectType() on RemoveUnusedPublicMethodRector

* add open source type test
2021-01-12 15:36:13 +01:00
Tomas Votruba
b604e1676c
[Privatization] Add ReplaceStringWithClassConstantRector (#5156)
* [Privatization] Add ReplaceStringWithClassConstantRector

* README: add to scoped
2021-01-12 13:41:47 +00:00
Abdul Malik Ikhsan
9b08d3a924
[DeadCode] Add RemoveUnusedPublicMethodRector (#5151)
* [DeadCode] [WIP] Fixes #3107 Add RemoveUnusedPublicMethodRector

* example

* add failing test

* basic

* use findCallsByClassMethod

* functional

* cs fix

* fix

* failing with place unused method later

* debug

* debug

* getting class name by method call

* checking method call name compare

* works

* check used outside class

* check used outside class

* check used outside class

* clean up

* move up method

* phpstan

* fixture for dependency injection
2021-01-12 12:43:13 +01:00
Tomas Votruba
20588b78a0
[DeadCode] Remove right part of unused assign (#5135) 2021-01-10 19:13:28 +00:00
Tomas Votruba
074298d35c
static fixes (#5127)
* static fixes

* fix remove class rule for tests
2021-01-10 11:01:40 +00:00
TomasVotruba
6c740e6df0 remove unused class as file 2021-01-09 15:27:24 +01:00
Tomas Votruba
bd62164c85
[DeadCode] Skip if the methods have api annotation (#5115)
* [DeadCode] Skip if the methods have api annotation

* [ci-review] Rector Rectify

Co-authored-by: rector-bot <tomas@getrector.org>
2021-01-08 20:15:44 +01:00
Tomas Votruba
2872eb095d
[DeadCode] Skip if the methods have api annotation (#5114) 2021-01-08 16:44:27 +00:00
Tomas Votruba
27f2fad0c0
[DeadCode] Fix removing native interface (#5113)
* [Restoratoin] Skip native interface from removing

* move RemoveUselessJustForSakeInterfaceRector to dead code category

* remove interface name pattern

* [ci-review] Rector Rectify

Co-authored-by: rector-bot <tomas@getrector.org>
2021-01-08 14:34:54 +00:00
Abdul Malik Ikhsan
b944ee7274
[DeadCode] Failing fixture do not remove variable on comment exists after definition (#5105)
* [DeadCode] Failing fixture do not remove variable on comment exists after definition

* Fixes #5105

* fixture fix
2021-01-07 19:26:15 +01:00
Abdul Malik Ikhsan
ae1e74a89d
[DeadCode] Failing fixture for not removing method parameter used on RemoveUnusedPrivatePropertyRector (#5095)
* [DeadCode] Failing fixture for not removing method parameter used on RemoveUnusedPrivatePropertyRector

* Fixes #5088

* return type

* fixture rename

* use findFirstParentInstanceOf as it may inside another, eg: assign

* phpstan

* clean up

* clean up

* skip construct

* instanceof New_ check

* fix

* final touch

* identifier check

* reduce complexity

* use toString()

* final touch

* php 7.3 syntax
2021-01-06 01:28:51 +00:00
Abdul Malik Ikhsan
1ddaf53bee
[DeadCode] Skip RemoveUnusedPrivatePropertyRector on isset as well (#5085)
* handle isset as well

* method name

* handle under isset

* fix fixture
2021-01-04 18:35:33 +01:00
Abdul Malik Ikhsan
e1c89d17f6
[fixtures] Enable validate-fixture-skip-naming check (#5081)
* [fixtures] Enable validate-fixture-skip-naming check

* full path vendor vendor/symplify/easy-testing/bin/easy-testing validate-fixture-skip-naming rules tests

* 21 files

* more fixture

* various fix

* various fix

* more fixtures

* apply to packages rules tests utils

* more fixtures

* more fixtures

* more fixtures

* more fixtures

* more fixtures

* more fixtures

* more fixtures

* fixture fix

* done

* fixture fix
2021-01-04 14:18:27 +01:00
Abdul Malik Ikhsan
625e3026ff
[DeadCode] Skip RemoveUnusedPrivatePropertyRector on property fetch in unset (#5084)
* [DeadCode] Fixes #5076 Skip RemoveUnusedPrivatePropertyRector on property fetch in unset

* fixture

* phpstan
2021-01-04 14:08:59 +01:00
Tomas Votruba
e081d8e22c
[DeadCode] Check for child constant usages too (#5077) 2021-01-03 10:44:22 +00:00
Tomas Votruba
c7140076ec
use clone const (#5029) 2020-12-28 23:38:05 +00:00
TomasVotruba
f49c14618a clean 2020-12-27 02:45:00 +01:00
Tomas Votruba
28a02fbfcd
Add failing test fixture for RemoveCodeAfterReturnRector
# Failing Test for RemoveCodeAfterReturnRector

Based on https://getrector.org/demo/efb7f3ed-e28a-4f31-b83f-50adfb17d309
2020-12-27 02:39:11 +01:00
Tomas Votruba
bfcdd22a7c
[Privatization] Move FinalizeClassesWithoutChildrenRector here (#4986) 2020-12-25 14:59:14 +01:00
Tomas Votruba
cffd7ea0ac
[CodingStyle] Move PHPStormVarAnnotationRector (#4985)
* [CodingStyle] Move PHPStormVarAnnotationRector

* [ci-review] Rector Rectify

* [DeadDocBlock] Move RemoveNonExistingVarAnnotationRector here (#4984)

* [DeadDocBlock] Move RemoveNonExistingVarAnnotationRector here

* [ci-review] Rector Rectify

Co-authored-by: rector-bot <tomas@getrector.org>

* [ci-review] Rector Rectify

* cleanup docs

* static fixes

* [ci-review] Rector Rectify

* remove duplicated

* multi use case

* misc

* [ci-review] Rector Rectify

* fixes

* remove order set, slow

* move UseMessageVariableForSprintfInSymfonyStyleRector from solid set to coding-style

* make unique-named variables to prevent accidental override and improve readability

Co-authored-by: rector-bot <tomas@getrector.org>
2020-12-25 13:20:13 +00:00
Abdul Malik Ikhsan
ec5daad132
[Util] Add StaticInstanceOf (#4979)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-12-25 12:53:26 +01:00
Tomas Votruba
d465ec83e2
[DeadCode] Move RecastingRemovalRector from PHPStan set (#4983)
* [DeadCode] Move RecastingRemovalRector from PHPStan set

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

Co-authored-by: rector-bot <tomas@getrector.org>
2020-12-25 00:22:45 +00:00
Abdul Malik Ikhsan
ca0b4cfdc7
[EarlyReturn] Register ChangeOrIfReturnToEarlyReturnRector to early-return set (#4975)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-12-24 17:28:56 +01:00
Abdul Malik Ikhsan
24e17588c1
[Utils] Run validate-fixture-namespace/classname to rules/ directories (#4935) 2020-12-22 18:12:20 +01:00
Abdul Malik Ikhsan
8a39d6edbd
[DeadCode] Skip RemoveEmptyClassMethodRector on final method in non-final class (#4943) 2020-12-22 18:09:51 +01:00
Tomas Votruba
a759f1ffbc
Static fixes 3 (#4930)
* cleanpu baseline

* static fixes

* staitc fixes

* [Naming] Remove dead classes UnderscoreCamelCaseParamRenamer and MatchTypeParamRenamer

* static fixes

* value object fixes

* [ci-review] Rector Rectify

Co-authored-by: rector-bot <tomas@getrector.org>
2020-12-21 02:12:42 +00:00