1399 Commits

Author SHA1 Message Date
Abdul Malik Ikhsan
660f51019a
[PHP 8.0] Fixes #4527 Add NullsafeOperatorRector (#4557)
Co-authored-by: rector-bot <tomas@getrector.org>
Co-authored-by: Tomas Votruba <tomas.vot@gmail.com>
2020-11-08 23:15:16 +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
3940e42d25 rector update 2020-11-05 02:01:47 +01:00
Tomas Votruba
f841c8c470 fix cs 2020-11-05 01:50:43 +01:00
Krystian Marcisz
a92f4c1e2d
[DoctrineCodeQuality] Remove redundant default values from annotations (#4542)
* Move duplicated getAttributableItems() method to abstract parent

* Add removeItem() method to AbstractTagValueNode class

* Add RemoveRedundantDefaultAnnotationValuesRector rule with tests

* Link second test case of RemoveRedundantDefaultAnnotationValuesRector

* Add to set and docs

* Rename variable in DoctrineClassAnalyzer::matchDoctrineEntityTagValueNode()

* Remove redundant docblocks in RemoveRedundantDefaultAnnotationValuesRector

* Extract hasItemWithDefaultValue method in RemoveRedundantDefaultAnnotationValuesRector

* Optimize RemoveRedundantDefaultAnnotationValuesRector

* Split rule into two separate: one for Property and one for Class_

* PHP CS Fixer

* PHPStan
2020-11-04 22:51:11 +01:00
Abdul Malik Ikhsan
0cc7b66a1e
[FileSystem] Improve MovedFileWithNodesFactory : SKip if desiredGroupName already inside oldClassName (#4554) 2020-11-04 15:55:22 +01:00
Abdul Malik Ikhsan
01092de6bb
[Nette 3.0] Fixes #4387 : Add ConvertAddUploadWithThirdArgumentTrueToAddMultiUploadRector (#4551)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-11-04 05:45:10 +01:00
Tomas Votruba
93b601cef0
merge AstractGenericRectorTestCase and AbstractRectorTestCase (#4550)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-11-03 21:39:57 +01: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
297ec316af
move suffix filesystem 3 (#4540) 2020-11-01 21:31:13 +01:00
Tomas Votruba
cf48b2ea83
decouple (#4534)
* decouple

* [ci-review] Rector Rectify

* fix static

Co-authored-by: rector-bot <tomas@getrector.org>
2020-11-01 16:03:30 +00:00
Tomas Votruba
e7c1ded364
fix linter (#4537) 2020-11-01 16:57:12 +01:00
Tomas Votruba
c03b66f7cd
move suffix filesystem 2 (#4529)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-11-01 16:39:04 +01:00
Abdul Malik Ikhsan
d876f5bf59
[CodeQuality] Fixes #4516 Skip Apply ArrayThisCallToThisMethodCallRector on array inside property (#4533) 2020-11-01 14:32:48 +01:00
Abdul Malik Ikhsan
55a0400a62
Typo Fix funciton -> function (#4532) 2020-11-01 09:51:52 +01:00
Tomas Votruba
8542a3bcbc
Move from Filesystem rules to FileNode (#4528)
* make MoveServicesBySuffixToDirectoryRector with non-filesystem rector

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

* [ci-review] Apply coding standards

* fixup! make MoveServicesBySuffixToDirectoryRector with non-filesystem rector

Co-authored-by: rector-bot <tomas@getrector.org>
2020-10-31 21:39:09 +00:00
Tomas Votruba
5147844615
change RenameSpecFileToTestFileRector filesystem to normal one (#4525) 2020-10-31 16:20:30 +00:00
Pierre du Plessis
f5c673b292
Check for property fetch type in DoctrineCollectionDoctype rector (#4454) 2020-10-31 14:14:42 +01: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
Tommy Quissens
3bf107594e
[Downgrade PHP 7.3] Flexible Heredoc syntax (#4272) 2020-10-31 12:39:51 +01:00
Tomas Votruba
9751b9a1e8
[Decouple] Remove set, rather job for PHPStorm (#4521)
* [Decouple] Remove set, rather PHPStorm job

* update docs
2020-10-31 07:54:00 +00:00
Tomas Votruba
18d2ea2d31
[Nette] Add MoveFinalGetUserToCheckRequirementsClassMethodRector (#4520)
* [Nette] Add MoveFinalGetUserToCheckRequirementsClassMethodRector

* [Nette] Add MoveFinalGetUserToCheckRequirementsClassMethodRector

* patch final presenter to allow tests
2020-10-31 00:43:54 +00:00
Tomas Votruba
34b4d10ea2
[docs] more node cleanup (#4519)
* [TypeDeclaration] Add better return type coverage

* drop less common node snippets
2020-10-30 21:58:39 +00:00
Tomas Votruba
3ed76c6559
[Nette] Add RemoveParentAndNameFromComponentConstructorRector (#4515)
* [Nette] Add RemoveParentAndNameFromComponentConstructorRector

* add refactorClassMethod()

* add refactorStaticCall()

* add refactorNew() method

* [Nette] Rename AddDatePickerToDateControlRector to AddNextrasDatePickerToDateControlRector

* [ci-review] Rector Rectify

Co-authored-by: rector-bot <tomas@getrector.org>
2020-10-30 17:10:17 +00:00
Tomas Votruba
2c120e283e
Inform about useless second part in tests fixture, after -----, if it is identical (#4514)
* embed skip fixture of same before/after

* [Testing] Add exception on identical second half of the fixture, that should not change

* [ci] use composer 2 for code_analysis

* [ci-review] Rector Rectify

Co-authored-by: rector-bot <tomas@getrector.org>
2020-10-30 13:56:55 +00:00
Tomas Votruba
b302e493dd
[SOLID] Add MoveVariableDeclarationNearReferenceRector (#4410)
* Create test cases

* Create rector

* Add closure to possible parent scopes

* Register in SOLID set

* Document the feature

* fix adding variable in closure

* move MoveVariableDeclarationNearReferenceRector to Assign category, based on getNodeTypes()

* ci: drop phpunit matcher, not much helpful

* ignore for now, many cases to cover

* prepare release

Co-authored-by: Anna Filina <afilina@gmail.com>
2020-10-30 13:25:24 +00:00
Abdul Malik Ikhsan
49b7635b27
[Performance] Bug Fix CountArrayToEmptyArrayComparisonRector for negation inside or / and operator (#4508)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-10-30 14:09:18 +01:00
Tomas Votruba
dc2047f70a
[TypeDeclaration] Switch from stringy types to PHPStan types (#4510)
* nette-30 config cleanup

* [TypeDeclaratoin] Move AddReturnTypeDeclarationRector from generic

* add Type support to AddReturnTypeDeclaration

* make AddParamTypeDeclarationRector use PHPStan type objects over strings

* [SymfonyPhpConfig] Add support for nested types

* drop StringTypeToPhpParserNodeMapper

* [ci-review] Rector Rectify

Co-authored-by: rector-bot <tomas@getrector.org>
2020-10-30 11:58:35 +00:00
Tomas Votruba
bc41ba2b2e
phpstan cleanup (#4509)
* move tag objects to ValueObject namespace

* [ci] temporarily disable weird broken monorepo split, wait for move to github actoins
2020-10-29 23:06:26 +01:00
Tomas Votruba
91a354c080
[NetteCodeQuality] Fix ChangeFormArrayAccessToAnnotatedControlVariableRector for in-closure (#4506)
* [NetteCodeQuality] Fix ChangeFormArrayAccessToAnnotatedControlVariableRector for in-closure

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

* fix name

* fix unknown mixed type on fluent

* [ci-review] Rector Rectify

Co-authored-by: rector-bot <tomas@getrector.org>
2020-10-29 21:25:35 +00:00
Abdul Malik Ikhsan
a2ae659e0a
[CodeQualityStrict] Enable MoveOutMethodCallInsideIfConditionRector (#4502)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-10-29 21:47:12 +01:00
Abdul Malik Ikhsan
449801e1f3
Add regex uri to regex constant (#4504)
Co-authored-by: Jan Lohage <j2L4e@users.noreply.github.com>
Co-authored-by: rector-bot <tomas@getrector.org>
2020-10-29 19:04:33 +01:00
Tomas Votruba
252f17821e
fix non-existing method trying to get method reflection (#4505) 2020-10-29 16:45:13 +00:00
Abdul Malik Ikhsan
9e0b632e4e
[CodeQualityStrict] Add CountArrayToEmptyArrayComparisonRector to CodeQualityStrict (#4496)
Co-authored-by: rector-bot <tomas@getrector.org>
Co-authored-by: Tomas Votruba <tomas.vot@gmail.com>
2020-10-29 09:59:39 +01:00
Tomas Votruba
2116630748
[ci] remove old merageable file (#4497)
* [ci] remove old merageable file

* updat ecs
2020-10-28 23:26:17 +00:00
Tomas Votruba
9314c4b173 fix cs 2020-10-28 23:03:13 +01:00
Abdul Malik Ikhsan
c54377da25
[Performance] Add CountArrayToEmptyArrayComparisonRector (#4489)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-10-28 22:59:21 +01:00
Tomas Votruba
35502016a6
Improve MoveOutMethodCallInsideIfConditionRector (#4492)
* skip rename

* add method call and variable name for MoveOutMethodCallInsideIfConditionRector

* decouple MethodCallToVariableNameResolver

* use trick with Scope if variable is already defined

* fixup! use trick with Scope if variable is already defined

* cover case with variable name and method call

* add decopule note future

* [ci-review] Rector Rectify

* [ci] try re-trigger ci-review after push automatically

Co-authored-by: rector-bot <tomas@getrector.org>
2020-10-27 15:51:44 +00:00
Tomas Votruba
a1e50263d2
[cs] improve configured rules types (#4491)
* [cs] improve configured rules types

* [ci] update env variable
2020-10-27 14:00:39 +00:00
Tomas Votruba
44b27f779e
[EarlyReturn] Decouple new set (#4490)
* [set] decouple new code-quality-strict

* decopule early-return set [closes #4464]

* [docker] drop prestissimo, as composer v2 does not need it

* [ci] move coding standard to ci_review

* [ci] try to run rector-ci on contributors
2020-10-27 13:47:37 +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
Abdul Malik Ikhsan
7a1ea1328b
[CodeQuality] Register MoveOutMethodCallInsideIfConditionRector to config code-quality set (#4477)
* [CodeQuality] Register MoveOutMethodCallInsideIfConditionRector to config code-quality set

* rename use string parameter

* phpstan

* fix false positive string param to be var === variable name

* fix false positive

* phpstan

* ensure not same variable

* phpstan

* add ucfirst after var

* add fixture failing test for variable exists to be skipped

* add fixture failing test for variable exists in previuos statement

* phpstan space

* add handling variable exists in previous statement and in ClassMethod/Functions args

* handle exists but inside if

* reduce complexity

* clean up

* clean up

* cs fix

* phpstan

* remove - in variable

* use fallback when first character is numeric

* using regex to check string start alpha for variable

* cs fix

* use ClassConstFetch name to set variable name

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

* clean up

* fix

* [ci-review] Rector Rectify

* Update rules/code-quality/src/Rector/If_/MoveOutMethodCallInsideIfConditionRector.php

* Update rules/code-quality/src/Rector/If_/MoveOutMethodCallInsideIfConditionRector.php

Co-authored-by: rector-bot <tomas@getrector.org>
Co-authored-by: Tomas Votruba <tomas.vot@gmail.com>
2020-10-26 14:03:26 +00:00
Tomas Votruba
5f3b4bde1f
[Naming] Allow does in MakeIsserClassMethodNameStartWithIsRector (#4486) 2020-10-26 10:22:20 +00:00
Tomas Votruba
0f2e6d407e
[DoctrineAnnotaitonGenerated] Update to doctrine/annotations 1.11 + fix static (#4479) 2020-10-25 14:43:05 +01:00
Abdul Malik Ikhsan
11c76808be
[CodeQuality] Add MoveOutMethodCallInsideIfConditionRector (#4457)
* Add MoveOutMethodCallInsideIfConditionRector

* cs fix

* implemented handling pass constant to arg 0

* phpstan

* final touch: no need strtolower() before ucfirst on fallback var name
2020-10-23 15:15:54 +02:00
Abdul Malik Ikhsan
be06b60eac
Typo Fix: Strings::endWith() should be Strings::endsWith() (#4475)
* Typo Fix: Strings::endWith() should be Strings::endsWith()

* [rector] Typo Fix: Strings::endWith() should be Strings::endsWith()

* [cs] Typo Fix: Strings::endWith() should be Strings::endsWith()

* phpstan

* [rector] phpstan

* [cs] phpstan

* cs fix

Co-authored-by: rector-bot <tomas@getrector.org>
2020-10-23 11:23:12 +02:00
Tomas Votruba
6c51f3fb4f
[Restoration] Add InferParamFromClassMethodReturnRector (#4471)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-10-21 23:06:24 +02:00
Tomas Votruba
10ae0d687a
[CodeQuality] Add NewStaticToNewSelfRector (#4468)
* [CodeQuality] Add NewStaticToNewSelfRector

* regenerated docs

* drop patches
2020-10-20 22:01:47 +00:00
Tomas Votruba
aa98eb5d9e
[CodeQuality] Skip dynamic properties for bindTo() (#4467)
* [CodeQuality] Decouple complete dynamic properties rector, add skip of bind()

* [rector] [CodeQuality] Decouple complete dynamic properties rector, add skip of bind()

* [cs] [CodeQuality] Decouple complete dynamic properties rector, add skip of bind()

Co-authored-by: rector-bot <tomas@getrector.org>
2020-10-20 22:43:05 +02:00
Tomas Votruba
75d25a1dcb
[CodeQuality] Decouple complete dynamic properties rector, add skip of Closure::bind() (#4466)
* [ci] temporarily hide split monorepo

* [CodeQuality] Decouple complete dynamic properties rector, add skip of bind()

* [rector] [CodeQuality] Decouple complete dynamic properties rector, add skip of bind()

* [cs] [CodeQuality] Decouple complete dynamic properties rector, add skip of bind()

Co-authored-by: rector-bot <tomas@getrector.org>
2020-10-20 20:27:12 +00:00