135 Commits

Author SHA1 Message Date
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
37b3cecda3
Upgrade to php-parser 4.10.4 and PHPStan 0.12.63 (#4926)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-12-20 22:05:48 +01: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
Abdul Malik Ikhsan
720b2c34eb
[EarlyReturn] Enable ReturnBinaryAndToEarlyReturnRector in early-return config set (#4915)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-12-19 16:24:53 +01:00
Abdul Malik Ikhsan
6c813e5e4d
[Solid] Skip MoveVariableDeclarationNearReferenceRector when next statement has static call (#4914)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-12-18 18:18:40 +01:00
Tomas Votruba
eddb2b29c9
[EarlyReturn] Decouple new rules (#4868) 2020-12-12 16:59:09 +00:00
Leonardo Losoviz
ff2ea86176
Renamed NoParticularNodeRule to ForbiddenNodeRule (#4848)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-12-11 09:58:51 +01:00
Grzegorz Korba
21e5a6696c
Do not enforce interface-typing for classes with wider public API than defined by interface (#4845) 2020-12-10 18:55:34 +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
eac130e705
[PHP 8.0] Make Attribute silent keys explicit, with named args (#4834)
* decouple TagName class

* remove attribute aware from data provider tag value node, as unique class

* add RequiredTagValueNode

* make Attributes explicit, to avoid confusiong
2020-12-09 17:16:36 +00:00
Abdul Malik Ikhsan
0e421247e8
[Solid] Skip ChangeAndIfToEarlyReturnRector on nested if in loop (#4757)
* ChangeAndIfToEarlyReturnRector: added failing test

* fix test warning

* rename test

* rename test

* try to fix the issue

* Update skip_nested_if_in_loop.inc

* rename fixture

* rename fixture

* extracted loop-types into constant

* fix

* refactor

* take Else_/ElseIf_ into account

* Update ChangeAndIfToEarlyReturnRector.php

* [Solid] Skip ChangeAndIfToEarlyReturnRector on nested if in loop, Closes #4728

* [ci-review] Rector Rectify

Co-authored-by: Tomas Votruba <tomas.vot@gmail.com>
Co-authored-by: Markus Staab <markus.staab@redaxo.de>
Co-authored-by: Markus Staab <maggus.staab@googlemail.com>
Co-authored-by: rector-bot <tomas@getrector.org>
2020-12-03 09:20:59 +01:00
TomasVotruba
275ef81062 fix missing deafault replace empty string 2020-12-01 15:00:00 +01:00
Tomas Votruba
2030badc19
[PHP 8.0] Add nette utils strings replace, static fixes (#4741)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-12-01 14:52:24 +01:00
Tomas Votruba
499d452f99
Various improvements (#4717) 2020-11-27 21:39:42 +01:00
Markus Staab
ae0d38e1f0
added failing ChangeIfElseValueAssignToEarlyReturnRector test, regarding lost comments (#4698) 2020-11-27 17:38:07 +01:00
Markus Staab
04abc7af5c
create LostCommentBeforeElseIf failing test (#4697) 2020-11-27 17:33:16 +01:00
Tomas Votruba
0eb6e29176
drop MinimalVersionChecker, is checked by composer itself (#4715)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-11-27 17:32:38 +01:00
Markus Staab
972e0457cb
ChangeAndIfToEarlyReturnRector: added a failing testcase for continue-in-foreach (#4696)
* added a failing testcase

* initial try to fix 4693

* fix existing if_in_foreach test with wrong expected result

* Restore if_in_foreach.php.inc

* adusted wrong test expectation of if_in_foreach.php

* use betterNodeFinder->findFirstParentInstanceOf

* fix test expectation in if_in_foreach fixture

* fixed method name which was misleading

* fix variable name

* adjust impl

* Restore if_in_foreach.php.inc

* rm unused use

* fix impl
2020-11-27 16:10:48 +00:00
Markus Staab
fe47bc2cc7
ChangeAndIfToEarlyReturnRector: fix test expectation in if_in_foreach fixture (#4711)
* fix test expectation in if_in_foreach fixture

* fixed method name which was misleading

* fix variable name

* adjust impl
2020-11-27 13:59:56 +00:00
Abdul Malik Ikhsan
1c9cfafdda
[Solid] Fixes #4677 Skip MoveVariableDeclarationNearReferenceRector on multiple usage in Switch -> cases (#4678) 2020-11-23 22:23:44 +01:00
Abdul Malik Ikhsan
715b616ada
[Solid] use Variable node type for for MoveVariableDeclarationNearReferenceRector (#4670)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-11-23 11:40:29 +01:00
Abdul Malik Ikhsan
f004f290c7
[Solid] Improve MoveVariableDeclarationNearReferenceRector : skip variable with usage in multiple level (#4643)
* [Solid] Improve MoveVariableDeclarationNearReferenceRector : skip variabel with usage in multiple level

* function name and var name

* stop calling parent attribute when previous of parent is an Expression with Assign with same variable

* phpstan

* deep up usage

* deeeeep level

* stop while when previous is Expression with Assign same var

* final touch

* [ci-review] Rector Rectify

* keep comment

* cast isFoundNext

* fixed

* separate method

* [ci-review] Rector Rectify

* clean up fixtures

Co-authored-by: rector-bot <tomas@getrector.org>
2020-11-18 21:26:54 +00:00
Tomas Votruba
a7705ed0a5
[Symplify 9] First update + switch to RuleDocGenerator (#4616)
* [composer] bump to Symplify 9

* [Symplify 9] Update phpstan rules

* bump to Symplify 9 BETA2

* update AbstractKernel from Tests to Testing namespace

* decoupling removing node trait

* remove fluent calls

* removing variadic

* [CodingStyle] Improve AnnotateThrowablesRector

* bump deps

* Make use of RuleDocGenerator

* first short

* [DocumentationGenerator] Drop deprecated package, RuleSetGenerator now handles it

* import namespace

* update docs
2020-11-16 17:50:38 +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
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
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
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
a1e50263d2
[cs] improve configured rules types (#4491)
* [cs] improve configured rules types

* [ci] update env variable
2020-10-27 14:00:39 +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
0f2e6d407e
[DoctrineAnnotaitonGenerated] Update to doctrine/annotations 1.11 + fix static (#4479) 2020-10-25 14:43:05 +01:00
Tomas Votruba
fd9bd00713
[DoctrineCodeQuality] Fix oveCurrentDateTimeDefaultInEntityToConstructorRector for default value (#4436)
* [DoctrineCodeQuality] Fix oveCurrentDateTimeDefaultInEntityToConstructorRector for default value

* re-use local property method

* improve new_ nesting

* [rector] improve new_ nesting

* static fixes

* bump deps

Co-authored-by: rector-bot <tomas@getrector.org>
2020-10-18 08:45:56 +00:00
Igor
d017e5417e
[SOLID] Change if && to early return (process nested ifs) (#4395)
* [SOLID] Change if && to early return (process nested ifs)

* Skip if with void return

* Skip if parent if has void return

* [rector] Skip if parent if has void return

* [cs] Skip if parent if has void return

Co-authored-by: rector-bot <tomas@getrector.org>
2020-10-13 20:30:14 +02:00
Tomas Votruba
01514ab9a8
[SimplePhpDocParser] Add README + getParam*() helper methods (#4393) 2020-10-11 16:17:43 +02:00
Igor
874baec836
[SOLID] Change if && to early return (more than two conditions) (#4390)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-10-11 11:43:51 +02:00
Tomas Votruba
4a76cdaa82
[SymfonyPHPConfig] Add monorepo split for value objects function (#4153)
* add monorepo split for symfony-php-config

* [SOLID] Prevent replacing referenced parametes with inlined constnat value

* make Symfon 5.0- compatible

* add support for reference skip in constructor

* [rector] add support for reference skip in constructor

* [cs] add support for reference skip in constructor

* improve misisng rule feedback

* underscore

* Fix ChangeReadOnlyVariableWithDefaultValueToConstantRector for new

* add clear-cache to all commands

* colors

* [rector] colors

* [cs] colors

Co-authored-by: rector-bot <tomas@getrector.org>
2020-10-10 17:42:43 +00:00
Igor
35537dba84
[SOLID] Change if && to early return (#4344)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-10-10 18:27:13 +02: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
Tomas Votruba
7aad4bbf2f
[PHPStan] Enable regex constant rule (#4279) 2020-09-23 11:16:40 +02:00
Igor
f2ecdeb0b1
[Naming] Foreach over "data", renames to "datum" (#4221)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-09-15 10:23:13 +02:00
Tomas Votruba
59c5a5e5ba
[NodeRepository] Merge function like finder to NodeRepository (#4186)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-09-11 00:09:05 +02:00
Tomas Votruba
f5f7ba76af
[NoreRepository] merge ClassLikeParsedNodesFinder to NodeRepository (#4185)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-09-10 14:56:54 +02:00
Tomas Votruba
7ac228c638
[CI] Add type-declaration set (#4089)
* [CI] Add type-declaration set

* [rector] [CI] Add type-declaration set

* [cs] [CI] Add type-declaration set

* skip nullable void

* add anonymous parent/interface support

* refactor MultiExceptionCatchRector to use Catch_ over integers

* type fixes

* fix unoin array type override

* remove unused test cases

* drop overcomplicated InlineValidationRulesToArrayDefinitionRector

* skip assign on var

* [rector] skip assign on var

* [cs] skip assign on var

* [rector] [cs] skip assign on var

* skip assign on var

* fixes

* [rector] fixes

* [cs] fixes

Co-authored-by: rector-bot <tomas@getrector.org>
2020-09-01 17:56:30 +00:00
Tomas Votruba
042f08f71b
Drop YAML config support (#4081)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-08-30 23:29:39 +02:00
Tomas Votruba
351e59fa3b
Fix array type (#4058)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-08-29 16:20:27 +02:00
Tom Pavelec
dffcae0c82
Fixed some edge cases of creating constant name from value (#4041) 2020-08-27 17:08:49 +02:00
Tomas Votruba
9a88e032a2
[docs] print object configuration (#4010)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-08-23 12:39:59 +02:00
Tomas Votruba
1f61fe34f0
import repo entity (#3988)
* various fixes

* add import for generic types

* bump to newer phpstan with php-parser 4.9
2020-08-19 13:20:16 +00:00
dobryy
2e7bdca4e2
[DX] Rename namespaces respect node type (#3973) 2020-08-18 17:57:30 +02:00