From 130a5a6f0013144ccc06e8a852ea16842f06600a Mon Sep 17 00:00:00 2001 From: Alex Barnsley <8069294+alexbarnsley@users.noreply.github.com> Date: Mon, 18 Mar 2024 16:01:35 +0000 Subject: [PATCH 1/3] refactor: update rector --- composer.json | 2 +- composer.lock | 33 +++++------ rector.php | 158 ++++++++++++++++++++++---------------------------- 3 files changed, 85 insertions(+), 108 deletions(-) diff --git a/composer.json b/composer.json index 4535c55e..ce25ad96 100644 --- a/composer.json +++ b/composer.json @@ -52,7 +52,7 @@ "phpstan/phpstan-strict-rules": "^1.5", "phpunit/phpunit": "^9.2", "pragmarx/google2fa-laravel": "^2.1", - "rector/rector": "^0.17", + "rector/rector": "^0.19", "ruafozy/mersenne-twister": "^1.0", "spatie/laravel-flash": "^1.9", "spatie/laravel-honeypot": "^4.3", diff --git a/composer.lock b/composer.lock index 61b5a5c8..9931747d 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": "36b8d9938310ffbf43885b13dd46f655", + "content-hash": "d9d4382aea85ce29997b5153c083b255", "packages": [ { "name": "bacon/bacon-qr-code", @@ -5882,16 +5882,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.21", + "version": "1.10.62", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "b2a30186be2e4d97dce754ae4e65eb0ec2f04eb5" + "reference": "cd5c8a1660ed3540b211407c77abf4af193a6af9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/b2a30186be2e4d97dce754ae4e65eb0ec2f04eb5", - "reference": "b2a30186be2e4d97dce754ae4e65eb0ec2f04eb5", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/cd5c8a1660ed3540b211407c77abf4af193a6af9", + "reference": "cd5c8a1660ed3540b211407c77abf4af193a6af9", "shasum": "" }, "require": { @@ -5940,7 +5940,7 @@ "type": "tidelift" } ], - "time": "2023-06-21T20:07:58+00:00" + "time": "2024-03-13T12:27:20+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", @@ -7348,21 +7348,21 @@ }, { "name": "rector/rector", - "version": "0.17.1", + "version": "0.19.8", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "11401dc1abba0a359fabbf98f1057f4e65129f86" + "reference": "de3b3bb159abd704b144aa86fb244f7f1f4ac947" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/11401dc1abba0a359fabbf98f1057f4e65129f86", - "reference": "11401dc1abba0a359fabbf98f1057f4e65129f86", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/de3b3bb159abd704b144aa86fb244f7f1f4ac947", + "reference": "de3b3bb159abd704b144aa86fb244f7f1f4ac947", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.10.15" + "phpstan/phpstan": "^1.10.56" }, "conflict": { "rector/rector-doctrine": "*", @@ -7374,11 +7374,6 @@ "bin/rector" ], "type": "library", - "extra": { - "branch-alias": { - "dev-main": "0.15-dev" - } - }, "autoload": { "files": [ "bootstrap.php" @@ -7397,7 +7392,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.17.1" + "source": "https://github.com/rectorphp/rector/tree/0.19.8" }, "funding": [ { @@ -7405,7 +7400,7 @@ "type": "github" } ], - "time": "2023-06-14T09:05:33+00:00" + "time": "2024-02-05T10:59:13+00:00" }, { "name": "ruafozy/mersenne-twister", @@ -14393,5 +14388,5 @@ "php": "^8.0" }, "platform-dev": [], - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/rector.php b/rector.php index a34dd60e..cebc2dae 100644 --- a/rector.php +++ b/rector.php @@ -2,103 +2,85 @@ declare(strict_types=1); +use Rector\CodeQuality\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector; +use Rector\CodeQuality\Rector\BooleanNot\ReplaceMultipleBooleanNotRector; +use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector; +use Rector\CodeQuality\Rector\Identical\GetClassToInstanceOfRector; +use Rector\CodingStyle\Rector\Assign\SplitDoubleAssignRector; +use Rector\CodingStyle\Rector\ClassConst\RemoveFinalFromConstRector; +use Rector\CodingStyle\Rector\ClassConst\SplitGroupedClassConstantsRector; +use Rector\CodingStyle\Rector\ClassMethod\FuncGetArgsToVariadicParamRector; +use Rector\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector; +use Rector\CodingStyle\Rector\ClassMethod\NewlineBeforeNewAssignSetRector; +use Rector\CodingStyle\Rector\Encapsed\WrapEncapsedVariableInCurlyBracesRector; +use Rector\CodingStyle\Rector\FuncCall\CallUserFuncArrayToVariadicRector; +use Rector\CodingStyle\Rector\FuncCall\CallUserFuncToMethodCallRector; +use Rector\CodingStyle\Rector\FuncCall\ConsistentImplodeRector; +use Rector\CodingStyle\Rector\FuncCall\StrictArraySearchRector; +use Rector\CodingStyle\Rector\FuncCall\VersionCompareFuncCallToConstantRector; +use Rector\CodingStyle\Rector\Plus\UseIncrementAssignRector; +use Rector\CodingStyle\Rector\Property\SplitGroupedPropertiesRector; +use Rector\CodingStyle\Rector\Stmt\NewlineAfterStatementRector; +use Rector\CodingStyle\Rector\String_\UseClassKeywordForClassNameResolutionRector; +use Rector\CodingStyle\Rector\Ternary\TernaryConditionVariableAssignmentRector; use Rector\Config\RectorConfig; -use Rector\Core\ValueObject\PhpVersion; -use Rector\Set\ValueObject\SetList; -use RectorLaravel\Set\LaravelSetList; +use Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector; +use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector; +use Rector\Privatization\Rector\ClassMethod\PrivatizeFinalClassMethodRector; +use Rector\Privatization\Rector\MethodCall\PrivatizeLocalGetterToPropertyRector; +use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector; +use Rector\TypeDeclaration\Rector\Class_\PropertyTypeFromStrictSetterGetterRector; +use Rector\TypeDeclaration\Rector\Class_\ReturnTypeFromStrictTernaryRector; +use Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByMethodCallTypeRector; +use Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector; +use Rector\ValueObject\PhpVersion; return static function (RectorConfig $rectorConfig): void { - $dir = getcwd(); - - $rectorConfig->sets([ - SetList::PRIVATIZATION, - SetList::EARLY_RETURN, - SetList::CODING_STYLE, - LaravelSetList::LARAVEL_90, - LaravelSetList::LARAVEL_CODE_QUALITY, - LaravelSetList::LARAVEL_ARRAY_STR_FUNCTION_TO_STATIC_CALL, - ]); - - /* - * We added a custom bootstrap file to avoid Rector processing errors. - * For more info: https://github.com/rectorphp/rector/issues/6607#issuecomment-891677145 - * and https://github.com/rectorphp/rector/issues/3902. - * Bootstrap file source: https://github.com/samsonasik/example-app/blob/922ea0e43a50d9b3eb9e71f57c0af41b8ad97226/rector-bootstrap.php - */ - $rectorConfig->bootstrapFiles([$dir.'/vendor/arkecosystem/foundation/rector-bootstrap.php']); - $rectorConfig->paths([ - $dir.'/app', + __DIR__.'/app', ]); - $rectorConfig->skip([ - // skip Livewire - $dir.'/app/Http/Livewire', - $dir.'/app/App/Collaborator/Components', - $dir.'/app/App/Http/Components', - $dir.'/app/App/SecureShell/Components', - $dir.'/app/App/Server/Components', - $dir.'/app/App/Token/Components', - $dir.'/app/App/User/Components', - $dir.'/app/App/View/Components', - - // skip Nova - $dir.'/app/App/Nova', + $rectorConfig->bootstrapFiles([ + __DIR__.'/vendor/nunomaduro/larastan/bootstrap.php', ]); - $rectorConfig->phpVersion(PhpVersion::PHP_81); - + $rectorConfig->phpVersion(PhpVersion::PHP_82); $rectorConfig->importNames(); $rectorConfig->importShortClasses(false); - - if (file_exists($neon = $dir.'/vendor/arkecosystem/foundation/phpstan.neon')) { - $rectorConfig->phpstanConfig($neon); - } - - $rectorConfig->skip([ - \Rector\Privatization\Rector\Class_\FinalizeClassesWithoutChildrenRector::class, - \Rector\Privatization\Rector\Class_\RepeatedLiteralToClassConstantRector::class, - \Rector\Privatization\Rector\Property\ChangeReadOnlyPropertyWithDefaultValueToConstantRector::class, - \Rector\Privatization\Rector\Class_\ChangeReadOnlyVariableWithDefaultValueToConstantRector::class, - \Rector\CodingStyle\Rector\Catch_\CatchExceptionNameMatchingTypeRector::class, - \Rector\CodingStyle\Rector\PostInc\PostIncDecToPreIncDecRector::class, - \Rector\CodingStyle\Rector\ClassConst\VarConstantCommentRector::class, - \Rector\CodingStyle\Rector\Encapsed\EncapsedStringsToSprintfRector::class, - \Rector\CodingStyle\Rector\ClassMethod\UnSpreadOperatorRector::class, - \Rector\CodingStyle\Rector\Encapsed\WrapEncapsedVariableInCurlyBracesRector::class, - \Rector\CodingStyle\Rector\FuncCall\ConsistentPregDelimiterRector::class, + $rectorConfig->phpstanConfig('./phpstan.neon'); + + $rectorConfig->rules([ + NewlineAfterStatementRector::class, + RemoveFinalFromConstRector::class, + ConsistentImplodeRector::class, + TernaryConditionVariableAssignmentRector::class, + StringClassNameToClassConstantRector::class, + UseIncrementAssignRector::class, + SplitDoubleAssignRector::class, + WrapEncapsedVariableInCurlyBracesRector::class, + NewlineBeforeNewAssignSetRector::class, + MakeInheritedMethodVisibilitySameAsParentRector::class, + CallUserFuncArrayToVariadicRector::class, + VersionCompareFuncCallToConstantRector::class, + CallUserFuncToMethodCallRector::class, + FuncGetArgsToVariadicParamRector::class, + StrictArraySearchRector::class, + UseClassKeywordForClassNameResolutionRector::class, + SplitGroupedPropertiesRector::class, + SplitGroupedClassConstantsRector::class, + SimplifyEmptyArrayCheckRector::class, + ReplaceMultipleBooleanNotRector::class, + GetClassToInstanceOfRector::class, + PrivatizeLocalGetterToPropertyRector::class, + InlineConstructorDefaultToPropertyRector::class, + RemoveAlwaysElseRector::class, + PrivatizeFinalClassPropertyRector::class, + PrivatizeFinalClassMethodRector::class, + ParamTypeByMethodCallTypeRector::class, + + // Types... + ReturnTypeFromStrictTernaryRector::class, + PropertyTypeFromStrictSetterGetterRector::class, + ReturnNeverTypeRector::class, ]); - - // Restoration - $rectorConfig->rule(\Rector\Restoration\Rector\Property\MakeTypedPropertyNullableIfCheckedRector::class); - - // php5.5 - $rectorConfig->rule(\Rector\Php55\Rector\FuncCall\GetCalledClassToStaticClassRector::class); - - // php7.4 - $rectorConfig->rule(\Rector\Php74\Rector\FuncCall\ArrayKeyExistsOnPropertyRector::class); - $rectorConfig->rule(\Rector\Php74\Rector\Assign\NullCoalescingOperatorRector::class); - $rectorConfig->rule(\Rector\Php74\Rector\Property\RestoreDefaultNullToNullableTypePropertyRector::class); - - // php8.0 - $rectorConfig->rule(\Rector\Php80\Rector\FunctionLike\UnionTypesRector::class); - $rectorConfig->rule(\Rector\Php80\Rector\NotIdentical\StrContainsRector::class); - $rectorConfig->rule(\Rector\Php80\Rector\Identical\StrStartsWithRector::class); - $rectorConfig->rule(\Rector\Php80\Rector\Identical\StrEndsWithRector::class); - $rectorConfig->rule(\Rector\Php80\Rector\Class_\StringableForToStringRector::class); - $rectorConfig->rule(\Rector\Php80\Rector\FuncCall\ClassOnObjectRector::class); - $rectorConfig->rule(\Rector\Php80\Rector\Catch_\RemoveUnusedVariableInCatchRector::class); - $rectorConfig->rule(\Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector::class); - $rectorConfig->rule(\Rector\Php80\Rector\Switch_\ChangeSwitchToMatchRector::class); - $rectorConfig->rule(\Rector\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector::class); - $rectorConfig->rule(\Rector\Php80\Rector\ClassMethod\FinalPrivateToPrivateVisibilityRector::class); - $rectorConfig->rule(\Rector\CodeQuality\Rector\ClassMethod\OptionalParametersAfterRequiredRector::class); - $rectorConfig->rule(\Rector\Php80\Rector\FuncCall\Php8ResourceReturnToObjectRector::class); - - // php8.1 - $rectorConfig->rule(\Rector\Php81\Rector\ClassConst\FinalizePublicClassConstantRector::class); - $rectorConfig->rule(\Rector\Php81\Rector\Property\ReadOnlyPropertyRector::class); - $rectorConfig->rule(\Rector\Php81\Rector\Class_\SpatieEnumClassToEnumRector::class); - $rectorConfig->rule(\Rector\Php81\Rector\FuncCall\Php81ResourceReturnToObjectRector::class); - $rectorConfig->rule(\Rector\Php81\Rector\FunctionLike\IntersectionTypesRector::class); }; From 01b45fb3e53091eda94fb4219a226f586977c3dd Mon Sep 17 00:00:00 2001 From: alexbarnsley Date: Mon, 18 Mar 2024 16:02:07 +0000 Subject: [PATCH 2/3] style: format icons --- icons.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/icons.html b/icons.html index 536cdfb8..5712a3eb 100644 --- a/icons.html +++ b/icons.html @@ -5,7 +5,7 @@ brands/solid/bitchute
brands/solid/discord
brands/solid/facebook
brands/solid/github
brands/solid/lbry
-brands/solid/linkedin
brands/solid/reddit
brands/solid/slack
brands/solid/telegram
brands/solid/twitter
+brands/solid/linkedin
brands/solid/reddit
brands/solid/slack
brands/solid/telegram
brands/solid/twitter
brands/solid/youtube
brands/telegram
brands/tiktok
brands/twitter
brands/weibo
brands/windows
brands/x
brands/youtube-shorts-outline
brands/youtube-shorts
brands/youtube
calendar-without-dots
calendar
cards
categories
category
chain
chart-pie
check-mark-bold
check-mark-box
check-mark-small
check-mark
circle/arrow-down
circle/check-mark-big
circle/check-mark-pencil
circle/check-mark
circle/clock-big
circle/cross-big
circle/cross
circle/exclamation-mark-big
circle/exclamation-mark
circle/forward-big
circle/forward
circle/hand-big
circle/hand
circle/info
circle/lock
circle/min
circle/open-plus-inside
circle/open-plus-outside
circle/pause-big
circle/pause
circle/play-big
circle/play
circle/plus
circle/question-mark-big
circle/question-mark
circle/search
circle/shopping-cart-pointer
circle/spinner
circle/stop-big
circle/stop
circle/update
clock-ban
clock-pencil
clock
cloud-arrow-up
cloud
code
coins-stack
connection
controller
copy-key
copy
core
credit-card
cross-small
cross
dash
developer-tools
dollar-sign
double-check-mark
From 30cc5587001cee85410f8ca2cfd670cd5bad6be4 Mon Sep 17 00:00:00 2001 From: Alex Barnsley <8069294+alexbarnsley@users.noreply.github.com> Date: Mon, 18 Mar 2024 16:42:53 +0000 Subject: [PATCH 3/3] wip --- rector.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rector.php b/rector.php index cebc2dae..038837a2 100644 --- a/rector.php +++ b/rector.php @@ -36,12 +36,14 @@ use Rector\ValueObject\PhpVersion; return static function (RectorConfig $rectorConfig): void { + $dir = getcwd(); + $rectorConfig->paths([ - __DIR__.'/app', + $dir.'/app', ]); $rectorConfig->bootstrapFiles([ - __DIR__.'/vendor/nunomaduro/larastan/bootstrap.php', + $dir.'/vendor/nunomaduro/larastan/bootstrap.php', ]); $rectorConfig->phpVersion(PhpVersion::PHP_82);