Commit Graph

4638 Commits

Author SHA1 Message Date
Tomas Votruba
2c46d4fc4d
[DX] Drop YamlFileFormatter as Rector does not process YAML (#2376) 2022-05-27 17:33:40 +02:00
Tomas Votruba
a7e6b685e9
[DX] Remove XmlFileFormatter, as Rector does not handle it (#2375) 2022-05-27 15:26:22 +00:00
Tomas Votruba
a9dd89b1cc
[DX] Remove CommandNaming magic, check rector class exists in RectorConfig (#2372) 2022-05-27 16:58:29 +02:00
Tomas Votruba
45eef47f27
[DX] Various config merge, improve RectorConfig methods (#2371) 2022-05-27 15:30:05 +02:00
Tomas Votruba
7adde5807c
[DX] Move configure to direct call in RectorConfig (#2367) 2022-05-27 10:52:46 +00:00
Abdul Malik Ikhsan
bfff1df4dd
[PhpDocInfo] Fixes Partial value update got duplicated on DoctrineAnnotationTagValueNode change (#1862)
* [PhpDocInfo] Fixing Partial value update got duplicated on PhpDocInfo change

* Fixed 🎉

* Fixed 🎉

* clean up

* Fixed 🎉

* [ci-review] Rector Rectify

* rollback mirror check

* check end equals to length identifier and silent value

* check SpacelessPhpDocTagNode

* tweak

* more fixtures

* back

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

* back

* back

* debug reprint

* back

* fix ?

* try

* try

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

* add failing fixture

* debug

* another approach

Co-authored-by: GitHub Action <action@github.com>
2022-05-27 17:41:18 +07:00
Abdul Malik Ikhsan
3da22b0231
[Php81] Skip ArrayDimFetch from ArrayObject in Assign var on ReadOnlyPropertyRector (#2363)
* [Php81] Skip ArrayDimFetch from ArrayObject in Assign var on ReadOnlyPropertyRector

* Fixed 🎉

* eol
2022-05-26 09:13:59 +02:00
Tomas Votruba
66dbb1e307
Allow to rename method if in interface (#2362)
* add test fixture

* allow rename method in interface
2022-05-25 21:35:18 +00:00
Abdul Malik Ikhsan
9c6b3d708c
[TypeDeclaration] Skip curly {@inheritdoc} on AddArrayReturnDocTypeRector (#2359) 2022-05-25 09:26:56 +02:00
Abdul Malik Ikhsan
8efa7151e6
[FamilyTree] Use parent->hasNativeMethod() on ClassChildAnalyzer->resolveParentClassMethods() (#2357) 2022-05-24 22:49:28 +02:00
Abdul Malik Ikhsan
3fe07aa6a1
[Experiment][Naming] Keep GroupUse Stmt on UseImportsResolver::resolveForNode() (#2349)
Co-authored-by: GitHub Action <action@github.com>
2022-05-22 22:57:59 +02:00
Ruud Kamphuis
a59e9cece6
Fix return type of FileInfoParser::parseFileInfoToNodesAndDecorate (#2344)
It returns `PhpParser\Node\Stmt[]` instead of `PhpParser\Node[]`.
2022-05-22 14:17:58 +07:00
Tomas Votruba
08a35afeb1 remove symfony routes json paramter as unused 2022-05-22 09:12:04 +02:00
Tomas Votruba
b4120a8850
[DX] Use direct method on node, instead of token position (#2340) 2022-05-21 08:43:58 +00:00
Tomas Votruba
fcadc67328
add symfony php config option to allow loading route factory (#2339) 2022-05-21 08:42:08 +00:00
Abdul Malik Ikhsan
36fd8fa619
[NodeTypeResolver] Remove DummyTraitClass check as the class no longer exists (#2338) 2022-05-20 19:59:01 +02:00
Malte Schlüter
4d31934258
Add new rule to add annotations from router configuration to symfony controllers (#2306) 2022-05-13 12:08:27 +02:00
Tomas Votruba
1ec5e2d35b restore links 2022-05-12 21:13:03 +02:00
Tomas Votruba
47bea33c2e use changelog annotations to display useful into under the change 2022-05-12 21:07:36 +02:00
Abdul Malik Ikhsan
78aaf7ee0b
[Php82] Add ReadOnlyClassRector (#2296)
* [Php82] Add ReadOnlyClassRector

* skip has non-readonly property

* note

* note

* note

* [ci-review] Rector Rectify

* skip has AllowDynamicProperties attribute

* skip already readonly

* [ci-review] Rector Rectify

* skip property promotion not readonly

* no params means no property promotion, skip if no property defined

* note

* note

* skip final class, possibly extendable

* add fixture

* add @see

* visibility union ndoe rules/Privatization/NodeManipulator/VisibilityManipulator.php

* visibility union ndoe rules/Privatization/NodeManipulator/VisibilityManipulator.php

* remove already readonly fixture

* comment

* skip anonymous class fixture

* skip non-final class fixture

* skip allow dynamic fixture

* class check

* skip has writable property fixture

* skip no properties

* skip property promotion writable

* debug

* [ci-review] Rector Rectify

* fix

* eol

* fix

* [ci-review] Rector Rectify

* final touch: add up-to-php82 level setlist

Co-authored-by: GitHub Action <action@github.com>
2022-05-12 22:44:59 +07:00
Tomas Votruba
3bae3b9e75
[Downgrade] Separate multi level dependency in DowngradeArraySpreadRector (#2298) 2022-05-12 08:50:48 +00:00
Tomas Votruba
3d499125b8
Add Scope refresh for changed or new nodes (#2292) 2022-05-12 08:33:27 +02:00
Tomas Votruba
2ccb53592e
Improve indent types (#2294) 2022-05-11 22:46:44 +00:00
Tomas Votruba
17d200dfa6
[DX] Skip extra comment, add RectorConfig->rules() (#2290) 2022-05-11 16:45:25 +00:00
Abdul Malik Ikhsan
12fa9407f7
[DeadCode] Skip @return static on return self when class is not final or in trait on RemoveUselessReturnTagRector (#2282)
* [DeadCode] Skip @return static on return self when class is not final

* Fixed 🎉

* eol

* reduce complexity

* fix

* reduce complexity

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

Co-authored-by: GitHub Action <action@github.com>
2022-05-11 08:06:19 +03:00
Abdul Malik Ikhsan
e341cc26fe
[NodeNameResolver] Remove NodeNameResolver::isLocalPropertyFetchNamed() method, already handled at PropertyFetchAnalyzer::isLocalPropertyFetchName() (#2263)
* [NodeNameResolver] Remove NodeNameResolver::isLocalPropertyFetchNamed() method, already handled at PropertyFetchAnalyzer::isLocalPropertyFetchName()

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

* phpstan

* final touch: comment

Co-authored-by: GitHub Action <action@github.com>
2022-05-08 11:43:06 +03:00
Tomas Votruba
c2ade0583c
[DX] Refactor ChangeNestedIfsToEarlyReturnRector to direct return (#2250) 2022-05-07 09:20:29 +00:00
Tomas Votruba
d8c523625c
Various property + class context improvements (#2234)
* improve read property detector

* pass class to acompany the prpoerty changed to have the main node in the context

* add IncDecParentNodeReadAnalyzer
2022-05-05 09:30:58 +00:00
Tomas Votruba
3184d55477
[DX] Use direct return of multi nodes instead of 2 addNode before/after node (#2232)
Co-authored-by: GitHub Action <action@github.com>
2022-05-05 10:25:46 +02:00
Tomas Votruba
2d16736414
[DX] Remove poorly designed NodeToReplacePostRector, return changed nodes directly in the current rule (#2229) 2022-05-05 00:16:25 +02:00
Tomas Votruba
767e7692e1
[Experimental] Add refactorWithScope() method to get typed Scope easily and required (#2227) 2022-05-04 17:14:19 +02:00
Abdul Malik Ikhsan
129ce269d3
[Core] Use ReflectionResolver to get ClassReflection when possible (#2226)
* [Core] Use ReflectionResolver to get ClassReflection when possible

* on ClassDependencyManipulator

* on ParentClassMethodTypeOverrideGuard

* on AddPropertyTypeDeclarationRector

* on ReturnTypeFromReturnNewRector

* on ParamTypeByMethodCallTypeRector

* [ci-review] Rector Rectify

* on ParamTypeByParentCallTypeRector

* on ClassMethodParamVendorLockResolver

* on AddVoidReturnTypeWhereNoReturnRector

* on PropertyTypeOverrideGuard

* on AddInterfaceByTraitRector

* LocallyCalledStaticMethodToNonStaticRector

* on MakePropertyTypedGuard

* on FinalizeClassesWithoutChildrenRector

* on ClassMethodReturnTypeOverrideGuard

* on PrivatizeFinalClassMethodRector

* scope fix

* [ci-review] Rector Rectify

* class

* [ci-review] Rector Rectify

* on ClassMethodReturnVendorLockResolver

* on CurrentAndParentClassMethodComparator

* on CurrentAndParentClassMethodComparator

* on DowngradeStringReturnTypeOnToStringRector

* on DowngradeStaticTypeDeclarationRector

* on DowngradeContravariantArgumentTypeRector

* on DowngradeSelfTypeDeclarationRector

* [ci-review] Rector Rectify

* on RemoveUnusedPrivateClassConstantRector

* [ci-review] Rector Rectify

* on SetterNodeReturnTypeInfererTypeInferer

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

* fix

Co-authored-by: GitHub Action <action@github.com>
2022-05-04 17:37:56 +07:00
Abdul Malik Ikhsan
6bb8973182
[NodeNestingScope] Remove ScopeAwareNodeFinder::findParentType (#2214) 2022-05-02 15:49:33 +02:00
Abdul Malik Ikhsan
992d1efc75
[CodeQuality] Skip CallableThisArrayToAnonymousFunctionRector when inside of Attribute (#2212)
* [CodeQuality] Skip CallableThisArrayToAnonymousFunctionRector when inside of Attribute

* Fixed 🎉
2022-05-02 11:37:50 +02:00
Abdul Malik Ikhsan
22bdd60e18
[Code] Improve BetterNodeFinder::findFirstPrevious() to only locate previous of parent if no previous of Node (#2209)
* [Code] Improve BetterNodeFinder::findFirstPrevious() to only locate previous of parent if no previous of Node

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

* part of loop fix on ForeachItemsAssignToEmptyArrayToAssignRector

* [ci-review] Rector Rectify

* move LOOP_NODES constant to ControlStructure ValueObject

* ref fix

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

* final touch: rename method

* final touch: clean up

* final touch: clean up unused param

* final touch: clean up unused param

* [ci-review] Rector Rectify

Co-authored-by: GitHub Action <action@github.com>
2022-05-01 13:52:03 +00:00
Abdul Malik Ikhsan
c8b47df3e4
[Core] Remove loop on FilesFinder::findInDirectoriesAndFiles() (#2201)
* [Core] Remove loop on FilesFinder::findInDirectoriesAndFiles()

* [ci-review] Rector Rectify

* rename variable

* clean up

Co-authored-by: GitHub Action <action@github.com>
2022-04-30 08:34:40 +02:00
Abdul Malik Ikhsan
680e8a1e3d
[Core] Add $seconds, $maxNumberOfProcess, and $jobSize parameters to RectorConfig::parallel() method (#2188) 2022-04-28 20:29:13 +02:00
Abdul Malik Ikhsan
80df62821f
[Doc] Document deprecated USE_NODES and CURRENT_STATEMENT constant to use existing method call when needed (#2181)
* [Doc] Document deprecated USE_NODES and CURRENT_STATEMENT constant to use existing method call when needed

* reduce line
2022-04-27 16:43:28 +02:00
Abdul Malik Ikhsan
4fea4e23b9
[TypeDeclaration] Skip return type defined Closure on ReturnTypeDeclarationRector (#2179)
* [TypeDeclaration] Skip return type defined Closure on ReturnTypeDeclarationRector

* Fixed 🎉

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

* Fix

* final touch: clean up

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

Co-authored-by: GitHub Action <action@github.com>
2022-04-27 15:30:48 +02:00
Tomas Votruba
ae45be1cf3
[DX] Add note warning about using old config (#2174)
* fix cs

* use import short classes

* add notificaiton in case of loading of old ContainerConfigurator

* add imports short classes
2022-04-26 22:53:49 +00:00
Tomas Votruba
19284802ae
Decouple aliased object type specifier + updgrade to PHPStan 1.6 (#2170)
* make of use array

* shorten instanceof

* update rules tests union order

* fix array index order

* update anonymous class references

* [skip ci] bump phpstan to 1.6 min
2022-04-26 11:42:01 +02:00
Tomas Votruba
38e1f8a450
Remove NamespaceNodeVisitor (#2167)
* cleanup

* remove USE_NODES from mirror

* remove NamespaceNodeVisitor
2022-04-26 00:04:26 +02:00
Tomas Votruba
f7b095495b
Remove last USE_NODE (#2165) 2022-04-25 18:05:16 +02:00
Tomas Votruba
25e6b17a86
Remove USE_NODES from ObjectTypeSpecifier::matchShortenedObjectType() (#2164) 2022-04-25 10:07:31 +00:00
Tomas Votruba
bc39917aba
Remove USE_NODES from UseNodesToAddCollector (#2162) 2022-04-25 10:49:43 +02:00
Tomas Votruba
893c948a62
Remove USE_NODES from NameScopeFactory (#2161) 2022-04-25 08:28:25 +00:00
Tomas Votruba
2447c3155b
Cleanup (#2159)
* remove commented code

* cleanup ruleWithConfigure()
2022-04-25 10:21:21 +02:00
Tomas Votruba
69de62a1d8
disable StatementNodeVisitor (#2154) 2022-04-25 09:58:17 +02:00
Tomas Votruba
90dae505af
Remove uses nodes attribute - part #1 (#2155)
Co-authored-by: GitHub Action <action@github.com>
2022-04-25 09:03:59 +02:00
Abdul Malik Ikhsan
366c994a5c
More current statement attribute clean up (#2150)
* More Current Statement attribute clean up

* More Current Statement attribute clean up

* clean up

* [ci-review] Rector Rectify

Co-authored-by: GitHub Action <action@github.com>
2022-04-24 19:24:58 +02:00