1661 Commits

Author SHA1 Message Date
Abdul Malik Ikhsan
f515c8e3b2
[DeadCode] Typo Fix Imlemented -> Implemented (#5336) 2021-01-27 17:01:38 +01:00
Tomas Votruba
8fa21a8cb0
[Renaming] Add RenameStringRector (#5335)
Co-authored-by: rector-bot <tomas@getrector.org>
2021-01-27 15:31:55 +01:00
Tomas Votruba
fced0ca087
[Symfony] Add Symfony 5.1 set (#5331)
Co-authored-by: rector-bot <tomas@getrector.org>
2021-01-27 15:09:08 +01:00
Abdul Malik Ikhsan
57d7899184
[Symfony 5.2] Upgrade Definition/Alias::setPrivate to setPublic (#5325) 2021-01-27 14:15:57 +01:00
Abdul Malik Ikhsan
453b8ba0b8
[Doctrine] Skip ServiceEntityRepositoryParentCallToDIRector on non __construct method (#5333)
Co-authored-by: Dominik Firla <dominik.firla@carvago.com>
2021-01-27 14:13:27 +01:00
Tomas Votruba
485dce60bc
cleanup (#5322) 2021-01-26 09:50:32 +00:00
Abdul Malik Ikhsan
6ff43c3d7a
[TypeDeclaration] Skip ReturnTypeDeclarationRector when class parent extends is in 'vendor' (#5308)
Co-authored-by: Martin <admin@phpcode.eu>
2021-01-26 10:04:36 +01:00
Tomas Votruba
00d6c60ab1
[ComposerRector] Remove unused MovePackageToRequireComposerRector and MovePackageToRequireDevComposerRector rules (#5321) 2021-01-26 02:51:31 +01:00
Tomas Votruba
e00106ee49
[phpstan] Make ComposerRectorInterface child classes respetc the "ComposerRector" suffix (#5319) 2021-01-26 01:32:23 +00:00
Tomas Votruba
9c26ebf430
static fixes (#5317) 2021-01-25 19:52:41 +00:00
Tomas Votruba
abadc5473b
[CI] add demo for build php 7.1 version (#4447)
* Renamed option to --exclude-path

* Exclude /**/tests/ by default

* Inverted order of downgrade

* Fixed verb

* Use sed to replace string

* Simplified message

* Use PHP version with "."

* Completed PHP versions to downgrade

* Execute Rector with --target-php-version

* Added quotes to array keys

* Allow to print command to output

* Execute script within workflow

* If rector fails, already exit 1

* Ignore PHP constraint

* Removed --dry-run and errors for testing

* Don't print command

* Run downgraded for ALL sets

* Include downgrade sets for testing

* Run all sets in a command each

* Added the target PHP version in each downgrade set

* Use a rector config file to pass exclude paths

* Exclude everything under /tests/

* Removed --dry-run

* Set unneeded transformations in false

* Exclude /ci/

* Exclude /compiler/

* Exclude DoctrineProvider

* Exclude classes for dependency-injection

* Exclude classes for http-kernel

* Exclude classes for symfony string

* Use cut instead of aws
For if the path has a space

* Calculate package execution order

* Downgrade packages on required order

* Consider the set to check package dependents

* Store packages_to_downgrade_by_set

* Store package_dependents["$package|$set"]

* Fixed converting from string to array

* Fixed converting string to array

* Fixed char

* Simplified counter

* Fixed string to array

* Fixed var

* Fixed getting dependents

* Fixed checking if dependent packages downgraded

* rector/rector has no dependents

* Simplified downgraded_packages

* Ignore dependent package on itself

* If circular dependencies, make the process fail

* Uncommented executing rector

* Exclude /stubs

* Calculate circular reference packages

* Break circular references

* Uncommented rector call

* Do downgrade ContainerBuilder

* Added expression-language as dep for PROD

* [ci-review] Generate Rector & Nodes documentation

* [ci-review] Apply coding standards

* [ci-review] Rector Rectify

* Obtain "rector/rector" from composer

* Removed commented code

* Don't do platform check for Composer v2

* Moved comment up

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

* Must dump autload to remove platform_check.php

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

* Copied file from master

* Use new convention (70000) for PHP versions (7.0)

* Fixed cs

* Fixed PHPStan

* Added "create-config" command - Initial commit

* [ci-review] Rector Rectify

* Moved rector config under custom folder

* Use predefined rector configs instead of injecting --set

* Created rector config files

* Use array of rector configs, even if only 1 is used

* Require once config file

* Fixed exclude paths

* Execute only last rector config (containing many sets)

* Exclude file that makes process fail

* Removed --dry-run

* Use existing option name

* Handle GROUP_RECTOR_CONFIGS in circular packages

* Changing PHP_VERSION_ID does not work, so commented rule

* Bug fixed => uncommented using rector

* Renamed NoParticularNodeRule to ForbiddenNodeRule

* [ci-review] Rector Rectify

* Fixed PHP version constants

* Added (failing) test

* Fixed issue for nullable scalars

* Can't run Rector with --set through CLI, removed

* Added (failing) test

* Fixed issue for __construct

* Fixed constant name

* Added (failing) test for self

* Added another (failing) test

* Fixed not adding "\" before "static", "self", etc

* [ci-review] Rector Rectify

* Skip downgrading CouchbaseBucketAdapter

* Renamed var

* Added (failing) test

* Fixed interface and abstract class issue

* [ci-review] Rector Rectify

* Fixed PHPStan error

* Create artifact of downgraded code

* Added missing spaces for args

* Use 4 spaces for consistency

* Ignore build folder in rector-php71.zip

* Switch to setup-php@v2

* Added (failing) test

* Issue is on calling method, not on constructor

* Implemented fix

* Renamed test

* Added further tests

* [ci-review] Rector Rectify

* Fixed PHPStan

* Fixed PHPStan

* Added (failing) test

* Fixed issue on new Class('foo', )

* Execute tests

* No need for quotes

* Made the artifact contain the folder, not a .zip

* Removed /compiler folder (it's been deleted?)

* Do upload the artifact as a .zip (too slow otherwise)

* Remove all tests, also from under vendor/

* Upgraded zip action version

* Change Composer's PHP requirement to 7.1

* Try exclude tests under vendor/

* Renamed artifact

* Try exclude tests under vendor/

* Updated test (to fail)

* If the float has no ".", add ".0" at the end

* Must remove deps before "composer require php"

* Replaced call to phpstan

* Cannot run PHPStan on 7.1, just run Rector

* Change Composer's PHP requirement to 7.1

* Remove DEV dependencies

* Require Symfony Polyfill libraries

* Rector without DEV needs phpstan.neon removed

* Run PHPStan

* Added paths to analyze

* Access PHPStan config from file

* Fixed relative paths

* Override the artifact with downgraded Composer too

* Uncommented scanDirectories

* Include tests/ in artifact

* Exclude */tests/*

* Ignore utils/phpstan-extensions

* PHPUnit is installed in DEV, can't use it in PROD

* "nette/application" is on DEV, may not exist on PROD

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

* Improved comment after rectify

* Fixed previous messed-up merge

* Removed 1st slash

* Downgrade all dependencies together

* Replace the composer.json file

* Can't have more than 1 path to downgrade

* No need to change PHP requirement to 7.1 anymore

* Remove DEV dependencies before replacing composer.json

* Changed order of commands

* No need for --ignore-platform-req=php

* Add all Symfony polyfill libraries

* Require Symfony polyfill libraries earlier on

* Test removing `ignoreErrors` from PHPStan

* Remove ignored errors which do not apply

* Fixed the list of `excludes_analyse`

* Removed commented code

* Fixed PHPStan config

* Only analyze the target PHP version if GROUP_RECTOR_CONFIGS

* Simplified script: just analyze target PHP version

* Renamed downgrade sets

* Removed unneeded create-config command

* Removed call to deleted class

* Dropped ChangePhpVersionInPlatformCheckRector

* Must remove phpstan-for-rector.neon from PROD

* Do not execute --dry-run, it returns error

* Publish downgraded code to remote repository

* Removed commented code

* Standardized script code

* Initialize variables in script

* No need to initialize vars

* Remove the zip, do not copy to target repo

* Remove .git before deploying to target repo

* Copy files to rector-downgrade/

* Use branch "main"

* Copy also hidden files

* Remove docker publish image workflow

* Trigger own tests workflow

* Include "lowest"

* Run PHPStan instead of PHPUnit

* Run PHPStan in new temp directory

* Execute in same item

* "../" for --config doesn't work for PHPStan

* Added bare run test

* Added tests for PHP 7.2

* Added test

* Run with php

* Replaced namespace

* Added PHPUnit test for PHP 7.1

* Use PHP 7.1-compatible version of "doctrine/orm"

* Can't skip downgrading doctrine-annotation-generated

* Removed commented items

* Renamed test workflow

* Added comments on code

* Run all tests, not just 1

* Downgrade package from v3.1 to v3.0.7

* Run existing tests

* Revert tests

* [ci-review] Rector Rectify

Co-authored-by: Leonardo Losoviz <leo@getpop.org>
Co-authored-by: rector-bot <tomas@getrector.org>
2021-01-25 20:25:21 +01:00
Tomas Votruba
402a212737
[Phalcon] Drop custom rules, the framework does not have enough traction (#5313) 2021-01-25 17:34:49 +00:00
Tomas Votruba
f489a4ab6b
remove OrderConstructorDependenciesByTypeAlphabeticallyRector, not used (#5312) 2021-01-25 17:20:21 +00:00
Abdul Malik Ikhsan
8767a57040
[DeadCode] Skip RemoveUnusedPublicMethodRector for all magic methods (#5311) 2021-01-25 17:51:56 +01:00
Tomas Votruba
a0f7656b68
[RemoveAnnotationRector] Add node type support, merge JMS removal rules (#5310) 2021-01-25 16:20:05 +00:00
Tomas Votruba
dba5b8d714
[PHP 7.2] Fix GetClassOnNullRector for self nullable (#5306) 2021-01-25 01:14:11 +00:00
Tomas Votruba
53835a751e
[PHP 7.1] Fix AssignArrayToStringRector for dynamic property fetch names (#5305) 2021-01-24 21:43:15 +00:00
Tomas Votruba
94dedf4bb3
[PHP 7.0] Update self in final class (#5304) 2021-01-24 20:12:02 +00:00
Abdul Malik Ikhsan
31f357d6c0
[BetterPhpDocParser] Handle parseString() got ShouldNotHappenException (#5299)
* Fixes #5267

* cs fix

* use true for 3rd parameter is_a

* try use method_exists

* patch in BetterPhpDocParser

* clean

* clean

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

* phpstan

* phpstan

* phpstan

* add test case

* better solution

* phpstan

* phpstan

* clean up

* clean up

* phpstan

* clean up

* final touch: use ObjectType check instead

* better approach

* ensure $phpDocInfo->getVarTagValueNode() instanceof VarTagValueNode as well

* clean up

* use of the VarTagValueNode

* use of the VarTagValueNode

* use of the VarTagValueNode

* [ci-review] Rector Rectify

* phpstan

Co-authored-by: rector-bot <tomas@getrector.org>
2021-01-24 17:46:06 +01:00
Tomas Votruba
13380b5b16
[CodeQuality] Make ArrayThisCallToThisMethodCallRector private class method (#5303) 2021-01-24 12:56:35 +00:00
Tomas Votruba
9652382639
[CodeQuality] Add SingularSwitchToIfRector (#5302) 2021-01-24 11:23:50 +00:00
Tomas Votruba
0e2da52ee8
[TypeDeclaration] Fix return array strict (#5300) 2021-01-24 09:15:16 +00:00
Abdul Malik Ikhsan
c5132286f8
[PHP 5.6] Handle empty array initialization for Undefined array in AddDefaultValueForUndefinedVariableRector (#5293)
* Add failing test fixture for AddDefaultValueForUndefinedVariableRector

# Failing Test for AddDefaultValueForUndefinedVariableRector

Based on https://getrector.org/demo/62ab1e88-6035-4fa6-87bb-c600dac418b2

* Closes #5260 Fixes #5253

* fixture name

* phpstan

* clean up

* [ci-review] Rector Rectify

Co-authored-by: vladyslavstartsev <17382248+vladyslavstartsev@users.noreply.github.com>
Co-authored-by: rector-bot <tomas@getrector.org>
2021-01-23 18:05:33 +01:00
vladyslavstartsev
10b96a0b97
Make example of ReplaceStringWithClassConstantRector more correct (#5269)
* Make example of ReplaceStringWithClassConstantRector more correct

- `argument position` and `class with constants` are swapped
- `argument position` starts with zero (0), so `1` is the second argument

* also fix example in `Rector`ing class
2021-01-23 14:51:23 +02:00
Abdul Malik Ikhsan
8cd6dbea3b
[TypeDeclaration] Skip ParamTypeDeclarationRector on interface with extends (#5292)
* Add failing test fixture for ParamTypeDeclarationRector

# Failing Test for ParamTypeDeclarationRector

Based on https://getrector.org/demo/56b352cf-6ba5-4fd5-8186-dd071d1e4010

* Fix namespace position

* Update rules/type-declaration/tests/Rector/FunctionLike/ParamTypeDeclarationRector/Fixture/vat_rate.php.inc

Co-authored-by: Abdul Malik Ikhsan <samsonasik@gmail.com>

* Update rules/type-declaration/tests/Rector/FunctionLike/ParamTypeDeclarationRector/Fixture/vat_rate.php.inc

Co-authored-by: Abdul Malik Ikhsan <samsonasik@gmail.com>

* Update interfaces' names

* Rename vat_rate.php.inc to skip_different_with_interface.php.inc

* Close #5274 Fixes #5270

* cs fix

Co-authored-by: Adamo Crespi <hello@aerendir.me>
2021-01-23 12:38:30 +01:00
Tomas Votruba
d08f63fb1b
[RemovingStatic] Keep static if required by parent contract (#5291) 2021-01-23 09:46:25 +00:00
Tomas Votruba
87072b597d
PHP 7.4 8 typo (#5290) 2021-01-22 23:11:10 +00:00
TomasVotruba
1aac87f335 [PHP 8.0] Remove useless var 2021-01-22 20:22:51 +01:00
TomasVotruba
442f617031 make sure doc is skipped 2021-01-22 20:14:10 +01: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
9cd09e9512
[PHP 8.0] skip alternative arg count (#5283) 2021-01-22 09:37:29 +00:00
Pierre du Plessis
7db7d4e037
Don't skip add \ prefix for function when auto import name enabled (#5280) 2021-01-22 09:24:16 +00:00
Tomas Votruba
1d92bb71cc
[PHP 8.0] Add method call support (#5281)
* [PHP 8.0] Add skip external one

* add method call support

* [ci-review] Rector Rectify

Co-authored-by: rector-bot <tomas@getrector.org>
2021-01-22 10:16:00 +01:00
Tomas Votruba
3e96fab69f
[PHP 8.0] Add new support to RequireOptionalParamResolver (#5279) 2021-01-22 01:41:09 +00:00
Jarek Jakubowski
f866e25b1f
Fix match without return (#5237) 2021-01-22 01:20:13 +01:00
Tomas Votruba
e90a430bcf
[PHP 8.0] Add OptionalParametersAfterRequiredRector (#5277) 2021-01-22 00:17:43 +00:00
Tomas Votruba
f7fc1ea144
skip presenter on control parent/name remover (#5278) 2021-01-22 01:15:05 +01:00
Tomas Votruba
8b6b1a81e8
misc (#5276)
Co-authored-by: rector-bot <tomas@getrector.org>
2021-01-21 21:58:26 +01:00
Abdul Malik Ikhsan
d300cc0464
[Symfony4] Skip ConsoleExecuteReturnIntRector on cast int return (#5275)
* Add failing test fixture for ConsoleExecuteReturnIntRector

# Failing Test for ConsoleExecuteReturnIntRector

Based on https://getrector.org/demo/2ce24767-1f3c-4f0c-b74f-bbea4b441678

* skip duplicated code

* Close #5272 Fixes #5273

* fixture

* ensure parent is return for Int_ cast skip

* ensure parent is return for Int_ cast skip

Co-authored-by: vladyslavstartsev <17382248+vladyslavstartsev@users.noreply.github.com>
2021-01-21 18:41:06 +01:00
Abdul Malik Ikhsan
bf94f4c420
[Performance] Handle PreslashSimpleFunctionRector on Option::AUTO_IMPORT_NAMES => true (#5268)
Co-authored-by: Pierre <pierre@pcservice.co.za>
Co-authored-by: rector-bot <tomas@getrector.org>
2021-01-21 14:06:03 +01:00
Tomas Votruba
87494ce3a6
Print only changed docblocks 🎉🎉🎉 (#5251) 2021-01-20 16:17:59 +00:00
Tomas Votruba
85e7f7fa2c
Make remove parent/name only on component, skip form (#5266) 2021-01-20 15:57:49 +00:00
Tomas Votruba
7d001c13b0
Move FlipTypeControlToUseExclusiveTypeRector from type declaration to code-quality-strict, as it might be opinionated and aim at higher level programming (#5265) 2021-01-20 15:24:57 +00:00
Tomas Votruba
f4eb05998b
extend Nette 3.1 set (#5261) 2021-01-20 13:08:23 +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
Abdul Malik Ikhsan
d5fc2cb8f5
[DeadCode] Skip RemoveUnusedPublicMethodRector on __construct (#5258)
* Add failing test fixture for RemoveUnusedPublicMethodRector

# Failing Test for RemoveUnusedPublicMethodRector

Based on https://getrector.org/demo/48213d30-8e42-4f9f-885b-30906a78970f

#5256

* Close #5257 Fixes #5256

Co-authored-by: Jan Lohage <j2L4e@users.noreply.github.com>
2021-01-20 12:19:11 +01:00
Michal Lulco
f386ccd8ce
Upgrade to Nette 3.1 (#5195) 2021-01-20 12:17:16 +01:00
Tomas Votruba
34168ff9d8
various cherry picks (#5248) 2021-01-19 23:29:52 +00:00
Tomas Votruba
05356b393a
Getting rid of attribute (#5246)
Co-authored-by: rector-bot <tomas@getrector.org>
2021-01-19 22:32:28 +01:00