From a83530af3559ee54b1212c376e029f6faf56b067 Mon Sep 17 00:00:00 2001 From: lubiana Date: Mon, 29 May 2023 20:30:17 +0200 Subject: [PATCH 01/15] bump versions --- composer.json | 6 ++--- composer.lock | 72 +++++++++++++++++++++++++-------------------------- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/composer.json b/composer.json index 20c5457..8cb1c41 100644 --- a/composer.json +++ b/composer.json @@ -8,9 +8,9 @@ } }, "require": { - "slevomat/coding-standard": "^8.9", - "symplify/easy-coding-standard": "^11.3.2", - "rector/rector": "^0.15.23" + "slevomat/coding-standard": "^8.12.1", + "symplify/easy-coding-standard": "^11.3.4", + "rector/rector": "^0.16.0" }, "config": { "allow-plugins": { diff --git a/composer.lock b/composer.lock index eebf85b..8cf1292 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "959b2ea13afa4a341c7d2ad2cf7c38f8", + "content-hash": "f25cb69dd8eb380eb2a8fdc886671eb1", "packages": [ { "name": "dealerdirect/phpcodesniffer-composer-installer", @@ -86,16 +86,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.16.1", + "version": "1.20.4", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "e27e92d939e2e3636f0a1f0afaba59692c0bf571" + "reference": "7d568c87a9df9c5f7e8b5f075fc469aa8cb0a4cd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/e27e92d939e2e3636f0a1f0afaba59692c0bf571", - "reference": "e27e92d939e2e3636f0a1f0afaba59692c0bf571", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/7d568c87a9df9c5f7e8b5f075fc469aa8cb0a4cd", + "reference": "7d568c87a9df9c5f7e8b5f075fc469aa8cb0a4cd", "shasum": "" }, "require": { @@ -125,22 +125,22 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.16.1" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.20.4" }, - "time": "2023-02-07T18:11:17+00:00" + "time": "2023-05-02T09:19:37+00:00" }, { "name": "phpstan/phpstan", - "version": "1.10.8", + "version": "1.10.15", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "0166aef76e066f0dd2adc2799bdadfa1635711e9" + "reference": "762c4dac4da6f8756eebb80e528c3a47855da9bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0166aef76e066f0dd2adc2799bdadfa1635711e9", - "reference": "0166aef76e066f0dd2adc2799bdadfa1635711e9", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/762c4dac4da6f8756eebb80e528c3a47855da9bd", + "reference": "762c4dac4da6f8756eebb80e528c3a47855da9bd", "shasum": "" }, "require": { @@ -189,25 +189,25 @@ "type": "tidelift" } ], - "time": "2023-03-24T10:28:16+00:00" + "time": "2023-05-09T15:28:01+00:00" }, { "name": "rector/rector", - "version": "0.15.23", + "version": "0.16.0", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "f4984ebd62b3613002869b0ddd6868261d62819e" + "reference": "2125ff71ea05b079562a8f59ca48a97eb78dc07f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/f4984ebd62b3613002869b0ddd6868261d62819e", - "reference": "f4984ebd62b3613002869b0ddd6868261d62819e", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/2125ff71ea05b079562a8f59ca48a97eb78dc07f", + "reference": "2125ff71ea05b079562a8f59ca48a97eb78dc07f", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.10.1" + "phpstan/phpstan": "^1.10.14" }, "conflict": { "rector/rector-doctrine": "*", @@ -242,7 +242,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.15.23" + "source": "https://github.com/rectorphp/rector/tree/0.16.0" }, "funding": [ { @@ -250,36 +250,36 @@ "type": "github" } ], - "time": "2023-03-22T15:22:45+00:00" + "time": "2023-05-05T12:12:17+00:00" }, { "name": "slevomat/coding-standard", - "version": "8.9.0", + "version": "8.12.1", "source": { "type": "git", "url": "https://github.com/slevomat/coding-standard.git", - "reference": "8f11e0f5ff984d6862bb9d83aa513dc05a1773ef" + "reference": "f69e2524e8770efb9b3e5ac4a0ebc0d54eb446d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/8f11e0f5ff984d6862bb9d83aa513dc05a1773ef", - "reference": "8f11e0f5ff984d6862bb9d83aa513dc05a1773ef", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/f69e2524e8770efb9b3e5ac4a0ebc0d54eb446d7", + "reference": "f69e2524e8770efb9b3e5ac4a0ebc0d54eb446d7", "shasum": "" }, "require": { "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7 || ^1.0", "php": "^7.2 || ^8.0", - "phpstan/phpdoc-parser": ">=1.16.0 <1.17.0", + "phpstan/phpdoc-parser": ">=1.20.0 <1.21.0", "squizlabs/php_codesniffer": "^3.7.1" }, "require-dev": { "phing/phing": "2.17.4", "php-parallel-lint/php-parallel-lint": "1.3.2", - "phpstan/phpstan": "1.4.10|1.10.8", + "phpstan/phpstan": "1.10.15", "phpstan/phpstan-deprecation-rules": "1.1.3", - "phpstan/phpstan-phpunit": "1.0.0|1.3.10", - "phpstan/phpstan-strict-rules": "1.5.0", - "phpunit/phpunit": "7.5.20|8.5.21|9.6.5" + "phpstan/phpstan-phpunit": "1.3.11", + "phpstan/phpstan-strict-rules": "1.5.1", + "phpunit/phpunit": "7.5.20|8.5.21|9.6.8|10.1.3" }, "type": "phpcodesniffer-standard", "extra": { @@ -303,7 +303,7 @@ ], "support": { "issues": "https://github.com/slevomat/coding-standard/issues", - "source": "https://github.com/slevomat/coding-standard/tree/8.9.0" + "source": "https://github.com/slevomat/coding-standard/tree/8.12.1" }, "funding": [ { @@ -315,7 +315,7 @@ "type": "tidelift" } ], - "time": "2023-03-25T15:52:37+00:00" + "time": "2023-05-15T21:42:25+00:00" }, { "name": "squizlabs/php_codesniffer", @@ -376,16 +376,16 @@ }, { "name": "symplify/easy-coding-standard", - "version": "11.3.2", + "version": "11.3.4", "source": { "type": "git", "url": "https://github.com/easy-coding-standard/easy-coding-standard.git", - "reference": "d4159e06c0970e71a2a58d350160241e7cb3994b" + "reference": "c72eb4bdf30e54de2d31aef596f96642ff443741" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/easy-coding-standard/easy-coding-standard/zipball/d4159e06c0970e71a2a58d350160241e7cb3994b", - "reference": "d4159e06c0970e71a2a58d350160241e7cb3994b", + "url": "https://api.github.com/repos/easy-coding-standard/easy-coding-standard/zipball/c72eb4bdf30e54de2d31aef596f96642ff443741", + "reference": "c72eb4bdf30e54de2d31aef596f96642ff443741", "shasum": "" }, "require": { @@ -418,7 +418,7 @@ ], "support": { "issues": "https://github.com/easy-coding-standard/easy-coding-standard/issues", - "source": "https://github.com/easy-coding-standard/easy-coding-standard/tree/11.3.2" + "source": "https://github.com/easy-coding-standard/easy-coding-standard/tree/11.3.4" }, "funding": [ { @@ -430,7 +430,7 @@ "type": "github" } ], - "time": "2023-03-22T15:28:51+00:00" + "time": "2023-05-10T14:44:08+00:00" } ], "packages-dev": [], From 5d731e63f9fc56c127b9f0f87049b2b52a53d687 Mon Sep 17 00:00:00 2001 From: lubiana Date: Fri, 1 Sep 2023 07:52:22 +0200 Subject: [PATCH 02/15] update rector rules. bump versions --- composer.json | 13 ++++++-- composer.lock | 77 +++++++++++++++++++++++------------------------ config/rector.php | 8 ++--- 3 files changed, 49 insertions(+), 49 deletions(-) diff --git a/composer.json b/composer.json index 8cb1c41..a241af0 100644 --- a/composer.json +++ b/composer.json @@ -8,13 +8,20 @@ } }, "require": { - "slevomat/coding-standard": "^8.12.1", - "symplify/easy-coding-standard": "^11.3.4", - "rector/rector": "^0.16.0" + "slevomat/coding-standard": "^8.13", + "symplify/easy-coding-standard": "^12.0", + "rector/rector": "^0.18.1" }, "config": { "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": true } + }, + "scripts": { + "fix": [ + "rector", + "ecs --fix", + "ecs --fix" + ] } } diff --git a/composer.lock b/composer.lock index 8cf1292..a6c3597 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f25cb69dd8eb380eb2a8fdc886671eb1", + "content-hash": "0db36479542579fe3ed4d0a242e19390", "packages": [ { "name": "dealerdirect/phpcodesniffer-composer-installer", @@ -86,22 +86,24 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.20.4", + "version": "1.23.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "7d568c87a9df9c5f7e8b5f075fc469aa8cb0a4cd" + "reference": "846ae76eef31c6d7790fac9bc399ecee45160b26" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/7d568c87a9df9c5f7e8b5f075fc469aa8cb0a4cd", - "reference": "7d568c87a9df9c5f7e8b5f075fc469aa8cb0a4cd", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/846ae76eef31c6d7790fac9bc399ecee45160b26", + "reference": "846ae76eef31c6d7790fac9bc399ecee45160b26", "shasum": "" }, "require": { "php": "^7.2 || ^8.0" }, "require-dev": { + "doctrine/annotations": "^2.0", + "nikic/php-parser": "^4.15", "php-parallel-lint/php-parallel-lint": "^1.2", "phpstan/extension-installer": "^1.0", "phpstan/phpstan": "^1.5", @@ -125,22 +127,22 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.20.4" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.23.1" }, - "time": "2023-05-02T09:19:37+00:00" + "time": "2023-08-03T16:32:59+00:00" }, { "name": "phpstan/phpstan", - "version": "1.10.15", + "version": "1.10.32", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "762c4dac4da6f8756eebb80e528c3a47855da9bd" + "reference": "c47e47d3ab03137c0e121e77c4d2cb58672f6d44" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/762c4dac4da6f8756eebb80e528c3a47855da9bd", - "reference": "762c4dac4da6f8756eebb80e528c3a47855da9bd", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c47e47d3ab03137c0e121e77c4d2cb58672f6d44", + "reference": "c47e47d3ab03137c0e121e77c4d2cb58672f6d44", "shasum": "" }, "require": { @@ -189,25 +191,25 @@ "type": "tidelift" } ], - "time": "2023-05-09T15:28:01+00:00" + "time": "2023-08-24T21:54:50+00:00" }, { "name": "rector/rector", - "version": "0.16.0", + "version": "0.18.1", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "2125ff71ea05b079562a8f59ca48a97eb78dc07f" + "reference": "ee72ef542680a7f47ed8c6784f78b032c0d2f381" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/2125ff71ea05b079562a8f59ca48a97eb78dc07f", - "reference": "2125ff71ea05b079562a8f59ca48a97eb78dc07f", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/ee72ef542680a7f47ed8c6784f78b032c0d2f381", + "reference": "ee72ef542680a7f47ed8c6784f78b032c0d2f381", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.10.14" + "phpstan/phpstan": "^1.10.31" }, "conflict": { "rector/rector-doctrine": "*", @@ -219,11 +221,6 @@ "bin/rector" ], "type": "library", - "extra": { - "branch-alias": { - "dev-main": "0.15-dev" - } - }, "autoload": { "files": [ "bootstrap.php" @@ -242,7 +239,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.16.0" + "source": "https://github.com/rectorphp/rector/tree/0.18.1" }, "funding": [ { @@ -250,36 +247,36 @@ "type": "github" } ], - "time": "2023-05-05T12:12:17+00:00" + "time": "2023-08-28T18:01:58+00:00" }, { "name": "slevomat/coding-standard", - "version": "8.12.1", + "version": "8.13.4", "source": { "type": "git", "url": "https://github.com/slevomat/coding-standard.git", - "reference": "f69e2524e8770efb9b3e5ac4a0ebc0d54eb446d7" + "reference": "4b2af2fb17773656d02fbfb5d18024ebd19fe322" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/f69e2524e8770efb9b3e5ac4a0ebc0d54eb446d7", - "reference": "f69e2524e8770efb9b3e5ac4a0ebc0d54eb446d7", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/4b2af2fb17773656d02fbfb5d18024ebd19fe322", + "reference": "4b2af2fb17773656d02fbfb5d18024ebd19fe322", "shasum": "" }, "require": { "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7 || ^1.0", "php": "^7.2 || ^8.0", - "phpstan/phpdoc-parser": ">=1.20.0 <1.21.0", + "phpstan/phpdoc-parser": "^1.23.0", "squizlabs/php_codesniffer": "^3.7.1" }, "require-dev": { "phing/phing": "2.17.4", "php-parallel-lint/php-parallel-lint": "1.3.2", - "phpstan/phpstan": "1.10.15", + "phpstan/phpstan": "1.10.26", "phpstan/phpstan-deprecation-rules": "1.1.3", - "phpstan/phpstan-phpunit": "1.3.11", + "phpstan/phpstan-phpunit": "1.3.13", "phpstan/phpstan-strict-rules": "1.5.1", - "phpunit/phpunit": "7.5.20|8.5.21|9.6.8|10.1.3" + "phpunit/phpunit": "7.5.20|8.5.21|9.6.8|10.2.6" }, "type": "phpcodesniffer-standard", "extra": { @@ -303,7 +300,7 @@ ], "support": { "issues": "https://github.com/slevomat/coding-standard/issues", - "source": "https://github.com/slevomat/coding-standard/tree/8.12.1" + "source": "https://github.com/slevomat/coding-standard/tree/8.13.4" }, "funding": [ { @@ -315,7 +312,7 @@ "type": "tidelift" } ], - "time": "2023-05-15T21:42:25+00:00" + "time": "2023-07-25T10:28:55+00:00" }, { "name": "squizlabs/php_codesniffer", @@ -376,16 +373,16 @@ }, { "name": "symplify/easy-coding-standard", - "version": "11.3.4", + "version": "12.0.7", "source": { "type": "git", "url": "https://github.com/easy-coding-standard/easy-coding-standard.git", - "reference": "c72eb4bdf30e54de2d31aef596f96642ff443741" + "reference": "79b5679f0dd758311770543969087b8dc46429ee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/easy-coding-standard/easy-coding-standard/zipball/c72eb4bdf30e54de2d31aef596f96642ff443741", - "reference": "c72eb4bdf30e54de2d31aef596f96642ff443741", + "url": "https://api.github.com/repos/easy-coding-standard/easy-coding-standard/zipball/79b5679f0dd758311770543969087b8dc46429ee", + "reference": "79b5679f0dd758311770543969087b8dc46429ee", "shasum": "" }, "require": { @@ -418,7 +415,7 @@ ], "support": { "issues": "https://github.com/easy-coding-standard/easy-coding-standard/issues", - "source": "https://github.com/easy-coding-standard/easy-coding-standard/tree/11.3.4" + "source": "https://github.com/easy-coding-standard/easy-coding-standard/tree/12.0.7" }, "funding": [ { @@ -430,7 +427,7 @@ "type": "github" } ], - "time": "2023-05-10T14:44:08+00:00" + "time": "2023-08-24T21:43:33+00:00" } ], "packages-dev": [], diff --git a/config/rector.php b/config/rector.php index 5713df5..1cf8f58 100644 --- a/config/rector.php +++ b/config/rector.php @@ -20,9 +20,8 @@ use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRect use Rector\EarlyReturn\Rector\If_\ChangeAndIfToEarlyReturnRector; use Rector\EarlyReturn\Rector\If_\ChangeNestedIfsToEarlyReturnRector; use Rector\EarlyReturn\Rector\If_\ChangeOrIfContinueToMultiContinueRector; -use Rector\EarlyReturn\Rector\If_\ChangeOrIfReturnToEarlyReturnRector; +use Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector; use Rector\EarlyReturn\Rector\Return_\PreparedValueToEarlyReturnRector; -use Rector\EarlyReturn\Rector\Return_\ReturnBinaryAndToEarlyReturnRector; use Rector\EarlyReturn\Rector\Return_\ReturnBinaryOrToEarlyReturnRector; use Rector\EarlyReturn\Rector\StmtsAwareInterface\ReturnEarlyIfVariableRector; use Rector\Php80\Rector\ClassConstFetch\ClassOnThisVariableObjectRector; @@ -41,7 +40,6 @@ use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictNativeCallRect use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictNewArrayRector; use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedCallRector; use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedPropertyRector; -use Rector\TypeDeclaration\Rector\Closure\AddClosureReturnTypeRector; use Rector\TypeDeclaration\Rector\FunctionLike\AddParamTypeSplFixedArrayRector; use Rector\TypeDeclaration\Rector\FunctionLike\AddReturnTypeDeclarationFromYieldsRector; use Rector\TypeDeclaration\Rector\Param\ParamTypeFromStrictTypedPropertyRector; @@ -52,7 +50,6 @@ return static function (RectorConfig $c): void { $c->sets([LevelSetList::UP_TO_PHP_82]); $c->rules([ AddArrowFunctionReturnTypeRector::class, - AddClosureReturnTypeRector::class, AddMethodCallBasedStrictParamTypeRector::class, AddParamTypeFromPropertyTypeRector::class, AddParamTypeSplFixedArrayRector::class, @@ -63,7 +60,6 @@ return static function (RectorConfig $c): void { ChangeNestedForeachIfsToEarlyContinueRector::class, ChangeNestedIfsToEarlyReturnRector::class, ChangeOrIfContinueToMultiContinueRector::class, - ChangeOrIfReturnToEarlyReturnRector::class, ClassOnThisVariableObjectRector::class, CountArrayToEmptyArrayComparisonRector::class, ExplicitBoolCompareRector::class, @@ -77,7 +73,6 @@ return static function (RectorConfig $c): void { ParamTypeFromStrictTypedPropertyRector::class, PreparedValueToEarlyReturnRector::class, ReplaceMultipleBooleanNotRector::class, - ReturnBinaryAndToEarlyReturnRector::class, ReturnBinaryOrToEarlyReturnRector::class, ReturnEarlyIfVariableRector::class, ReturnTypeFromReturnDirectArrayRector::class, @@ -96,5 +91,6 @@ return static function (RectorConfig $c): void { ThrowWithPreviousExceptionRector::class, TypedPropertyFromStrictConstructorRector::class, TypedPropertyFromStrictGetterMethodReturnTypeRector::class, + RemoveAlwaysElseRector::class, ]); }; From 3c9679da8e78adf500b51b3b2668f8942794200b Mon Sep 17 00:00:00 2001 From: lubiana Date: Wed, 29 Nov 2023 17:14:42 +0100 Subject: [PATCH 03/15] bump dependencies --- composer.json | 6 ++--- composer.lock | 74 +++++++++++++++++++++++++-------------------------- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/composer.json b/composer.json index a241af0..4be773a 100644 --- a/composer.json +++ b/composer.json @@ -8,9 +8,9 @@ } }, "require": { - "slevomat/coding-standard": "^8.13", - "symplify/easy-coding-standard": "^12.0", - "rector/rector": "^0.18.1" + "slevomat/coding-standard": "^8.14.1", + "symplify/easy-coding-standard": "^12.0.9", + "rector/rector": "^0.18.11" }, "config": { "allow-plugins": { diff --git a/composer.lock b/composer.lock index a6c3597..f5b66ef 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0db36479542579fe3ed4d0a242e19390", + "content-hash": "caab951f25d21bb036acd27159bfa81b", "packages": [ { "name": "dealerdirect/phpcodesniffer-composer-installer", @@ -86,16 +86,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.23.1", + "version": "1.24.4", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "846ae76eef31c6d7790fac9bc399ecee45160b26" + "reference": "6bd0c26f3786cd9b7c359675cb789e35a8e07496" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/846ae76eef31c6d7790fac9bc399ecee45160b26", - "reference": "846ae76eef31c6d7790fac9bc399ecee45160b26", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/6bd0c26f3786cd9b7c359675cb789e35a8e07496", + "reference": "6bd0c26f3786cd9b7c359675cb789e35a8e07496", "shasum": "" }, "require": { @@ -127,22 +127,22 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.23.1" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.24.4" }, - "time": "2023-08-03T16:32:59+00:00" + "time": "2023-11-26T18:29:22+00:00" }, { "name": "phpstan/phpstan", - "version": "1.10.32", + "version": "1.10.46", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "c47e47d3ab03137c0e121e77c4d2cb58672f6d44" + "reference": "90d3d25c5b98b8068916bbf08ce42d5cb6c54e70" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c47e47d3ab03137c0e121e77c4d2cb58672f6d44", - "reference": "c47e47d3ab03137c0e121e77c4d2cb58672f6d44", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/90d3d25c5b98b8068916bbf08ce42d5cb6c54e70", + "reference": "90d3d25c5b98b8068916bbf08ce42d5cb6c54e70", "shasum": "" }, "require": { @@ -191,25 +191,25 @@ "type": "tidelift" } ], - "time": "2023-08-24T21:54:50+00:00" + "time": "2023-11-28T14:57:26+00:00" }, { "name": "rector/rector", - "version": "0.18.1", + "version": "0.18.11", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "ee72ef542680a7f47ed8c6784f78b032c0d2f381" + "reference": "9621124c860066f56a4ab841349cb7c284edfaee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/ee72ef542680a7f47ed8c6784f78b032c0d2f381", - "reference": "ee72ef542680a7f47ed8c6784f78b032c0d2f381", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/9621124c860066f56a4ab841349cb7c284edfaee", + "reference": "9621124c860066f56a4ab841349cb7c284edfaee", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.10.31" + "phpstan/phpstan": "^1.10.35" }, "conflict": { "rector/rector-doctrine": "*", @@ -239,7 +239,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.18.1" + "source": "https://github.com/rectorphp/rector/tree/0.18.11" }, "funding": [ { @@ -247,36 +247,36 @@ "type": "github" } ], - "time": "2023-08-28T18:01:58+00:00" + "time": "2023-11-27T13:27:43+00:00" }, { "name": "slevomat/coding-standard", - "version": "8.13.4", + "version": "8.14.1", "source": { "type": "git", "url": "https://github.com/slevomat/coding-standard.git", - "reference": "4b2af2fb17773656d02fbfb5d18024ebd19fe322" + "reference": "fea1fd6f137cc84f9cba0ae30d549615dbc6a926" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/4b2af2fb17773656d02fbfb5d18024ebd19fe322", - "reference": "4b2af2fb17773656d02fbfb5d18024ebd19fe322", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/fea1fd6f137cc84f9cba0ae30d549615dbc6a926", + "reference": "fea1fd6f137cc84f9cba0ae30d549615dbc6a926", "shasum": "" }, "require": { "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7 || ^1.0", "php": "^7.2 || ^8.0", - "phpstan/phpdoc-parser": "^1.23.0", + "phpstan/phpdoc-parser": "^1.23.1", "squizlabs/php_codesniffer": "^3.7.1" }, "require-dev": { "phing/phing": "2.17.4", "php-parallel-lint/php-parallel-lint": "1.3.2", - "phpstan/phpstan": "1.10.26", - "phpstan/phpstan-deprecation-rules": "1.1.3", - "phpstan/phpstan-phpunit": "1.3.13", + "phpstan/phpstan": "1.10.37", + "phpstan/phpstan-deprecation-rules": "1.1.4", + "phpstan/phpstan-phpunit": "1.3.14", "phpstan/phpstan-strict-rules": "1.5.1", - "phpunit/phpunit": "7.5.20|8.5.21|9.6.8|10.2.6" + "phpunit/phpunit": "8.5.21|9.6.8|10.3.5" }, "type": "phpcodesniffer-standard", "extra": { @@ -300,7 +300,7 @@ ], "support": { "issues": "https://github.com/slevomat/coding-standard/issues", - "source": "https://github.com/slevomat/coding-standard/tree/8.13.4" + "source": "https://github.com/slevomat/coding-standard/tree/8.14.1" }, "funding": [ { @@ -312,7 +312,7 @@ "type": "tidelift" } ], - "time": "2023-07-25T10:28:55+00:00" + "time": "2023-10-08T07:28:08+00:00" }, { "name": "squizlabs/php_codesniffer", @@ -373,16 +373,16 @@ }, { "name": "symplify/easy-coding-standard", - "version": "12.0.7", + "version": "12.0.9", "source": { "type": "git", "url": "https://github.com/easy-coding-standard/easy-coding-standard.git", - "reference": "79b5679f0dd758311770543969087b8dc46429ee" + "reference": "24b7b28c25d698e64496c4d19c798ccd01617c7d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/easy-coding-standard/easy-coding-standard/zipball/79b5679f0dd758311770543969087b8dc46429ee", - "reference": "79b5679f0dd758311770543969087b8dc46429ee", + "url": "https://api.github.com/repos/easy-coding-standard/easy-coding-standard/zipball/24b7b28c25d698e64496c4d19c798ccd01617c7d", + "reference": "24b7b28c25d698e64496c4d19c798ccd01617c7d", "shasum": "" }, "require": { @@ -415,7 +415,7 @@ ], "support": { "issues": "https://github.com/easy-coding-standard/easy-coding-standard/issues", - "source": "https://github.com/easy-coding-standard/easy-coding-standard/tree/12.0.7" + "source": "https://github.com/easy-coding-standard/easy-coding-standard/tree/12.0.9" }, "funding": [ { @@ -427,7 +427,7 @@ "type": "github" } ], - "time": "2023-08-24T21:43:33+00:00" + "time": "2023-11-29T09:35:09+00:00" } ], "packages-dev": [], @@ -438,5 +438,5 @@ "prefer-lowest": false, "platform": [], "platform-dev": [], - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } From 3c81249b90fe838754ca3367c82d7f24bce36b95 Mon Sep 17 00:00:00 2001 From: lubiana Date: Wed, 29 Nov 2023 18:27:33 +0100 Subject: [PATCH 04/15] update rules --- config/ecs.php | 17 ++++++++++++----- config/rector.php | 4 ---- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/config/ecs.php b/config/ecs.php index 0f2a3e2..32cbde9 100644 --- a/config/ecs.php +++ b/config/ecs.php @@ -1,8 +1,8 @@ skip([ BlankLineAfterOpeningTagFixer::class, - NewWithBracesFixer::class, OrderedImportsFixer::class, + FunctionToConstantFixer::class, ]); $c->sets([ @@ -42,6 +42,13 @@ return static function (ECSConfig $c): void { SetList::SYMPLIFY, ]); + $c->dynamicSets([ + '@PER-CS', + '@PER-CS:risky', + '@PHP83Migration', + '@PHP80Migration:risky', + ]); + // force visibility declaration on class constants $c->ruleWithConfiguration(ClassConstantVisibilitySniff::class, [ 'fixable' => true, @@ -53,9 +60,10 @@ return static function (ECSConfig $c): void { DisallowGroupUseSniff::class, MultipleUsesPerLineSniff::class, NamespaceSpacingSniff::class, + OperatorLinebreakFixer::class, ]); - // import all namespaces, and event php core functions and classes + // import all namespaces, and even php core functions and classes $c->ruleWithConfiguration( ReferenceUsedNamesOnlySniff::class, [ @@ -95,7 +103,6 @@ return static function (ECSConfig $c): void { ]); // Remove useless parentheses in new statements - $c->rule(BracesFixer::class); $c->rule(NewWithoutParenthesesSniff::class); // do not inline short multilinestatements diff --git a/config/rector.php b/config/rector.php index 1cf8f58..ba9c214 100644 --- a/config/rector.php +++ b/config/rector.php @@ -14,7 +14,6 @@ use Rector\CodingStyle\Rector\ClassMethod\NewlineBeforeNewAssignSetRector; use Rector\CodingStyle\Rector\Closure\StaticClosureRector; use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector; use Rector\CodingStyle\Rector\If_\NullableCompareToNullRector; -use Rector\CodingStyle\Rector\Stmt\NewlineAfterStatementRector; use Rector\Config\RectorConfig; use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector; use Rector\EarlyReturn\Rector\If_\ChangeAndIfToEarlyReturnRector; @@ -44,7 +43,6 @@ use Rector\TypeDeclaration\Rector\FunctionLike\AddParamTypeSplFixedArrayRector; use Rector\TypeDeclaration\Rector\FunctionLike\AddReturnTypeDeclarationFromYieldsRector; use Rector\TypeDeclaration\Rector\Param\ParamTypeFromStrictTypedPropertyRector; use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector; -use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictGetterMethodReturnTypeRector; return static function (RectorConfig $c): void { $c->sets([LevelSetList::UP_TO_PHP_82]); @@ -65,7 +63,6 @@ return static function (RectorConfig $c): void { ExplicitBoolCompareRector::class, InlineArrayReturnAssignRector::class, InlineIsAInstanceOfRector::class, - NewlineAfterStatementRector::class, NewlineBeforeNewAssignSetRector::class, NullableCompareToNullRector::class, ParamTypeByMethodCallTypeRector::class, @@ -90,7 +87,6 @@ return static function (RectorConfig $c): void { StaticClosureRector::class, ThrowWithPreviousExceptionRector::class, TypedPropertyFromStrictConstructorRector::class, - TypedPropertyFromStrictGetterMethodReturnTypeRector::class, RemoveAlwaysElseRector::class, ]); }; From f30fbd3758d8b142314922c14ce80e7913865989 Mon Sep 17 00:00:00 2001 From: lubiana Date: Thu, 25 Jan 2024 18:31:04 +0100 Subject: [PATCH 05/15] bump dependencies and update config --- composer.json | 4 +- composer.lock | 107 ++++++++++++++++++++++--------------- config/ecs.php | 133 ++++++++++++++++++++-------------------------- config/rector.php | 2 - ecs.php | 18 +++---- src/SetList.php | 17 ------ 6 files changed, 134 insertions(+), 147 deletions(-) delete mode 100644 src/SetList.php diff --git a/composer.json b/composer.json index 4be773a..a2399fd 100644 --- a/composer.json +++ b/composer.json @@ -9,8 +9,8 @@ }, "require": { "slevomat/coding-standard": "^8.14.1", - "symplify/easy-coding-standard": "^12.0.9", - "rector/rector": "^0.18.11" + "symplify/easy-coding-standard": "^12.1.8", + "rector/rector": "^0.19.2" }, "config": { "allow-plugins": { diff --git a/composer.lock b/composer.lock index f5b66ef..03cb2b0 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "caab951f25d21bb036acd27159bfa81b", + "content-hash": "a2ee536230b7262151afd736f0600119", "packages": [ { "name": "dealerdirect/phpcodesniffer-composer-installer", @@ -86,16 +86,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.24.4", + "version": "1.25.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "6bd0c26f3786cd9b7c359675cb789e35a8e07496" + "reference": "bd84b629c8de41aa2ae82c067c955e06f1b00240" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/6bd0c26f3786cd9b7c359675cb789e35a8e07496", - "reference": "6bd0c26f3786cd9b7c359675cb789e35a8e07496", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/bd84b629c8de41aa2ae82c067c955e06f1b00240", + "reference": "bd84b629c8de41aa2ae82c067c955e06f1b00240", "shasum": "" }, "require": { @@ -127,22 +127,22 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.24.4" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.25.0" }, - "time": "2023-11-26T18:29:22+00:00" + "time": "2024-01-04T17:06:16+00:00" }, { "name": "phpstan/phpstan", - "version": "1.10.46", + "version": "1.10.57", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "90d3d25c5b98b8068916bbf08ce42d5cb6c54e70" + "reference": "1627b1d03446904aaa77593f370c5201d2ecc34e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/90d3d25c5b98b8068916bbf08ce42d5cb6c54e70", - "reference": "90d3d25c5b98b8068916bbf08ce42d5cb6c54e70", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/1627b1d03446904aaa77593f370c5201d2ecc34e", + "reference": "1627b1d03446904aaa77593f370c5201d2ecc34e", "shasum": "" }, "require": { @@ -191,25 +191,25 @@ "type": "tidelift" } ], - "time": "2023-11-28T14:57:26+00:00" + "time": "2024-01-24T11:51:34+00:00" }, { "name": "rector/rector", - "version": "0.18.11", + "version": "0.19.2", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "9621124c860066f56a4ab841349cb7c284edfaee" + "reference": "bc96a99895bf47c6bfe70ea1b799f0081ed5a903" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/9621124c860066f56a4ab841349cb7c284edfaee", - "reference": "9621124c860066f56a4ab841349cb7c284edfaee", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/bc96a99895bf47c6bfe70ea1b799f0081ed5a903", + "reference": "bc96a99895bf47c6bfe70ea1b799f0081ed5a903", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.10.35" + "phpstan/phpstan": "^1.10.56" }, "conflict": { "rector/rector-doctrine": "*", @@ -239,7 +239,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.18.11" + "source": "https://github.com/rectorphp/rector/tree/0.19.2" }, "funding": [ { @@ -247,7 +247,7 @@ "type": "github" } ], - "time": "2023-11-27T13:27:43+00:00" + "time": "2024-01-19T10:58:30+00:00" }, { "name": "slevomat/coding-standard", @@ -316,16 +316,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.7.2", + "version": "3.8.1", "source": { "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879" + "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", + "reference": "14f5fff1e64118595db5408e946f3a22c75807f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ed8e00df0a83aa96acf703f8c2979ff33341f879", - "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/14f5fff1e64118595db5408e946f3a22c75807f7", + "reference": "14f5fff1e64118595db5408e946f3a22c75807f7", "shasum": "" }, "require": { @@ -335,11 +335,11 @@ "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" }, "bin": [ - "bin/phpcs", - "bin/phpcbf" + "bin/phpcbf", + "bin/phpcs" ], "type": "library", "extra": { @@ -354,44 +354,67 @@ "authors": [ { "name": "Greg Sherwood", - "role": "lead" + "role": "Former lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "Current lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" } ], "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", "keywords": [ "phpcs", "standards", "static analysis" ], "support": { - "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", - "source": "https://github.com/squizlabs/PHP_CodeSniffer", - "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" + "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", + "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", + "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" }, - "time": "2023-02-22T23:07:41+00:00" + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2024-01-11T20:47:48+00:00" }, { "name": "symplify/easy-coding-standard", - "version": "12.0.9", + "version": "12.1.8", "source": { "type": "git", "url": "https://github.com/easy-coding-standard/easy-coding-standard.git", - "reference": "24b7b28c25d698e64496c4d19c798ccd01617c7d" + "reference": "7962c810a8eebc4174a38d7dff673f1999e61595" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/easy-coding-standard/easy-coding-standard/zipball/24b7b28c25d698e64496c4d19c798ccd01617c7d", - "reference": "24b7b28c25d698e64496c4d19c798ccd01617c7d", + "url": "https://api.github.com/repos/easy-coding-standard/easy-coding-standard/zipball/7962c810a8eebc4174a38d7dff673f1999e61595", + "reference": "7962c810a8eebc4174a38d7dff673f1999e61595", "shasum": "" }, "require": { "php": ">=7.2" }, "conflict": { - "friendsofphp/php-cs-fixer": "<3.0", - "squizlabs/php_codesniffer": "<3.6", - "symplify/coding-standard": "<11.3" + "friendsofphp/php-cs-fixer": "<3.46", + "phpcsstandards/php_codesniffer": "<3.8", + "symplify/coding-standard": "<12.1" }, "bin": [ "bin/ecs" @@ -415,7 +438,7 @@ ], "support": { "issues": "https://github.com/easy-coding-standard/easy-coding-standard/issues", - "source": "https://github.com/easy-coding-standard/easy-coding-standard/tree/12.0.9" + "source": "https://github.com/easy-coding-standard/easy-coding-standard/tree/12.1.8" }, "funding": [ { @@ -427,7 +450,7 @@ "type": "github" } ], - "time": "2023-11-29T09:35:09+00:00" + "time": "2024-01-16T22:56:06+00:00" } ], "packages-dev": [], diff --git a/config/ecs.php b/config/ecs.php index 32cbde9..f05925b 100644 --- a/config/ecs.php +++ b/config/ecs.php @@ -19,52 +19,38 @@ use SlevomatCodingStandard\Sniffs\TypeHints\DeclareStrictTypesSniff; use SlevomatCodingStandard\Sniffs\TypeHints\UnionTypeHintFormatSniff; use Symplify\CodingStandard\Fixer\LineLength\LineLengthFixer; use Symplify\EasyCodingStandard\Config\ECSConfig; -use Symplify\EasyCodingStandard\ValueObject\Set\SetList; -return static function (ECSConfig $c): void { - $c->skip([ - BlankLineAfterOpeningTagFixer::class, - OrderedImportsFixer::class, - FunctionToConstantFixer::class, - ]); - - $c->sets([ - SetList::ARRAY, - SetList::CLEAN_CODE, - SetList::COMMENTS, - SetList::COMMON, - SetList::CONTROL_STRUCTURES, - SetList::DOCBLOCK, - SetList::NAMESPACES, - SetList::PSR_12, - SetList::SPACES, - SetList::STRICT, - SetList::SYMPLIFY, - ]); - - $c->dynamicSets([ - '@PER-CS', - '@PER-CS:risky', - '@PHP83Migration', - '@PHP80Migration:risky', - ]); - - // force visibility declaration on class constants - $c->ruleWithConfiguration(ClassConstantVisibilitySniff::class, [ - 'fixable' => true, - ]); - - // sort all use statements - $c->rules([ +return ECSConfig::configure() + ->withPreparedSets( + arrays: true, + cleanCode: true, + comments: true, + controlStructures: true, + docblocks: true, + namespaces: true, + spaces: true, + strict: true, + symplify: true + ) + ->withPhpCsFixerSets( + perCS: true, + perCSRisky: true, + php83Migration: true, + php80MigrationRisky: true, + ) + ->withRules([ AlphabeticallySortedUsesSniff::class, DisallowGroupUseSniff::class, MultipleUsesPerLineSniff::class, NamespaceSpacingSniff::class, OperatorLinebreakFixer::class, - ]); - - // import all namespaces, and even php core functions and classes - $c->ruleWithConfiguration( + NoWhitespaceInBlankLineFixer::class, + NewWithoutParenthesesSniff::class, + ]) + ->withConfiguredRule(ClassConstantVisibilitySniff::class, [ + 'fixable' => true, + ]) + ->withConfiguredRule( ReferenceUsedNamesOnlySniff::class, [ 'allowFallbackGlobalConstants' => false, @@ -77,50 +63,49 @@ return static function (ECSConfig $c): void { 'allowFullyQualifiedNameForCollidingFunctions' => true, 'searchAnnotations' => true, ] - ); + ) // define newlines between use statements - $c->ruleWithConfiguration(UseSpacingSniff::class, [ - 'linesCountAfterLastUse' => 1, - 'linesCountBeforeFirstUse' => 1, - 'linesCountBetweenUseTypes' => 1, - ]); - - // strict types declaration should be on same line as opening tag - $c->ruleWithConfiguration( + ->withConfiguredRule( + UseSpacingSniff::class, + [ + 'linesCountAfterLastUse' => 1, + 'linesCountBeforeFirstUse' => 1, + 'linesCountBetweenUseTypes' => 1, + ] + ) + ->withConfiguredRule( DeclareStrictTypesSniff::class, [ 'declareOnFirstLine' => true, 'spacesCountAroundEqualsSign' => 0, ] - ); - - // disallow ?Foo typehint in favor of Foo|null - $c->ruleWithConfiguration(UnionTypeHintFormatSniff::class, [ - 'nullPosition' => 'last', - 'shortNullable' => 'no', - 'withSpaces' => 'no', - ]); - - // Remove useless parentheses in new statements - $c->rule(NewWithoutParenthesesSniff::class); - - // do not inline short multilinestatements - $c->ruleWithConfiguration(LineLengthFixer::class, [ - LineLengthFixer::INLINE_SHORT_LINES => false, - ]); - - $c->ruleWithConfiguration( + ) + ->withConfiguredRule( + UnionTypeHintFormatSniff::class, + [ + 'nullPosition' => 'last', + 'shortNullable' => 'no', + 'withSpaces' => 'no', + ] + ) + ->withConfiguredRule( + LineLengthFixer::class, + [ + LineLengthFixer::INLINE_SHORT_LINES => false, + ] + ) + ->withConfiguredRule( NoExtraBlankLinesFixer::class, [ 'tokens' => ['square_brace_block', 'return', 'extra'], ] - ); - - $c->rule(NoWhitespaceInBlankLineFixer::class); - - // make sure that the attribute target is on the line after the attribute - $c->ruleWithConfiguration(AttributeAndTargetSpacingSniff::class, [ + ) + ->withConfiguredRule(AttributeAndTargetSpacingSniff::class, [ 'linesCount' => 0, + ]) + ->withSkip([ + BlankLineAfterOpeningTagFixer::class, + OrderedImportsFixer::class, + FunctionToConstantFixer::class, ]); -}; diff --git a/config/rector.php b/config/rector.php index ba9c214..4687fc7 100644 --- a/config/rector.php +++ b/config/rector.php @@ -41,7 +41,6 @@ use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedCallRecto use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedPropertyRector; use Rector\TypeDeclaration\Rector\FunctionLike\AddParamTypeSplFixedArrayRector; use Rector\TypeDeclaration\Rector\FunctionLike\AddReturnTypeDeclarationFromYieldsRector; -use Rector\TypeDeclaration\Rector\Param\ParamTypeFromStrictTypedPropertyRector; use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector; return static function (RectorConfig $c): void { @@ -67,7 +66,6 @@ return static function (RectorConfig $c): void { NullableCompareToNullRector::class, ParamTypeByMethodCallTypeRector::class, ParamTypeByParentCallTypeRector::class, - ParamTypeFromStrictTypedPropertyRector::class, PreparedValueToEarlyReturnRector::class, ReplaceMultipleBooleanNotRector::class, ReturnBinaryOrToEarlyReturnRector::class, diff --git a/ecs.php b/ecs.php index 7a1aa39..5ee3c42 100644 --- a/ecs.php +++ b/ecs.php @@ -3,13 +3,11 @@ use Lubiana\CodeQuality\LubiSetList; use Symplify\EasyCodingStandard\Config\ECSConfig; -return static function (ECSConfig $c): void { - $c->paths([ - __DIR__ . '/src', - __DIR__ . '/config', - __DIR__ . '/rector.php', - __DIR__ . '/ecs.php', - ]); - - $c->sets([LubiSetList::ECS]); -}; +return ECSConfig::configure() + ->withSets([LubiSetList::ECS]) + ->withPaths( + [ + __DIR__ . '/src', + __DIR__ . '/config', + ] + )->withRootFiles(); diff --git a/src/SetList.php b/src/SetList.php deleted file mode 100644 index 00fe282..0000000 --- a/src/SetList.php +++ /dev/null @@ -1,17 +0,0 @@ - Date: Sat, 3 Feb 2024 01:07:15 +0100 Subject: [PATCH 06/15] bump versions and set php83 as new target --- composer.json | 3 ++- composer.lock | 18 ++++++++++-------- config/ecs.php | 14 +++++++++----- config/rector.php | 10 +++++----- rector.php | 14 ++++++-------- src/LubiSetList.php | 4 ++-- 6 files changed, 34 insertions(+), 29 deletions(-) diff --git a/composer.json b/composer.json index a2399fd..68da3a3 100644 --- a/composer.json +++ b/composer.json @@ -8,9 +8,10 @@ } }, "require": { + "php": "^8.3", "slevomat/coding-standard": "^8.14.1", "symplify/easy-coding-standard": "^12.1.8", - "rector/rector": "^0.19.2" + "rector/rector": "^0.19.5" }, "config": { "allow-plugins": { diff --git a/composer.lock b/composer.lock index 03cb2b0..bb4ab7c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a2ee536230b7262151afd736f0600119", + "content-hash": "da852e748b3a7adc9b558b097386ff95", "packages": [ { "name": "dealerdirect/phpcodesniffer-composer-installer", @@ -195,16 +195,16 @@ }, { "name": "rector/rector", - "version": "0.19.2", + "version": "0.19.5", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "bc96a99895bf47c6bfe70ea1b799f0081ed5a903" + "reference": "89c895d127b9d248d2af007068a824b5348ef81f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/bc96a99895bf47c6bfe70ea1b799f0081ed5a903", - "reference": "bc96a99895bf47c6bfe70ea1b799f0081ed5a903", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/89c895d127b9d248d2af007068a824b5348ef81f", + "reference": "89c895d127b9d248d2af007068a824b5348ef81f", "shasum": "" }, "require": { @@ -239,7 +239,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.19.2" + "source": "https://github.com/rectorphp/rector/tree/0.19.5" }, "funding": [ { @@ -247,7 +247,7 @@ "type": "github" } ], - "time": "2024-01-19T10:58:30+00:00" + "time": "2024-01-29T23:53:47+00:00" }, { "name": "slevomat/coding-standard", @@ -459,7 +459,9 @@ "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, - "platform": [], + "platform": { + "php": "^8.3" + }, "platform-dev": [], "plugin-api-version": "2.6.0" } diff --git a/config/ecs.php b/config/ecs.php index f05925b..6e83916 100644 --- a/config/ecs.php +++ b/config/ecs.php @@ -2,6 +2,8 @@ use PhpCsFixer\Fixer\Import\OrderedImportsFixer; use PhpCsFixer\Fixer\LanguageConstruct\FunctionToConstantFixer; +use PhpCsFixer\Fixer\Operator\NewWithBracesFixer; +use PhpCsFixer\Fixer\Operator\NewWithParenthesesFixer; use PhpCsFixer\Fixer\Operator\OperatorLinebreakFixer; use PhpCsFixer\Fixer\PhpTag\BlankLineAfterOpeningTagFixer; use PhpCsFixer\Fixer\Whitespace\NoExtraBlankLinesFixer; @@ -22,21 +24,21 @@ use Symplify\EasyCodingStandard\Config\ECSConfig; return ECSConfig::configure() ->withPreparedSets( + symplify: true, arrays: true, - cleanCode: true, comments: true, - controlStructures: true, docblocks: true, - namespaces: true, spaces: true, + namespaces: true, + controlStructures: true, strict: true, - symplify: true + cleanCode: true ) ->withPhpCsFixerSets( perCS: true, perCSRisky: true, - php83Migration: true, php80MigrationRisky: true, + php83Migration: true, ) ->withRules([ AlphabeticallySortedUsesSniff::class, @@ -108,4 +110,6 @@ return ECSConfig::configure() BlankLineAfterOpeningTagFixer::class, OrderedImportsFixer::class, FunctionToConstantFixer::class, + NewWithParenthesesFixer::class, + NewWithBracesFixer::class, ]); diff --git a/config/rector.php b/config/rector.php index 4687fc7..82d5ac5 100644 --- a/config/rector.php +++ b/config/rector.php @@ -43,9 +43,9 @@ use Rector\TypeDeclaration\Rector\FunctionLike\AddParamTypeSplFixedArrayRector; use Rector\TypeDeclaration\Rector\FunctionLike\AddReturnTypeDeclarationFromYieldsRector; use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector; -return static function (RectorConfig $c): void { - $c->sets([LevelSetList::UP_TO_PHP_82]); - $c->rules([ +return RectorConfig::configure() + ->withSets([LevelSetList::UP_TO_PHP_83]) + ->withRules([ AddArrowFunctionReturnTypeRector::class, AddMethodCallBasedStrictParamTypeRector::class, AddParamTypeFromPropertyTypeRector::class, @@ -86,5 +86,5 @@ return static function (RectorConfig $c): void { ThrowWithPreviousExceptionRector::class, TypedPropertyFromStrictConstructorRector::class, RemoveAlwaysElseRector::class, - ]); -}; + ]) +; diff --git a/rector.php b/rector.php index 80408b1..87b24f1 100644 --- a/rector.php +++ b/rector.php @@ -3,13 +3,11 @@ use Lubiana\CodeQuality\LubiSetList; use Rector\Config\RectorConfig; -return static function (RectorConfig $c): void { - $c->paths([ +return RectorConfig::configure() + ->withPaths([ __DIR__ . '/src', __DIR__ . '/config', - __DIR__ . '/rector.php', - __DIR__ . '/ecs.php', - ]); - - $c->sets([LubiSetList::RECTOR]); -}; + ]) + ->withSets([LubiSetList::RECTOR]) + ->withRootFiles() +; diff --git a/src/LubiSetList.php b/src/LubiSetList.php index d78838d..87017c2 100644 --- a/src/LubiSetList.php +++ b/src/LubiSetList.php @@ -4,7 +4,7 @@ namespace Lubiana\CodeQuality; final class LubiSetList { - public const RECTOR = __DIR__ . '/../config/rector.php'; + public const string RECTOR = __DIR__ . '/../config/rector.php'; - public const ECS = __DIR__ . '/../config/ecs.php'; + public const string ECS = __DIR__ . '/../config/ecs.php'; } From 894d6ec850959101f1d211efd3888ef53528ac66 Mon Sep 17 00:00:00 2001 From: lubiana Date: Sat, 3 Feb 2024 10:58:53 +0100 Subject: [PATCH 07/15] clean up rector config --- composer.json | 2 +- config/rector.php | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 68da3a3..7fa4bcb 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ } }, "scripts": { - "fix": [ + "lint": [ "rector", "ecs --fix", "ecs --fix" diff --git a/config/rector.php b/config/rector.php index 82d5ac5..f32142d 100644 --- a/config/rector.php +++ b/config/rector.php @@ -24,7 +24,6 @@ use Rector\EarlyReturn\Rector\Return_\PreparedValueToEarlyReturnRector; use Rector\EarlyReturn\Rector\Return_\ReturnBinaryOrToEarlyReturnRector; use Rector\EarlyReturn\Rector\StmtsAwareInterface\ReturnEarlyIfVariableRector; use Rector\Php80\Rector\ClassConstFetch\ClassOnThisVariableObjectRector; -use Rector\Set\ValueObject\LevelSetList; use Rector\TypeDeclaration\Rector\ArrowFunction\AddArrowFunctionReturnTypeRector; use Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector; use Rector\TypeDeclaration\Rector\ClassMethod\AddParamTypeFromPropertyTypeRector; @@ -44,7 +43,14 @@ use Rector\TypeDeclaration\Rector\FunctionLike\AddReturnTypeDeclarationFromYield use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector; return RectorConfig::configure() - ->withSets([LevelSetList::UP_TO_PHP_83]) + ->withPhpSets(php83: true) + ->withPreparedSets( + deadCode: true, + codeQuality: true, + typeDeclarations: true, + earlyReturn: true, + strictBooleans: true, + ) ->withRules([ AddArrowFunctionReturnTypeRector::class, AddMethodCallBasedStrictParamTypeRector::class, From cfd59433a4cc2e8b22f11f8420a6250e2b2f8eaa Mon Sep 17 00:00:00 2001 From: lubiana Date: Thu, 25 Apr 2024 18:07:52 +0200 Subject: [PATCH 08/15] bump dependencies --- composer.json | 6 ++-- composer.lock | 89 +++++++++++++++++++++++++-------------------------- 2 files changed, 47 insertions(+), 48 deletions(-) diff --git a/composer.json b/composer.json index 7fa4bcb..688744a 100644 --- a/composer.json +++ b/composer.json @@ -9,9 +9,9 @@ }, "require": { "php": "^8.3", - "slevomat/coding-standard": "^8.14.1", - "symplify/easy-coding-standard": "^12.1.8", - "rector/rector": "^0.19.5" + "slevomat/coding-standard": "^8.15.0", + "symplify/easy-coding-standard": "^12.1.14", + "rector/rector": "^1.0.4" }, "config": { "allow-plugins": { diff --git a/composer.lock b/composer.lock index bb4ab7c..23de7e5 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "da852e748b3a7adc9b558b097386ff95", + "content-hash": "43ac5346cfac27bedc2e1990eccc6e6e", "packages": [ { "name": "dealerdirect/phpcodesniffer-composer-installer", @@ -86,16 +86,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.25.0", + "version": "1.28.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "bd84b629c8de41aa2ae82c067c955e06f1b00240" + "reference": "cd06d6b1a1b3c75b0b83f97577869fd85a3cd4fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/bd84b629c8de41aa2ae82c067c955e06f1b00240", - "reference": "bd84b629c8de41aa2ae82c067c955e06f1b00240", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/cd06d6b1a1b3c75b0b83f97577869fd85a3cd4fb", + "reference": "cd06d6b1a1b3c75b0b83f97577869fd85a3cd4fb", "shasum": "" }, "require": { @@ -127,22 +127,22 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.25.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.28.0" }, - "time": "2024-01-04T17:06:16+00:00" + "time": "2024-04-03T18:51:33+00:00" }, { "name": "phpstan/phpstan", - "version": "1.10.57", + "version": "1.10.67", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "1627b1d03446904aaa77593f370c5201d2ecc34e" + "reference": "16ddbe776f10da6a95ebd25de7c1dbed397dc493" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/1627b1d03446904aaa77593f370c5201d2ecc34e", - "reference": "1627b1d03446904aaa77593f370c5201d2ecc34e", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/16ddbe776f10da6a95ebd25de7c1dbed397dc493", + "reference": "16ddbe776f10da6a95ebd25de7c1dbed397dc493", "shasum": "" }, "require": { @@ -185,31 +185,27 @@ { "url": "https://github.com/phpstan", "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", - "type": "tidelift" } ], - "time": "2024-01-24T11:51:34+00:00" + "time": "2024-04-16T07:22:02+00:00" }, { "name": "rector/rector", - "version": "0.19.5", + "version": "1.0.4", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "89c895d127b9d248d2af007068a824b5348ef81f" + "reference": "6e04d0eb087aef707fa0c5686d33d6ff61f4a555" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/89c895d127b9d248d2af007068a824b5348ef81f", - "reference": "89c895d127b9d248d2af007068a824b5348ef81f", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/6e04d0eb087aef707fa0c5686d33d6ff61f4a555", + "reference": "6e04d0eb087aef707fa0c5686d33d6ff61f4a555", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.10.56" + "phpstan/phpstan": "^1.10.57" }, "conflict": { "rector/rector-doctrine": "*", @@ -217,6 +213,9 @@ "rector/rector-phpunit": "*", "rector/rector-symfony": "*" }, + "suggest": { + "ext-dom": "To manipulate phpunit.xml via the custom-rule command" + }, "bin": [ "bin/rector" ], @@ -239,7 +238,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.19.5" + "source": "https://github.com/rectorphp/rector/tree/1.0.4" }, "funding": [ { @@ -247,36 +246,36 @@ "type": "github" } ], - "time": "2024-01-29T23:53:47+00:00" + "time": "2024-04-05T09:01:07+00:00" }, { "name": "slevomat/coding-standard", - "version": "8.14.1", + "version": "8.15.0", "source": { "type": "git", "url": "https://github.com/slevomat/coding-standard.git", - "reference": "fea1fd6f137cc84f9cba0ae30d549615dbc6a926" + "reference": "7d1d957421618a3803b593ec31ace470177d7817" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/fea1fd6f137cc84f9cba0ae30d549615dbc6a926", - "reference": "fea1fd6f137cc84f9cba0ae30d549615dbc6a926", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/7d1d957421618a3803b593ec31ace470177d7817", + "reference": "7d1d957421618a3803b593ec31ace470177d7817", "shasum": "" }, "require": { "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7 || ^1.0", "php": "^7.2 || ^8.0", "phpstan/phpdoc-parser": "^1.23.1", - "squizlabs/php_codesniffer": "^3.7.1" + "squizlabs/php_codesniffer": "^3.9.0" }, "require-dev": { "phing/phing": "2.17.4", "php-parallel-lint/php-parallel-lint": "1.3.2", - "phpstan/phpstan": "1.10.37", + "phpstan/phpstan": "1.10.60", "phpstan/phpstan-deprecation-rules": "1.1.4", - "phpstan/phpstan-phpunit": "1.3.14", - "phpstan/phpstan-strict-rules": "1.5.1", - "phpunit/phpunit": "8.5.21|9.6.8|10.3.5" + "phpstan/phpstan-phpunit": "1.3.16", + "phpstan/phpstan-strict-rules": "1.5.2", + "phpunit/phpunit": "8.5.21|9.6.8|10.5.11" }, "type": "phpcodesniffer-standard", "extra": { @@ -300,7 +299,7 @@ ], "support": { "issues": "https://github.com/slevomat/coding-standard/issues", - "source": "https://github.com/slevomat/coding-standard/tree/8.14.1" + "source": "https://github.com/slevomat/coding-standard/tree/8.15.0" }, "funding": [ { @@ -312,20 +311,20 @@ "type": "tidelift" } ], - "time": "2023-10-08T07:28:08+00:00" + "time": "2024-03-09T15:20:58+00:00" }, { "name": "squizlabs/php_codesniffer", - "version": "3.8.1", + "version": "3.9.2", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "14f5fff1e64118595db5408e946f3a22c75807f7" + "reference": "aac1f6f347a5c5ac6bc98ad395007df00990f480" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/14f5fff1e64118595db5408e946f3a22c75807f7", - "reference": "14f5fff1e64118595db5408e946f3a22c75807f7", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/aac1f6f347a5c5ac6bc98ad395007df00990f480", + "reference": "aac1f6f347a5c5ac6bc98ad395007df00990f480", "shasum": "" }, "require": { @@ -392,20 +391,20 @@ "type": "open_collective" } ], - "time": "2024-01-11T20:47:48+00:00" + "time": "2024-04-23T20:25:34+00:00" }, { "name": "symplify/easy-coding-standard", - "version": "12.1.8", + "version": "12.1.14", "source": { "type": "git", "url": "https://github.com/easy-coding-standard/easy-coding-standard.git", - "reference": "7962c810a8eebc4174a38d7dff673f1999e61595" + "reference": "e3c4a241ee36704f7cf920d5931f39693e64afd5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/easy-coding-standard/easy-coding-standard/zipball/7962c810a8eebc4174a38d7dff673f1999e61595", - "reference": "7962c810a8eebc4174a38d7dff673f1999e61595", + "url": "https://api.github.com/repos/easy-coding-standard/easy-coding-standard/zipball/e3c4a241ee36704f7cf920d5931f39693e64afd5", + "reference": "e3c4a241ee36704f7cf920d5931f39693e64afd5", "shasum": "" }, "require": { @@ -438,7 +437,7 @@ ], "support": { "issues": "https://github.com/easy-coding-standard/easy-coding-standard/issues", - "source": "https://github.com/easy-coding-standard/easy-coding-standard/tree/12.1.8" + "source": "https://github.com/easy-coding-standard/easy-coding-standard/tree/12.1.14" }, "funding": [ { @@ -450,7 +449,7 @@ "type": "github" } ], - "time": "2024-01-16T22:56:06+00:00" + "time": "2024-02-23T13:10:40+00:00" } ], "packages-dev": [], From d6682176199ebbe7724cf8bb829637fdd5d9dd06 Mon Sep 17 00:00:00 2001 From: lubiana Date: Thu, 25 Apr 2024 21:01:06 +0200 Subject: [PATCH 09/15] temporary skip linelengthfixer --- config/ecs.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/config/ecs.php b/config/ecs.php index 6e83916..28b4812 100644 --- a/config/ecs.php +++ b/config/ecs.php @@ -91,12 +91,6 @@ return ECSConfig::configure() 'withSpaces' => 'no', ] ) - ->withConfiguredRule( - LineLengthFixer::class, - [ - LineLengthFixer::INLINE_SHORT_LINES => false, - ] - ) ->withConfiguredRule( NoExtraBlankLinesFixer::class, [ @@ -112,4 +106,5 @@ return ECSConfig::configure() FunctionToConstantFixer::class, NewWithParenthesesFixer::class, NewWithBracesFixer::class, + LineLengthFixer::class, ]); From 713b047068ce7d17666cd227ab1696eb1289424e Mon Sep 17 00:00:00 2001 From: lubiana Date: Sat, 4 May 2024 19:27:01 +0200 Subject: [PATCH 10/15] add workflow --- .forgejo/workflows/push.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .forgejo/workflows/push.yml diff --git a/.forgejo/workflows/push.yml b/.forgejo/workflows/push.yml new file mode 100644 index 0000000..0754eff --- /dev/null +++ b/.forgejo/workflows/push.yml @@ -0,0 +1,33 @@ +on: [push] +jobs: + ls: + runs-on: docker + container: + image: git.php.fail/lubiana/container/php:ci + steps: + - name: Manually checkout + env: + REPO: '${{ github.repository }}' + TOKEN: '${{ secrets.GITHUB_TOKEN }}' + GIT_SERVER: 'git.php.fail' + COMPOSER_CACHE_DIR: /opt/hostedtoolcache/.composer/cache/files + run: | + git clone --branch $GITHUB_REF_NAME https://${TOKEN}@${GIT_SERVER}/${REPO}.git . + git fetch + git checkout ${{ github.head_ref }} + - name: create composer cache dir + run: | + mkdir -p /opt/hostedtoolcache/.composer/cache/files + - run: composer install + - run: composer lint + - name: GIT commit and push all changed files + env: + CI_COMMIT_MESSAGE: Continuous Integration Fixes + CI_COMMIT_AUTHOR: Continuous Integration + run: | + if [[ -n "$(git status -s)" ]]; then + git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}" + git config --global user.email "gitbot@users.noreply.php.fail" + git commit -am "${{ env.CI_COMMIT_MESSAGE }}" + git push + fi \ No newline at end of file From 9993d760d638247795f941f4c4ac7082d2708acb Mon Sep 17 00:00:00 2001 From: lubiana Date: Sat, 4 May 2024 19:41:48 +0200 Subject: [PATCH 11/15] add ClassAttributeSeparationFixer --- config/ecs.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config/ecs.php b/config/ecs.php index 28b4812..b5a07ba 100644 --- a/config/ecs.php +++ b/config/ecs.php @@ -77,6 +77,11 @@ return ECSConfig::configure() ] ) ->withConfiguredRule( + \PhpCsFixer\Fixer\ClassNotation\ClassAttributesSeparationFixer::class, + [ + 'elements' => ['const' => 'none', 'method' => 'one', 'property' => 'none', 'trait_import' => 'none', 'case' => 'none'], + ], + )->withConfiguredRule( DeclareStrictTypesSniff::class, [ 'declareOnFirstLine' => true, From 00f72e3be9bc9afc20bea2b51fa02a3209f31d44 Mon Sep 17 00:00:00 2001 From: Continuous Integration Date: Sat, 4 May 2024 17:42:09 +0000 Subject: [PATCH 12/15] Continuous Integration Fixes --- config/ecs.php | 11 +++++++++-- src/LubiSetList.php | 1 - 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/config/ecs.php b/config/ecs.php index b5a07ba..a964b49 100644 --- a/config/ecs.php +++ b/config/ecs.php @@ -1,5 +1,6 @@ withConfiguredRule( - \PhpCsFixer\Fixer\ClassNotation\ClassAttributesSeparationFixer::class, + ClassAttributesSeparationFixer::class, [ - 'elements' => ['const' => 'none', 'method' => 'one', 'property' => 'none', 'trait_import' => 'none', 'case' => 'none'], + 'elements' => [ + 'const' => 'none', + 'method' => 'one', + 'property' => 'none', + 'trait_import' => 'none', + 'case' => 'none', + ], ], )->withConfiguredRule( DeclareStrictTypesSniff::class, diff --git a/src/LubiSetList.php b/src/LubiSetList.php index 87017c2..092d20f 100644 --- a/src/LubiSetList.php +++ b/src/LubiSetList.php @@ -5,6 +5,5 @@ namespace Lubiana\CodeQuality; final class LubiSetList { public const string RECTOR = __DIR__ . '/../config/rector.php'; - public const string ECS = __DIR__ . '/../config/ecs.php'; } From e7ecf55e0490442efd8e453d7e4ead368e99ba7b Mon Sep 17 00:00:00 2001 From: lubiana Date: Sat, 4 May 2024 20:24:31 +0200 Subject: [PATCH 13/15] ci-fix --- .forgejo/workflows/push.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.forgejo/workflows/push.yml b/.forgejo/workflows/push.yml index 0754eff..0f5e4de 100644 --- a/.forgejo/workflows/push.yml +++ b/.forgejo/workflows/push.yml @@ -10,15 +10,16 @@ jobs: REPO: '${{ github.repository }}' TOKEN: '${{ secrets.GITHUB_TOKEN }}' GIT_SERVER: 'git.php.fail' - COMPOSER_CACHE_DIR: /opt/hostedtoolcache/.composer/cache/files run: | git clone --branch $GITHUB_REF_NAME https://${TOKEN}@${GIT_SERVER}/${REPO}.git . git fetch git checkout ${{ github.head_ref }} - - name: create composer cache dir + - name: composer install + env: + COMPOSER_CACHE_DIR: /opt/hostedtoolcache/.composer/cache/files run: | - mkdir -p /opt/hostedtoolcache/.composer/cache/files - - run: composer install + mkdir -p ${{ env.COMPOSER_CACHE_DIR }} + composer install - run: composer lint - name: GIT commit and push all changed files env: From e40beaa2d19a7930957a05eb52a6f01fa0406a35 Mon Sep 17 00:00:00 2001 From: lubiana Date: Sun, 18 Aug 2024 09:07:55 +0200 Subject: [PATCH 14/15] bump-dependencies --- composer.json | 6 +++--- composer.lock | 29 ++++++++++++++++------------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/composer.json b/composer.json index 688744a..d384621 100644 --- a/composer.json +++ b/composer.json @@ -9,9 +9,9 @@ }, "require": { "php": "^8.3", - "slevomat/coding-standard": "^8.15.0", - "symplify/easy-coding-standard": "^12.1.14", - "rector/rector": "^1.0.4" + "slevomat/coding-standard": "^8.15", + "symplify/easy-coding-standard": "^12.3.5", + "rector/rector": "^1.0.5" }, "config": { "allow-plugins": { diff --git a/composer.lock b/composer.lock index 23de7e5..a57df23 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "43ac5346cfac27bedc2e1990eccc6e6e", + "content-hash": "6eb7806e6594ecc073d158d2f9b483f0", "packages": [ { "name": "dealerdirect/phpcodesniffer-composer-installer", @@ -191,16 +191,16 @@ }, { "name": "rector/rector", - "version": "1.0.4", + "version": "1.0.5", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "6e04d0eb087aef707fa0c5686d33d6ff61f4a555" + "reference": "73eb63e4f9011dba6b7c66c3262543014e352f34" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/6e04d0eb087aef707fa0c5686d33d6ff61f4a555", - "reference": "6e04d0eb087aef707fa0c5686d33d6ff61f4a555", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/73eb63e4f9011dba6b7c66c3262543014e352f34", + "reference": "73eb63e4f9011dba6b7c66c3262543014e352f34", "shasum": "" }, "require": { @@ -238,7 +238,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/1.0.4" + "source": "https://github.com/rectorphp/rector/tree/1.0.5" }, "funding": [ { @@ -246,7 +246,7 @@ "type": "github" } ], - "time": "2024-04-05T09:01:07+00:00" + "time": "2024-05-10T05:31:15+00:00" }, { "name": "slevomat/coding-standard", @@ -395,16 +395,16 @@ }, { "name": "symplify/easy-coding-standard", - "version": "12.1.14", + "version": "12.3.5", "source": { "type": "git", "url": "https://github.com/easy-coding-standard/easy-coding-standard.git", - "reference": "e3c4a241ee36704f7cf920d5931f39693e64afd5" + "reference": "0d7c2cfee3debdf11c12135e90d69d1d9f4eef03" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/easy-coding-standard/easy-coding-standard/zipball/e3c4a241ee36704f7cf920d5931f39693e64afd5", - "reference": "e3c4a241ee36704f7cf920d5931f39693e64afd5", + "url": "https://api.github.com/repos/easy-coding-standard/easy-coding-standard/zipball/0d7c2cfee3debdf11c12135e90d69d1d9f4eef03", + "reference": "0d7c2cfee3debdf11c12135e90d69d1d9f4eef03", "shasum": "" }, "require": { @@ -415,6 +415,9 @@ "phpcsstandards/php_codesniffer": "<3.8", "symplify/coding-standard": "<12.1" }, + "suggest": { + "ext-dom": "Needed to support checkstyle output format in class CheckstyleOutputFormatter" + }, "bin": [ "bin/ecs" ], @@ -437,7 +440,7 @@ ], "support": { "issues": "https://github.com/easy-coding-standard/easy-coding-standard/issues", - "source": "https://github.com/easy-coding-standard/easy-coding-standard/tree/12.1.14" + "source": "https://github.com/easy-coding-standard/easy-coding-standard/tree/12.3.5" }, "funding": [ { @@ -449,7 +452,7 @@ "type": "github" } ], - "time": "2024-02-23T13:10:40+00:00" + "time": "2024-08-08T08:43:50+00:00" } ], "packages-dev": [], From b7e3418f0fa3225d2cdab9cfdcba266bc74775a4 Mon Sep 17 00:00:00 2001 From: lubiana Date: Sun, 18 Aug 2024 09:17:23 +0200 Subject: [PATCH 15/15] remove deprecated rectors --- config/rector.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/config/rector.php b/config/rector.php index f32142d..c6daf13 100644 --- a/config/rector.php +++ b/config/rector.php @@ -16,7 +16,6 @@ use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector; use Rector\CodingStyle\Rector\If_\NullableCompareToNullRector; use Rector\Config\RectorConfig; use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector; -use Rector\EarlyReturn\Rector\If_\ChangeAndIfToEarlyReturnRector; use Rector\EarlyReturn\Rector\If_\ChangeNestedIfsToEarlyReturnRector; use Rector\EarlyReturn\Rector\If_\ChangeOrIfContinueToMultiContinueRector; use Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector; @@ -32,7 +31,6 @@ use Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByMethodCallTypeRector; use Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByParentCallTypeRector; use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnDirectArrayRector; use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnNewRector; -use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictBoolReturnExprRector; use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictConstantReturnRector; use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictNativeCallRector; use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictNewArrayRector; @@ -59,7 +57,6 @@ return RectorConfig::configure() AddReturnTypeDeclarationBasedOnParentClassMethodRector::class, AddReturnTypeDeclarationFromYieldsRector::class, BooleanNotIdenticalToNotIdenticalRector::class, - ChangeAndIfToEarlyReturnRector::class, ChangeNestedForeachIfsToEarlyContinueRector::class, ChangeNestedIfsToEarlyReturnRector::class, ChangeOrIfContinueToMultiContinueRector::class, @@ -78,7 +75,6 @@ return RectorConfig::configure() ReturnEarlyIfVariableRector::class, ReturnTypeFromReturnDirectArrayRector::class, ReturnTypeFromReturnNewRector::class, - ReturnTypeFromStrictBoolReturnExprRector::class, ReturnTypeFromStrictConstantReturnRector::class, ReturnTypeFromStrictNativeCallRector::class, ReturnTypeFromStrictNewArrayRector::class,