91 Commits

Author SHA1 Message Date
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
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
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
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
09f17a7b64
[Downgrade] [PHP 8.0] Add DowngradePropertyPromotionToConstructorPropertyAssignRector (#4762)
* [Downgrade] [PHP 8.0] Add DowngradePropertyPromotionToConstructorPropertyAssignRector

* fix parent

* various fixes for PHP 8.0 tests

* [ci-review] Rector Rectify

* Update rules/downgrade-php80/tests/Rector/Class_/DowngradePropertyPromotionToConstructorPropertyAssignRector/DowngradePropertyPromotionToConstructorPropertyAssignRectorTest.php

Co-authored-by: rector-bot <tomas@getrector.org>
2020-12-03 13:27:24 +00:00
Abdul Malik Ikhsan
7dc7763585
[DeadCode] Fixes #4663 Handle RemoveEmptyMethodCallRector on parent is Assign (#4746) 2020-12-02 12:44:56 +01:00
Tomas Votruba
42dae6a86a
[DeadCode] Fix RemoveDeadConstructorRector (#4751)
* [DeadCode] Fix RemoveDeadConstructorRector

* [DeadCode] Fix RemoveUnusedParameterRector in property promotion
2020-12-02 10:38:59 +00:00
Tomas Votruba
132062acf3
[DeadCode] Fix dead method in property promotion (#4749)
* [DeadCode] Fix dead method in property promotion

* bump workflows PHP version to 7.2, to respect symplify bump

* allow non-existing attributes in tests
2020-12-02 10:15:39 +00:00
Abdul Malik Ikhsan
a38debb672
[DX] Fixes #4205 Change phpversion from string to php constant int type (#4679)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-11-24 16:32:49 +01:00
Abdul Malik Ikhsan
120e531084
[DeadCode] Fixes #4472 Remove method call on $this (#4598)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-11-13 12:14:25 +01:00
Abdul Malik Ikhsan
4764fd1ac3
[DeadCode] Fixes #4561 Skip RemoveUnusedPrivatePropertyRector removes used Parameter (#4564)
* Add test case for not removing used constructor parameter

* Fixes #4561 Closes #4563

* [ci-review] Generate Rector & Nodes documentation

* [ci-review] Apply coding standards

* phpstan

* reduce complexity

* [ci-review] Rector Rectify

Co-authored-by: Tim Siebels <siebels.tim@gmail.com>
Co-authored-by: rector-bot <tomas@getrector.org>
2020-11-08 18:22:24 +00:00
Tomas Votruba
84d2cc41d2
[DeadCode] Fix removal of class under (#4545)
* [DeadCode] Fix removal of class under

* [ci-review] Rector Rectify

Co-authored-by: rector-bot <tomas@getrector.org>
2020-11-02 19:01:31 +00:00
Tomas Votruba
0513315056
Change file system approach of MultipleClassFileToPsr4ClassesRector to file without namespace node (#4522)
* Change file system approach of MultipleClassFileToPsr4ClassesRector to file without namespace node

* update DecoupleClassMethodToOwnClassRector

* [ci] add rebase jobp

* disable fail fast for unit tests

* misc
2020-10-31 12:59:40 +00:00
Tomas Votruba
a6e85fe69a
[PHPUnit] Fix AddSeeTestAnnotationRector for same short name, but different namespace (#4488)
* [PHPUnit] Fix AddSeeTestAnnotationRector for same short name, but different namespace

* correct namespaces
2020-10-27 00:42:04 +00:00
Tomas Votruba
4f37d2ec3f
decouple ProjectType from Option (#4451) 2020-10-19 15:11:40 +00:00
Tomas Votruba
9869678e4a
[DeadCode] Fix removal of if->cond (#4450) 2020-10-19 16:38:02 +02:00
Tomas Votruba
5b37363b60
[DeadCode] Add expr-names support to RemoveEmptyMethodCallRector (#4448)
* [DeadCode] Add expr-names support to RemoveEmptyMethodCallRector

* skip abstract method
2020-10-19 13:35:37 +00:00
Tomas Votruba
c18b06b474
[DeadCode] Cover array dim fetch assign (#4446) 2020-10-19 01:46:38 +02:00
Tomas Votruba
29594b63f4
[DeadCode] Count arg value as used (#4445) 2020-10-18 23:18:04 +00:00
Abdul Malik Ikhsan
ba4ec9de09
[DeadCode] Fixes #4425 Remove empty method call (#4428)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-10-17 17:29:10 +02:00
Tomas Votruba
9f7073ada3
[NodeAnalyzer] Check property fetch for read (#4431)
* [NodeAnalyzer] Check property fetch for read

* [ReadWrite] Decopule new package for read/write/only analysis

* add property fetch
2020-10-16 20:16:36 +00:00
Tomas Votruba
245000a0ce
[DeadCode] Improve unused private property detection (#4430)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-10-16 21:29:29 +02:00
Tomas Votruba
16031da4b7
[DeadCode] Fix binary different nesting in RemoveOverriddenValuesRector (#4422)
* decopule NodeByTypeAndPositionCollector

* decouple VariableUseFinder
2020-10-15 20:23:25 +00:00
Tomas Votruba
b2c9e3b127
[DeadCode] Make RemoveUnusedPrivateConstantRector skip enum (#4419) 2020-10-15 13:04:58 +00:00
Tomas Votruba
c84690baa6
[DeadCode] Various improvements (#4417) 2020-10-15 14:15:01 +02:00
Tomas Votruba
151a83a733
[DeadCode] Remove php-doc from remove params (#4411)
* [DeadCode] Remove unused param doc too

* [DeadCode] Remove php-doc from remove parmas

* [rector] [DeadCode] Remove php-doc from remove parmas

* [cs] [DeadCode] Remove php-doc from remove parmas

Co-authored-by: rector-bot <tomas@getrector.org>
2020-10-14 23:20:02 +00:00
Tomas Votruba
e085f52f86
[DeadCode] Improve parent and current type comparison on RemoveDelegatingParentCallRector (#4409)
* decouple CurrentAndParentClassMethodComparator

* fix param reflections

* [rector] fix param reflections

* [cs] fix param reflections

* composer: bump assert

* [rector] composer: bump assert

* [cs] composer: bump assert

* static fixes

Co-authored-by: rector-bot <tomas@getrector.org>
2020-10-14 17:14:55 +00:00
Tomas Votruba
8ae3868a57
[Restoration] Add RestoreFullyQualifiedNameRector (#4336)
* [Restoration] Add RestoreFullyQualifiedNameRector

* update docs

* use service aware test case for PHPStan rules

* improve FullyQualifiedNameMatcher

* cs fixes

* add return doc resolution

* composer: bump to symfony 4.4/5.1
2020-10-01 19:45:29 +00:00
Tomas Votruba
d7f90774ee
allow php-parser 4.10 + fixes of args merge change (#4277)
* allow php-parser 4.10 + fixes of args merge change

* use fixed php-parser 4.10.1
2020-09-23 20:22:35 +00:00
Dmytro Naumenko
41d5f5567f
[TryCatch] Try/Catch with filled Finally can not be dead (#4053) 2020-08-28 23:08:45 +02:00
Tom Pavelec
36b24b2bfc
fix: swapped naming of camel and pascal cases (#4047) 2020-08-28 18:07:15 +02:00
Tomas Votruba
c1653070f5
[phpstan] Add rule for complex config (#4015)
* [phpstan] Add ForbiddenComplexArrayConfigInSetRule

* add MethodCallRename value object

* [SymfonyPhpConfig] Add array to value object configuration rule

* apply first MethodCallRename value object
2020-08-24 22:26:14 +00:00
dobryy
2e7bdca4e2
[DX] Rename namespaces respect node type (#3973) 2020-08-18 17:57:30 +02:00
Tomas Votruba
f71b242924
[Defluent] Allow DateTime to be fluent (#3947)
* ignore prefixed conflcits

* note

* skip date-time from defluencing

* drop parameter name guard, not needed anymore

* make use of addNodesAfterNode()
2020-08-12 12:32:45 +00:00
Tomas Votruba
734d11f6c9
[SOLID] Skip func calls that change variable in ChangeReadOnlyVariableWithDefaultValueToConstantRector (#3916) 2020-08-07 00:25:25 +00:00
Tomas Votruba
55acb3578a
[MagicDisclosure] Add SetterOnSetterMethodCallToStandaloneAssignRector (#3860)
* [MagicDisclosure] Add MethodCallOnSetterMethodCallToStandaloneAssignRector

* merge ChainMethodCallManipulator to ChainMethodCallNodeAnalyzer for better DX

* [MagicDisclosure] Add in arg defluent

* rebase
2020-08-01 11:41:16 +00:00
dobryy
4a025c7a2b [DeadCode] Fix variable usage detection 2020-07-22 22:37:22 +02:00
TomasVotruba
d4fb908810 [DeadCode] Skip @api in unused public constastants 2020-07-21 08:13:31 +02:00
TomasVotruba
379770495a [DeadCode] Skip property used as arg 2020-07-07 22:27:28 +02:00
TomasVotruba
69691157bd [DeadCode] Make RemoveDeadReturnRector skip arrow functions 2020-07-06 22:12:01 +02:00
TomasVotruba
a8a6e7bcad rename file to fileInfo 2020-06-30 01:45:05 +02:00
TomasVotruba
7f49658112 change test(string ) to test(SmartFileInfo ) in tests 2020-06-25 20:02:36 +02:00
Tim Ward
9ef5dc3e26 Update rules/dead-code/tests/Rector/Property/RemoveNullPropertyInitializationRector/TypedPropertiesRemoveNullPropertyInitializationRectorTest.php
Require at least php 7.4

Co-authored-by: Tomas Votruba <tomas.vot@gmail.com>
2020-06-15 11:00:25 +02:00
Tim Ward
96cfe58a5b Create TypedPropertiesRemoveNullPropertyInitializationRectorTest.php 2020-06-15 11:00:25 +02:00