799 Commits

Author SHA1 Message Date
TomasVotruba
ce1439826c allow phpstan new, now with fixed in symplify 2021-01-29 20:06:27 +01:00
Tomas Votruba
024ec4ba93
[Generics] Add GenericsPHPStormMethodAnnotationRector (#5365)
Co-authored-by: rector-bot <tomas@getrector.org>
2021-01-29 17:24:20 +01:00
Alessandro Lai
033b2a38e9
Allow PrettyVersion 2 (#5364) 2021-01-29 17:14:06 +01:00
Tomas Votruba
53102c9c29
[Removing] Init new set (#5360)
Co-authored-by: rector-bot <tomas@getrector.org>
2021-01-29 08:08:55 +00:00
Tomas Votruba
34c0f08969
[Generic] Split rules to their particular categories (#5354)
Co-authored-by: rector-bot <tomas@getrector.org>
2021-01-29 00:32:20 +01:00
Tomas Votruba
e0db712dec
[Symfony 5.2] Add LogoutHandlerToLogoutEventSubscriberRector (#5337) 2021-01-28 14:36:46 +00:00
Abdul Malik Ikhsan
a54819aba8
[Symfony 5.2] Add FormBuilderSetDataMapperRector (#5339)
Co-authored-by: rector-bot <tomas@getrector.org>
2021-01-28 13:57:27 +01:00
Tomas Votruba
485dce60bc
cleanup (#5322) 2021-01-26 09:50:32 +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
a0f7656b68
[RemoveAnnotationRector] Add node type support, merge JMS removal rules (#5310) 2021-01-25 16:20:05 +00:00
Michal Lulco
c6ab3bf015
Added missing symfony/process to composer.json (#5264) 2021-01-20 15:12:17 +01:00
Tomas Votruba
66d0b61a9d
[Comments] Decouple new package (#5239)
* [Comments] Decopule new package

* fix RemoveNonExistingVarAnnotationRector

* decopule PropertyFetchFinder

* misc

* fix fixed printer

* fix import

* remove dead code

* fix comparing nodes with tokens instead of identical compare

* remove complexity

* decouple IndentCharacterDetector

* [ci-review] Rector Rectify

Co-authored-by: rector-bot <tomas@getrector.org>
2021-01-19 19:11:10 +00:00
Tomas Votruba
1cd0e1004f
add missing astral package (#5182) 2021-01-14 12:03:13 +00:00
Tomas Votruba
713915d1b2
Polishing composer rules (#5170)
* [Composer] Add check for existing compsore.json

* update composer package

* coding style

* various static fixes
2021-01-13 13:02:14 +00:00
Michal Lulco
4bd4a4657b
Full upgrade of codebase including changes in composer.json (#5074)
* Composer changer

* Implemented ChangePackage, ChangePackageVersion and RemovePackage with tests

* Refactored composer processor

* Refaktoring

* Added missing tests

* Added void return type to test

* Changed namespaces and fixed CI tests

* Apply rector rules

* Moved new line to processor from modifier

* Use array copies in tests

* Added descriptions to all construct parameters and inheritDoc to modify methods

* Rewritten ComposerModifierTest to use AbstractKernelTestCase and ComposerModifier as service

* Split MovePackage to 2 classes

* Sort packages if it is set in config

* Rectified

* Rename class ChangePackage to ReplacePackage

* Split class AddPackage to AddPackageToRequire and AddPackageToRequireDev

* Added Version checker and moved modifier classes to separated folder

* Changed array to ComposerJson in modify methods

* Rectifying

* Removed unnecessary docs

* Temporary added fork of composer-json-manipulator

* Removed unused code and replaced InvalidArgumentException to assert
2021-01-12 22:50:42 +01:00
Tomas Votruba
d1df8f76cd
drop PHPStanAttributeTypeSyncer, handled by external package (#5131) 2021-01-10 14:51:27 +01:00
TomasVotruba
1aa0cb4550 bump deps 2021-01-10 02:28:32 +01:00
Tomas Votruba
d478992160
Fix deprecated ref() to service() function, skip empty file (#5112)
* composer: bump to symfony/dependency-injection 5.1, required as minimum by other deps anyway

* use service() over deprecated ref()

* skip empty files

* skip just created props
2021-01-08 14:04:35 +00:00
Abdul Malik Ikhsan
e1c89d17f6
[fixtures] Enable validate-fixture-skip-naming check (#5081)
* [fixtures] Enable validate-fixture-skip-naming check

* full path vendor vendor/symplify/easy-testing/bin/easy-testing validate-fixture-skip-naming rules tests

* 21 files

* more fixture

* various fix

* various fix

* more fixtures

* apply to packages rules tests utils

* more fixtures

* more fixtures

* more fixtures

* more fixtures

* more fixtures

* more fixtures

* more fixtures

* fixture fix

* done

* fixture fix
2021-01-04 14:18:27 +01:00
Tomas Votruba
014c019449
[fixtures] require skip prefix on skipped files (#5079)
* skip unnecesary test case

* namespace corrections, skip prefix corrections

* hide for now

* skip new phpstan cases
2021-01-03 15:54:27 +00:00
Grzegorz Korba
a43d3e3863
Lower requirement for phpstan/phpdoc-parser (#5039) 2020-12-29 16:09:15 +01:00
Tomas Votruba
630c3d324e
[PhpVersionResolver] Add project composer.json as source + decouple to composer json fatcory (#5031)
* [PhpVersionResolver] Add project composer.json as source + decouple to composer json fatcory

* [ci-review] Rector Rectify

Co-authored-by: rector-bot <tomas@getrector.org>
2020-12-29 00:32:48 +00:00
Tomas Votruba
52e604c6dd
[scoper] unprefix string classes to match types (#5025) 2020-12-28 23:09:11 +01:00
Tomas Votruba
d4883d44d9
[Prefixed Rector] Add package-scoper approach (#4559) 2020-12-26 00:17:31 +01:00
Tomas Votruba
ed475a2e3c
[static] no nullable node (#4995)
* move phpstan.neon cusotm rules to rector-rules.neon, to cleanup main config

* enable forbidden rule on nullable nodes

* bump to Symplify 9.0.17

* make name non-nullable

* skip non-nullable

* skip null dim
2020-12-25 20:50:50 +00:00
Tomas Votruba
d256bbd8c0
change rector-ci.php to rector.php (#4994) 2020-12-25 19:11:33 +01:00
Tomas Votruba
51dd6b899a
[SOLID] Drop UseInterfaceOverImplementationInConstructorRector, very subjective (#4993) 2020-12-25 17:24:53 +00:00
Tomas Votruba
a4f8a23ecf
[CodeQuality] Move MoveVariableDeclarationNearReferenceRector (#4992) 2020-12-25 17:48:15 +01:00
Tomas Votruba
db89b5eefa
[CodeQuality] Move MoveVariableDeclarationNearReferenceRector (#4989)
* [CodeQuality] Move MoveVariableDeclarationNearReferenceRector

* move code-quality-strict rules to own namespace

* move MoveVariableDeclarationNearReferenceRector to CodeQualityStrict

* add ClassConstFetchFactory

* static fixes
2020-12-25 16:22:19 +00:00
Tomas Votruba
a2dbaedb0e
[Privatization] Move MakeUnusedClassesWithChildrenAbstractRector here (#4987) 2020-12-25 15:45:17 +01:00
Tomas Votruba
cffd7ea0ac
[CodingStyle] Move PHPStormVarAnnotationRector (#4985)
* [CodingStyle] Move PHPStormVarAnnotationRector

* [ci-review] Rector Rectify

* [DeadDocBlock] Move RemoveNonExistingVarAnnotationRector here (#4984)

* [DeadDocBlock] Move RemoveNonExistingVarAnnotationRector here

* [ci-review] Rector Rectify

Co-authored-by: rector-bot <tomas@getrector.org>

* [ci-review] Rector Rectify

* cleanup docs

* static fixes

* [ci-review] Rector Rectify

* remove duplicated

* multi use case

* misc

* [ci-review] Rector Rectify

* fixes

* remove order set, slow

* move UseMessageVariableForSprintfInSymfonyStyleRector from solid set to coding-style

* make unique-named variables to prevent accidental override and improve readability

Co-authored-by: rector-bot <tomas@getrector.org>
2020-12-25 13:20:13 +00:00
Tomas Votruba
5a47e36b72
Add Visibility consts (#4981) 2020-12-24 23:01:30 +01:00
Tomas Votruba
319d6bfca1
add phpstan-for-rector config path, consolidate return type extensions - re-use from Symplify (#4973)
* add phpstan-for-rector config path, to separate phpstan and extensions that help Rector with precise types

* move type value object to value object

* moving

* remove KernelGetContainerAfterBootReturnTypeExtension, use one from symplify

* remove ContainerGetDynamicMethodReturnTypeExtension to ContainerGetReturnTypeExtension

* remove nette extension

* add nette-extension

* removed delegated rule

* delegate implmenets + code sample PHPStan rule to symplify
2020-12-24 16:31:24 +00:00
Tomas Votruba
61e1ceaf5c
Cover ArrayShape type and other doc nodes (#4967)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-12-23 22:11:37 +01:00
Tomas Votruba
c5d258e0cc
[Downgrade] Drop ChangePhpVersionInPlatformCheckRector as not useful, paltform check false is good enough (#4939)
* [Downgrade] Drop ChangePhpVersionInPlatformCheckRector as not useful, paltform check false is good enough

* fixup! [Downgrade] Drop ChangePhpVersionInPlatformCheckRector as not useful, paltform check false is good enough
2020-12-22 15:48:25 +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
Tomas Votruba
eddb2b29c9
[EarlyReturn] Decouple new rules (#4868) 2020-12-12 16:59:09 +00:00
Tomas Votruba
f197e25793
droping events (#4865)
* drop unused ReportCollector and releted avain chains

* update fixed comma trail downgrade in php-parser

* add post runner interface

* [CodingStyle] Enabe post-inc-dec

* [ci-review] Rector Rectify

* test ci

* bump phpunit

Co-authored-by: rector-bot <tomas@getrector.org>
2020-12-12 14:58:47 +00:00
Tomas Votruba
56dedb1786
static fixes (#4864)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-12-12 14:53:10 +01:00
Tomas Votruba
db5e02e724
static fixes (#4860)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-12-12 13:08:34 +01:00
Krystian Marcisz
35ceeff106
[Symfony] Split Symfony rules to dedicated namespaces (#4858) 2020-12-11 23:51:20 +01:00
Tomas Votruba
d27997197b
Static updates (#4857) 2020-12-11 18:25:42 +01: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
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
c68fd43b65
Bump to Symplify 9 (#4830)
* composer: bump to Symplify 9

* fix cs

* update InputDetector to StaticInputDetector

* add missign symplify/ packages

* remove already included phpstan configs

* [CI] test lowest deps on PHP 7.3, as minimum for Symplify 9

* bump doctrine/inflector and sebastian/diff

* [CI] symplify PHP 7.3 testing
2020-12-09 15:41:23 +00:00
Leonardo Losoviz
7c991a9898
[Downgrade PHP 7.0] Remove param and return types (#4819)
Co-authored-by: rector-bot <tomas@getrector.org>
2020-12-08 13:02:26 +01:00
Tomas Votruba
ca353017e2
[Utils] Add OnlyOneClassMethodRule (#4814)
* [Utils] Add OnlyOneClassMethodRule

* [ci-review] Rector Rectify

Co-authored-by: rector-bot <tomas@getrector.org>
2020-12-07 00:48:01 +00:00
Tomas Votruba
8bfb36d0b2
[Downgrade] [PHP 7.3] Downgrade trailing commas in function calls (#4796)
Co-authored-by: Tommy Quissens <tommy.quissens@storefront.be>
Co-authored-by: rector-bot <tomas@getrector.org>
2020-12-05 22:40:10 +01:00