134 Commits

Author SHA1 Message Date
Tomas Votruba
80c4fc8aab
[TypeDeclarationg] Add Tokens iterator to AddArrayReturnDocTypeRector and AddArrayParamDocTypeRector (#5796)
Co-authored-by: kaizen-ci <info@kaizen-ci.org>
2021-03-08 14:52:36 +00:00
Tomas Votruba
29487b75bb
[TypedProperty] Fix short import on already existing docblock (#5791)
* short import test case

* fix importing of already existing short name in docblock
2021-03-07 17:59:10 +00:00
Tomas Votruba
a63b232eca
cleanup (#5763) 2021-03-03 21:51:04 +00:00
Tomas Votruba
98f4554ba2
[Symfony] Remove AbstractToConstructorInjectionRector (#5749) 2021-03-03 11:57:11 +01:00
Tomas Votruba
92f2c5b3a6
[Nette] Remove AbstractWithFunctionToNetteUtilsStringsRector (#5742)
Co-authored-by: kaizen-ci <info@kaizen-ci.org>
2021-03-03 09:40:03 +00:00
Tomas Votruba
b7b6725364
remove abstract (#5736) 2021-03-03 08:49:57 +00:00
Tomas Votruba
d5bf66f9cd
[CI] run rules dir by dir to identify static reflection weak sposts (#5720)
* [CI] run rules dir by dir to identify static reflection weak sposts

* [ci-review] Rector Rectify

* consistency

* remove unused property

* add data provider test fixture

* add InvertedIfFactory to lower complexity

* [DeadCode] Skip unused public method if data provider

* misc

* [DeadCode] Do not remove class method if required by parent ocntract

* make use of ContextAnalyzer to find the loop

* narrow dirs one level

* narrow packages

* narrow

* use directly

* narrow

* correct constant name to keep BC

* bump deps

* add version_compare to removed extra params, just to be sure

* do not return function node on unchanged name

* narrow

* add support for multiple variants

* widen

* remove double check [skip ci]

Co-authored-by: kaizen-ci <info@kaizen-ci.org>
2021-03-02 14:43:36 +01:00
Tomas Votruba
4909e63a1d
Make use of static reflection from PHPStan (#5665)
* break test without autoload

* PHPStanServiceFactory - add tests directory as analysed paths

* use ReflectionProvider instead of class_exists

* use native reflections for annotation reader

* use native class and method reflections

* add RectorBetterReflectionSourceLocatorFactory

* add DynamicSourceLocator that is shared by PHPStan and Rector

* use ReflectoinProvider instead of class_exists()

* resolve native ClassMethodReflection

* make AnonymousFunctionFactory use reflection

* [DowngradePHP74] Improve DowngradeCovariantReturnTypeRector

* phsptan: avoid ClassReflection

* ProcessCommand: add file infos to source locator

* [DeadCode] Skip RemoveUnusedPublicMethodRector for test

* remove autolaod from tests

* misc

* remove is_a()

* [CI] enable only few dirs to avoid fails

* misc

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

Co-authored-by: kaizen-ci <info@kaizen-ci.org>
2021-02-28 08:47:48 +01:00
Tomas Votruba
c7b76c4983
[DX] Narrow wobly strings to strict ObjectType() #2 (#5694)
* use direct call on isObjectTypes()

* make use of ObjectType over strings
2021-02-27 02:13:22 +00:00
Tomas Votruba
0e7b845789
[DX] Narrow wobly strings to strict ObjectType() (#5693)
* [Renaming] Remove support for wildcards in method rename, to keep consistency and use of PHPStan ObjectType

* [DX] Use ObjectType instead of strings

* make isObjectTypes() require ObjectType

* decoupled SelfContainerFactory

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

Co-authored-by: kaizen-ci <info@kaizen-ci.org>
2021-02-27 00:58:09 +00:00
Tomas Votruba
a61a2c6e5e
use getNodeTypes() with class-string generic type (#5692)
Co-authored-by: kaizen-ci <info@kaizen-ci.org>
2021-02-27 00:06:15 +00:00
Tomas Votruba
72d6f1ab86
cleanup unneeded AbstractTemporaryRector methods (#5648) 2021-02-21 23:39:53 +00:00
Tomas Votruba
362ebbea46
[TypeDeclaration] Add ReturnTypeFromReturnNewRector (#5624)
Co-authored-by: kaizen-ci <info@kaizen-ci.org>
2021-02-19 12:01:23 +00:00
Tomas Votruba
c609697f14
[TypeDeclarationStrict] Add AddMethodCallBasedStrictParamTypeRector (#5580) 2021-02-17 16:40:29 +01:00
Tomas Votruba
7e10245fa1
[Nette] Add double render use case to TemplateMagicAssignToExplicitVariableArrayRector (#5549)
* add double case

* [ci-review] Rector Rectify

Co-authored-by: kaizen-ci <info@kaizen-ci.org>
2021-02-15 01:23:19 +00:00
Tomas Votruba
d2948833a8
drop unused AddPropertyByParentRector (#5537) 2021-02-13 23:36:53 +00:00
Tomas Votruba
768e1ad381
[Nette] Allow optional case to render() parameters (#5538) 2021-02-13 22:57:57 +00:00
Tomas Votruba
1a45becf74
[Nette] Add false return check to template check (#5535)
Co-authored-by: kaizen-ci <info@kaizen-ci.org>
2021-02-13 23:26:00 +01:00
Tomas Votruba
cd5cc8e12e
[Nette] Add render support to TemplateMagicAssignToExplicitVariableArrayRector, skip render() calls where missing template, now handled by another rule (#5532) 2021-02-13 17:56:58 +00:00
Tomas Votruba
d0fb658dad
[Nette] Improve TemplateMagicAssignToExplicitVariableArrayRector with conditional if/else (#5527)
Co-authored-by: kaizen-ci <info@kaizen-ci.org>
2021-02-13 13:25:47 +00:00
Tomas Votruba
ecbef2bcaa
[Tests] remove getPhpVersion() helped method, use configs instead (#5477) 2021-02-09 17:25:16 +00: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
d7353baf2c
Misc cleanup (#5456)
Co-authored-by: kaizen-ci <info@kaizen-ci.org>
2021-02-08 12:33:17 +00:00
Tomas Votruba
b2423f1f56
skip double template assigN (#5394) 2021-01-31 11:56:53 +00:00
Tomas Votruba
491cef11b9
allow another render names (#5393) 2021-01-31 11:16:51 +00:00
Tomas Votruba
f70a75f797
skip presenter (#5391) 2021-01-31 10:24:36 +00:00
Tomas Votruba
ad320cf63b
[Nette] Skip public method in template control (#5390)
Co-authored-by: rector-bot <tomas@getrector.org>
2021-01-31 08:35:44 +00:00
Tomas Votruba
a4f0c017ab
template control (#5388) 2021-01-31 00:51:20 +00:00
Tomas Votruba
7293c3c2a8
less traits 2 (#5384) 2021-01-30 23:20:05 +00:00
Tomas Votruba
734972d4b0
less traits (#5383) 2021-01-30 21:41:25 +00:00
Tomas Votruba
f9fdf2caaf
decopule AbstractTemporaryRector that does not requires rule definition (#5352)
Co-authored-by: rector-bot <tomas@getrector.org>
2021-01-28 19:52:11 +00:00
Tomas Votruba
7badb6347e
[Nette] Skip constructor on magic template call (#5289)
* Add failing test fixture for TemplateMagicAssignToExplicitVariableArrayRector

# Failing Test for TemplateMagicAssignToExplicitVariableArrayRector

Based on https://getrector.org/demo/cb7a63bb-d6ab-4f83-916e-714531f095bd

* [Nette] Skip constructor on magic template call

* [ci-review] Rector Rectify

Co-authored-by: Richard Kapička <richard@kapicka.cz>
Co-authored-by: rector-bot <tomas@getrector.org>
2021-01-22 20:01:32 +01:00
Tomas Votruba
0dc20048ae
Cleanup too detailed order rules + add TypedPropertyFromStrictConstructorRector (#5288) 2021-01-22 18:47:02 +00:00
Tomas Votruba
f7fc1ea144
skip presenter on control parent/name remover (#5278) 2021-01-22 01:15:05 +01:00
Tomas Votruba
85e7f7fa2c
Make remove parent/name only on component, skip form (#5266) 2021-01-20 15:57:49 +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
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
024a97d019
[RemovingStatic] Decouple static (#5207)
Co-authored-by: rector-bot <tomas@getrector.org>
2021-01-16 22:45:18 +01:00
Tomas Votruba
56409c5a3a
[phpstan] Remove unreported errors and duplicated methods (#5193)
Co-authored-by: rector-bot <tomas@getrector.org>
2021-01-15 21:27:36 +01:00
Tomas Votruba
6c11a254aa
[SymfonyCodeQuality] Add ExtractAttributeRouteNameConstantsRector (#5140)
* [SymfonyCodeQuality] Add ExtractAttributeRouteNameConstantsRector

* optimizations
2021-01-11 20:12:10 +00:00
Abdul Malik Ikhsan
4f6da168e0
[Nette] Do not Remove Param on RemoveParentAndNameFromComponentConstructorRector when used in Assign (#5098)
* Add failing test fixture for RemoveParentAndNameFromComponentConstructorRector

# Failing Test for RemoveParentAndNameFromComponentConstructorRector

Based on https://getrector.org/demo/12f10dc7-7ffb-4fe1-8004-7bf82e7aa9ce

There are multiple problems in this rule:
1) only $name is removed ($parent should be also removed)
2) $name (and if it would work also $parent) is removed also when there is some future use of it (e.g. assigning to private property $this->name = $name)

* Failing fixtures

* Closes #5052

* cs fix

* rename fixture

* rename fixture

* reduce complexity

* refactor

* use Assign

Co-authored-by: Michal Lulco <michal.lulco@gmail.com>
Co-authored-by: Michal Lulco <lulco@efabrica.sk>
2021-01-06 12:07:13 +01:00
Leonardo Losoviz
44e817fa0b
Access classes installed on DEV through their strings (#4897)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-12-28 12:20:51 +01:00
Tomas Votruba
ec92bcc95e
[phpstan] enable file lenght rule (#4999)
* enable file lenght rule

* longer file, just to show ci worked

* [ci] add ValidateFileLengthCommand

* [phpstan] drop PathsAreNotTooLongRule

* [Downgrade] Shorten property promotion rector rule

* [Symfony] Shorten AutoWireWithClassNameSuffixForMethodWithRequiredAnnotationRector name

* shorten fixture name

* rename ChangeControlArrayAccessToAnnotatedControlVariableRector to AnnotateMagicalControlArrayAccessRector

* rename ReplaceMagicEventPropertySubscriberWithEventClassSubscriberRector to ReplaceMagicPropertyWithEventClassRector

* rename GetConfigWithDefaultsArgumentToArrayMergeInCompilerExtensionRector to MergeDefaultsInGetConfigCompilerExtensionRector

* rename ChangeCollectionTypeOptionTypeFromStringToClassReferenceRector to ChangeStringCollectionOptionToConstantRector

* decouple ProjectFilesFinder
2020-12-26 14:53:21 +00: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
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
Tomas Votruba
574c7cd174
[static] Narrow param types, remove duplicated methods (#4921)
* narrow types and other static fixes

* duplicates static fixes

* [ci-review] Rector Rectify

Co-authored-by: rector-bot <tomas@getrector.org>
2020-12-20 13:50:55 +01:00
Tomas Votruba
d131d804d9
Bump min PHP version to 7.3 (#4838)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-12-09 23:25:53 +01:00
Tomas Votruba
267989bb05
[Docs] Add docblock docs (#4740)
* skip getUser() as the method is final

* drop comment along with removed node, as in other removed nodes

* [docs] add doc block docs
2020-12-01 01:09:50 +00:00