From 716914313ce3d4bcba0fe4d96c2aee8dc3a49ed3 Mon Sep 17 00:00:00 2001 From: Anthony Clark Date: Wed, 3 Jan 2024 09:34:35 -0800 Subject: [PATCH] Update code style (#156) * Add Duster and update GH actions * Update code style * Update GitHub actions * Update workflow name * Update to PHP 8.2 --- .gitattributes | 3 +- .github/workflows/code_analysis.yaml | 42 +++++++++-- .github/workflows/downgraded_release.yaml | 3 +- .github/workflows/tests.yaml | 6 +- .gitignore | 13 ---- composer.json | 12 ++-- ...vel-array-str-functions-to-static-call.php | 1 - config/sets/laravel-code-quality.php | 1 - ...eloquent-magic-method-to-query-builder.php | 1 - .../laravel-facade-aliases-to-full-names.php | 1 - .../laravel-legacy-factories-to-classes.php | 1 - config/sets/laravel-static-to-injection.php | 1 - config/sets/laravel100.php | 4 +- config/sets/laravel50.php | 5 +- config/sets/laravel51.php | 3 +- config/sets/laravel52.php | 3 +- config/sets/laravel53.php | 3 +- config/sets/laravel54.php | 5 +- config/sets/laravel55.php | 3 +- config/sets/laravel56.php | 3 +- config/sets/laravel57.php | 3 +- config/sets/laravel58.php | 17 +++-- config/sets/laravel60.php | 11 ++- config/sets/laravel70.php | 17 +++-- config/sets/laravel80.php | 25 ++++--- config/sets/laravel90.php | 2 +- config/sets/level/up-to-laravel-100.php | 1 - config/sets/level/up-to-laravel-51.php | 1 - config/sets/level/up-to-laravel-52.php | 1 - config/sets/level/up-to-laravel-53.php | 1 - config/sets/level/up-to-laravel-54.php | 1 - config/sets/level/up-to-laravel-55.php | 1 - config/sets/level/up-to-laravel-56.php | 1 - config/sets/level/up-to-laravel-57.php | 1 - config/sets/level/up-to-laravel-58.php | 1 - config/sets/level/up-to-laravel-60.php | 1 - config/sets/level/up-to-laravel-70.php | 1 - config/sets/level/up-to-laravel-80.php | 1 - config/sets/level/up-to-laravel-90.php | 1 - config/sets/packages/cashier/cashier-13.php | 2 +- config/sets/packages/cashier/cashier-14.php | 2 +- duster.json | 10 +++ easy-ci.php | 13 ---- ecs.php | 19 ----- rector.php | 2 +- .../LumenRouteRegisteringMethodAnalyzer.php | 6 +- src/NodeAnalyzer/StaticCallAnalyzer.php | 4 +- src/NodeFactory/AppAssignFactory.php | 4 +- src/NodeFactory/ModelFactoryNodeFactory.php | 19 ++--- .../RouterRegisterNodeAnalyzer.php | 6 +- ...AppArrayAccessToStandaloneAssignRector.php | 4 +- ...abaseExpressionCastsToMethodCallRector.php | 2 +- .../AddArgumentDefaultValueRector.php | 4 +- .../AddGenericReturnTypeToRelationsRector.php | 5 +- .../AddParentBootToModelClassMethodRector.php | 2 +- ...ntRegisterToEventServiceProviderRector.php | 2 +- .../MigrateToSimplifiedAttributeRector.php | 11 +-- ...xtendsAnnotationToModelFactoriesRector.php | 2 +- ...ConsoleOutputFalseToConsoleTestsRector.php | 3 +- .../Class_/AnonymousMigrationsRector.php | 2 +- ...pertyDeferToDeferrableProviderToRector.php | 2 +- ...RemoveModelPropertyFromFactoriesRector.php | 2 +- .../Class_/UnifyModelDatesWithCastsRector.php | 5 +- ...tsWithOrEndsWithStaticMethodCallRector.php | 2 +- .../ArgumentFuncCallToMethodCallRector.php | 8 +-- .../FactoryFuncCallToStaticCallRector.php | 2 +- .../HelperFuncCallToFacadeClassRector.php | 2 +- ...ankFuncCallToBlankFilledFuncCallRector.php | 3 +- ...hStartOfDayMethodCallToTodayFuncRector.php | 2 +- .../FuncCall/RemoveDumpDataDeadCodeRector.php | 3 +- .../SleepFuncToSleepStaticCallRector.php | 2 +- src/Rector/If_/ThrowIfRector.php | 17 +++-- .../AssertStatusToAssertMethodRector.php | 3 +- ...ngeQueryWhereDateValueWithCarbonRector.php | 2 +- ...seExpressionToStringToMethodCallRector.php | 2 +- .../EloquentOrderByToLatestOrOldestRector.php | 72 ++++++++++--------- ...hereRelationTypeHintingParameterRector.php | 1 + ...entWhereTypeHintClosureParameterRector.php | 1 + .../FactoryApplyingStatesRector.php | 4 +- ...menRoutesStringMiddlewareToArrayRector.php | 2 + .../RedirectBackToBackHelperRector.php | 6 +- .../RedirectRouteToToRouteHelperRector.php | 4 +- ...eComponentPropertyWithinCommandsRector.php | 2 +- .../Namespace_/FactoryDefinitionRector.php | 3 +- .../New_/AddGuardToLoginEventRector.php | 4 +- .../OptionalToNullsafeOperatorRector.php | 6 +- .../ReplaceFakerInstanceWithHelperRector.php | 3 +- ...loquentMagicMethodToQueryBuilderRector.php | 16 ++--- .../MinutesToSecondsInCacheRector.php | 7 +- .../Redirect301ToPermanentRedirectRector.php | 3 +- .../RequestStaticValidateToInjectRector.php | 1 + .../StaticCall/RouteActionCallableRector.php | 4 +- src/ValueObject/AddArgumentDefaultValue.php | 10 +-- .../ArgumentFuncCallToMethodCall.php | 10 +-- src/ValueObject/ArrayFuncCallToMethodCall.php | 18 ++--- .../ServiceNameTypeAndVariableName.php | 8 +-- .../TypeToTimeMethodAndPosition.php | 8 +-- stubs/Carbon/Carbon.php | 10 ++- stubs/Illuminate/Contracts/Cache/Store.php | 1 - .../Contracts/Events/Dispatcher.php | 3 +- .../Foundation/Bus/Dispatchable.php | 1 + .../Foundation/Bus/PendingChain.php | 2 +- .../Providers/EventServiceProvider.php | 1 - stubs/Illuminate/Support/ServiceProvider.php | 1 - ...rrayAccessToStandaloneAssignRectorTest.php | 13 ++-- .../config/configured_rule.php | 1 - ...eExpressionCastsToMethodCallRectorTest.php | 13 ++-- .../AddArgumentDefaultValueRectorTest.php | 13 ++-- ...GenericReturnTypeToRelationsRectorTest.php | 13 ++-- .../config/configured_rule.php | 1 - ...ParentBootToModelClassMethodRectorTest.php | 13 ++-- .../config/configured_rule.php | 1 - ...gisterToEventServiceProviderRectorTest.php | 13 ++-- .../config/configured_rule.php | 1 - ...MigrateToSimplifiedAttributeRectorTest.php | 15 ++-- ...dsAnnotationToModelFactoriesRectorTest.php | 13 ++-- .../config/configured_rule.php | 1 - ...oleOutputFalseToConsoleTestsRectorTest.php | 13 ++-- .../config/configured_rule.php | 1 - .../AnonymousMigrationsRectorTest.php | 13 ++-- .../config/configured_rule.php | 1 - ...CashierStripeOptionsToStripeRectorTest.php | 13 ++-- .../config/configured_rule.php | 1 - ...yDeferToDeferrableProviderToRectorTest.php | 13 ++-- .../config/configured_rule.php | 1 - ...veModelPropertyFromFactoriesRectorTest.php | 13 ++-- .../config/configured_rule.php | 1 - .../UnifyModelDatesWithCastsRectorTest.php | 13 ++-- .../config/configured_rule.php | 1 - .../EmptyToBlankAndFilledFuncRectorTest.php | 13 ++-- ...ronmentComparisonToParameterRectorTest.php | 13 ++-- .../config/configured_rule.php | 1 - ...thOrEndsWithStaticMethodCallRectorTest.php | 13 ++-- ...ArgumentFuncCallToMethodCallRectorTest.php | 13 ++-- .../FactoryFuncCallToStaticCallRectorTest.php | 13 ++-- .../config/configured_rule.php | 1 - .../HelperFuncCallToFacadeClassRectorTest.php | 13 ++-- .../config/configured_rule.php | 1 - ...uncCallToBlankFilledFuncCallRectorTest.php | 13 ++-- .../config/configured_rule.php | 1 - ...rtOfDayMethodCallToTodayFuncRectorTest.php | 13 ++-- .../config/configured_rule.php | 1 - .../RemoveDumpDataDeadCodeRectorTest.php | 13 ++-- .../config/configured_rule.php | 1 - .../SleepFuncToSleepStaticCallRectorTest.php | 13 ++-- .../config/configured_rule.php | 1 - .../If_/ThrowIfRector/ThrowIfRectorTest.php | 13 ++-- .../ThrowIfRector/config/configured_rule.php | 4 +- .../AssertStatusToAssertMethodTest.php | 13 ++-- .../config/configured_rule.php | 1 - ...ueryWhereDateValueWithCarbonRectorTest.php | 13 ++-- .../config/configured_rule.php | 1 - ...pressionToStringToMethodCallRectorTest.php | 13 ++-- ...quentOrderByToLatestOrOldestRectorTest.php | 13 ++-- ...RelationTypeHintingParameterRectorTest.php | 13 ++-- ...hereTypeHintClosureParameterRectorTest.php | 13 ++-- .../config/configured_rule.php | 1 - .../FactoryApplyingStatesRectorTest.php | 13 ++-- .../config/configured_rule.php | 1 - ...outesStringActionToUsesArrayRectorTest.php | 13 ++-- ...outesStringMiddlewareToArrayRectorTest.php | 13 ++-- .../RedirectBackToBackHelperRectorTest.php | 13 ++-- .../config/configured_rule.php | 1 - ...RedirectRouteToToRouteHelperRectorTest.php | 13 ++-- .../config/configured_rule.php | 1 - ...ponentPropertyWithinCommandsRectorTest.php | 13 ++-- .../config/configured_rule.php | 1 - .../FactoryDefinitionRectorTest.php | 13 ++-- .../FactoryDefinitionRector/Source/Model.php | 1 - .../config/configured_rule.php | 1 - .../AddGuardToLoginEventRectorTest.php | 13 ++-- .../config/configured_rule.php | 1 - .../OptionalToNullsafeOperatorRectorTest.php | 13 ++-- .../config/configured_rule.php | 1 - ...placeFakerInstanceWithHelperRectorTest.php | 13 ++-- ...entMagicMethodToQueryBuilderRectorTest.php | 13 ++-- .../config/configured_rule.php | 1 - .../MinutesToSecondsInCacheRectorTest.php | 13 ++-- .../config/configured_rule.php | 1 - ...direct301ToPermanentRedirectRectorTest.php | 13 ++-- .../config/configured_rule.php | 1 - ...equestStaticValidateToInjectRectorTest.php | 13 ++-- .../config/configured_rule.php | 1 - .../RouteActionCallableRectorTest.php | 13 ++-- .../config/configured_rule.php | 1 - 185 files changed, 660 insertions(+), 573 deletions(-) create mode 100644 duster.json delete mode 100644 easy-ci.php delete mode 100644 ecs.php diff --git a/.gitattributes b/.gitattributes index ad2b2d1c..92acc15e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,8 +1,7 @@ .editorconfig export-ignore .gitattributes export-ignore .gitignore export-ignore - -ecs.php export-ignore +duster.json export-ignore phpstan.neon export-ignore phpunit.xml export-ignore stubs export-ignore diff --git a/.github/workflows/code_analysis.yaml b/.github/workflows/code_analysis.yaml index 6364d05b..e61e14dd 100644 --- a/.github/workflows/code_analysis.yaml +++ b/.github/workflows/code_analysis.yaml @@ -6,13 +6,43 @@ on: branches: - main +env: + # see https://github.com/composer/composer/issues/9368#issuecomment-718112361 + COMPOSER_ROOT_VERSION: "dev-main" + jobs: code_analysis: - uses: rectorphp/reusable-workflows/.github/workflows/code_analysis.yaml@main + runs-on: ubuntu-latest + + strategy: + matrix: + actions: + - + name: 'Composer Validate' + run: composer validate + + - + name: 'Duster Lint' + run: composer lint + + - + name: 'Rector Dry Run' + run: composer rector-dry-run + + - + name: 'PHPStan' + run: composer phpstan + + name: ${{ matrix.actions.name }} + + steps: + - uses: actions/checkout@v4 + + - uses: shivammathur/setup-php@v2 + with: + php-version: 8.3 + coverage: none - rector: - # run only on PR's from branches on main repository (from core contributors), not on the forks or PR's from forks. - if: github.event.pull_request.head.repo.full_name == github.repository && github.repository == 'driftingly/rector-laravel' + - uses: ramsey/composer-install@v2 - # see https://github.com/rectorphp/reusable-workflows - uses: rectorphp/reusable-workflows/.github/workflows/rector.yaml@main + - run: ${{ matrix.actions.run }} diff --git a/.github/workflows/downgraded_release.yaml b/.github/workflows/downgraded_release.yaml index f8d39d7f..99b6e14a 100644 --- a/.github/workflows/downgraded_release.yaml +++ b/.github/workflows/downgraded_release.yaml @@ -27,13 +27,12 @@ jobs: # downgrade /src to PHP 7.2 - run: vendor/bin/rector process src config --config build/rector-downgrade-php-72.php --ansi - - run: vendor/bin/ecs check src config --fix --ansi # copy PHP 7.2 composer - run: cp build/composer-php-72.json composer.json # clear the dev files - - run: rm -rf build .github tests stubs easy-ci.php ecs.php phpstan.neon phpunit.xml + - run: rm -rf build .github tests stubs phpstan.neon phpunit.xml # setup git user - diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 87f57695..6e5c90c8 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -14,13 +14,13 @@ jobs: tests: runs-on: ubuntu-latest - name: PHP ${{ matrix.php }} tests + name: PHP Tests steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: shivammathur/setup-php@v2 with: - php-version: 8.1 + php-version: 8.3 coverage: none - uses: ramsey/composer-install@v2 diff --git a/.gitignore b/.gitignore index f0f47e77..91298762 100644 --- a/.gitignore +++ b/.gitignore @@ -6,16 +6,3 @@ composer.lock .phpunit.result.cache .phpunit.cache - -# often customized locally - example on Github is just fine -rector-recipe.php - -# testing -abz - -# scoped & downgraded version -php-scoper.phar -box.phar -php-parallel-lint - -tmp diff --git a/composer.json b/composer.json index 26ee9ea8..9b6c53f9 100644 --- a/composer.json +++ b/composer.json @@ -12,13 +12,12 @@ "phpstan/phpstan": "^1.8.2", "symplify/phpstan-rules": "^11.0", "symplify/phpstan-extensions": "^11.0", - "symplify/easy-coding-standard": "^11.0", "symplify/rule-doc-generator": "^11.0", "rector/phpstan-rules": "^0.6", "phpstan/extension-installer": "^1.1", "phpstan/phpstan-webmozart-assert": "^1.1", "phpstan/phpstan-strict-rules": "^1.2", - "symplify/vendor-patches": "^11.0" + "tightenco/duster": "^2.7" }, "autoload": { "psr-4": { @@ -33,8 +32,12 @@ }, "scripts": { "phpstan": "vendor/bin/phpstan analyse --ansi --error-format symplify", - "check-cs": "vendor/bin/ecs check --ansi", - "fix-cs": "vendor/bin/ecs check --fix --ansi", + "check-cs": "vendor/bin/duster lint", + "fix-cs": "vendor/bin/duster fix", + "lint": "vendor/bin/duster lint", + "fix": "vendor/bin/duster fix", + "rector-dry-run": "vendor/bin/rector process --dry-run --ansi", + "rector": "vendor/bin/rector process --ansi", "docs": [ "vendor/bin/rule-doc-generator generate src --output-file docs/rector_rules_overview.md --ansi" ] @@ -43,7 +46,6 @@ "prefer-stable": true, "config": { "allow-plugins": { - "cweagans/composer-patches": true, "rector/extension-installer": true, "phpstan/extension-installer": true } diff --git a/config/sets/laravel-array-str-functions-to-static-call.php b/config/sets/laravel-array-str-functions-to-static-call.php index a1fbb3a1..e996802b 100644 --- a/config/sets/laravel-array-str-functions-to-static-call.php +++ b/config/sets/laravel-array-str-functions-to-static-call.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use Rector\Transform\Rector\FuncCall\FuncCallToStaticCallRector; use Rector\Transform\ValueObject\FuncCallToStaticCall; diff --git a/config/sets/laravel-code-quality.php b/config/sets/laravel-code-quality.php index a6cc201e..b8644ff8 100644 --- a/config/sets/laravel-code-quality.php +++ b/config/sets/laravel-code-quality.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\Assign\CallOnAppArrayAccessToStandaloneAssignRector; return static function (RectorConfig $rectorConfig): void { diff --git a/config/sets/laravel-eloquent-magic-method-to-query-builder.php b/config/sets/laravel-eloquent-magic-method-to-query-builder.php index 2e7010e7..54049876 100644 --- a/config/sets/laravel-eloquent-magic-method-to-query-builder.php +++ b/config/sets/laravel-eloquent-magic-method-to-query-builder.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\StaticCall\EloquentMagicMethodToQueryBuilderRector; return static function (RectorConfig $rectorConfig): void { diff --git a/config/sets/laravel-facade-aliases-to-full-names.php b/config/sets/laravel-facade-aliases-to-full-names.php index 7a9c05b0..f458e568 100644 --- a/config/sets/laravel-facade-aliases-to-full-names.php +++ b/config/sets/laravel-facade-aliases-to-full-names.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use Rector\Renaming\Rector\Name\RenameClassRector; return static function (RectorConfig $rectorConfig): void { diff --git a/config/sets/laravel-legacy-factories-to-classes.php b/config/sets/laravel-legacy-factories-to-classes.php index 4bb1867e..471dc45c 100644 --- a/config/sets/laravel-legacy-factories-to-classes.php +++ b/config/sets/laravel-legacy-factories-to-classes.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\FuncCall\FactoryFuncCallToStaticCallRector; use RectorLaravel\Rector\MethodCall\FactoryApplyingStatesRector; use RectorLaravel\Rector\Namespace_\FactoryDefinitionRector; diff --git a/config/sets/laravel-static-to-injection.php b/config/sets/laravel-static-to-injection.php index f291692e..5dac4610 100644 --- a/config/sets/laravel-static-to-injection.php +++ b/config/sets/laravel-static-to-injection.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use Rector\Renaming\Rector\Name\RenameClassRector; use Rector\Transform\Rector\FuncCall\FuncCallToNewRector; use Rector\Transform\Rector\StaticCall\StaticCallToMethodCallRector; diff --git a/config/sets/laravel100.php b/config/sets/laravel100.php index c003ffab..7bf894cb 100644 --- a/config/sets/laravel100.php +++ b/config/sets/laravel100.php @@ -12,7 +12,7 @@ use RectorLaravel\Rector\Class_\UnifyModelDatesWithCastsRector; use RectorLaravel\Rector\MethodCall\DatabaseExpressionToStringToMethodCallRector; -# see https://laravel.com/docs/10.x/upgrade +// see https://laravel.com/docs/10.x/upgrade return static function (RectorConfig $rectorConfig): void { $rectorConfig->import(__DIR__ . '/../config.php'); @@ -25,7 +25,7 @@ $rectorConfig ->ruleWithConfiguration(RenamePropertyRector::class, [ - # https://github.com/laravel/laravel/commit/edcbe6de7c3f17070bf0ccaa2e2b785158ae5ceb + // https://github.com/laravel/laravel/commit/edcbe6de7c3f17070bf0ccaa2e2b785158ae5ceb new RenameProperty('App\Http\Kernel', 'routeMiddleware', 'middlewareAliases'), ]); diff --git a/config/sets/laravel50.php b/config/sets/laravel50.php index 40883b65..f1fe1178 100644 --- a/config/sets/laravel50.php +++ b/config/sets/laravel50.php @@ -3,16 +3,15 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use Rector\Renaming\Rector\MethodCall\RenameMethodRector; use Rector\Renaming\Rector\Name\RenameClassRector; use Rector\Renaming\ValueObject\MethodCallRename; -# see: https://laravel.com/docs/5.0/upgrade +// see: https://laravel.com/docs/5.0/upgrade return static function (RectorConfig $rectorConfig): void { $rectorConfig->import(__DIR__ . '/../config.php'); - # https://stackoverflow.com/a/24949656/1348344 + // https://stackoverflow.com/a/24949656/1348344 $rectorConfig ->ruleWithConfiguration(RenameClassRector::class, [ 'Illuminate\Cache\CacheManager' => 'Illuminate\Contracts\Cache\Repository', diff --git a/config/sets/laravel51.php b/config/sets/laravel51.php index d6be94e8..1737bfe5 100644 --- a/config/sets/laravel51.php +++ b/config/sets/laravel51.php @@ -3,10 +3,9 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use Rector\Renaming\Rector\Name\RenameClassRector; -# see: https://laravel.com/docs/5.1/upgrade +// see: https://laravel.com/docs/5.1/upgrade return static function (RectorConfig $rectorConfig): void { $rectorConfig->import(__DIR__ . '/../config.php'); $rectorConfig diff --git a/config/sets/laravel52.php b/config/sets/laravel52.php index 94743077..f057ce3b 100644 --- a/config/sets/laravel52.php +++ b/config/sets/laravel52.php @@ -3,12 +3,11 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use Rector\Renaming\Rector\Name\RenameClassRector; use Rector\Transform\Rector\String_\StringToClassConstantRector; use Rector\Transform\ValueObject\StringToClassConstant; -# see: https://laravel.com/docs/5.2/upgrade +// see: https://laravel.com/docs/5.2/upgrade return static function (RectorConfig $rectorConfig): void { $rectorConfig->import(__DIR__ . '/../config.php'); $rectorConfig diff --git a/config/sets/laravel53.php b/config/sets/laravel53.php index 3408ff31..5b3ea4bc 100644 --- a/config/sets/laravel53.php +++ b/config/sets/laravel53.php @@ -3,14 +3,13 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use Rector\Removing\Rector\Class_\RemoveTraitUseRector; return static function (RectorConfig $rectorConfig): void { $rectorConfig->import(__DIR__ . '/../config.php'); $rectorConfig ->ruleWithConfiguration(RemoveTraitUseRector::class, [ - # see https://laravel.com/docs/5.3/upgrade + // see https://laravel.com/docs/5.3/upgrade 'Illuminate\Foundation\Auth\Access\AuthorizesResources', ]); }; diff --git a/config/sets/laravel54.php b/config/sets/laravel54.php index dc8c9c65..bbcd72d1 100644 --- a/config/sets/laravel54.php +++ b/config/sets/laravel54.php @@ -3,14 +3,13 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use Rector\Renaming\Rector\MethodCall\RenameMethodRector; use Rector\Renaming\Rector\Name\RenameClassRector; use Rector\Renaming\ValueObject\MethodCallRename; use Rector\Transform\Rector\String_\StringToClassConstantRector; use Rector\Transform\ValueObject\StringToClassConstant; -# see: https://laravel.com/docs/5.4/upgrade +// see: https://laravel.com/docs/5.4/upgrade return static function (RectorConfig $rectorConfig): void { $rectorConfig->import(__DIR__ . '/../config.php'); @@ -58,7 +57,7 @@ new MethodCallRename('Illuminate\Validation\Validator', 'addError', 'addFailure'), new MethodCallRename('Illuminate\Validation\Validator', 'doReplacements', 'makeReplacements'), - # https://github.com/laravel/framework/commit/f23ac640fa403ca8d4131c36367b53e123b6b852 + // https://github.com/laravel/framework/commit/f23ac640fa403ca8d4131c36367b53e123b6b852 new MethodCallRename( 'Illuminate\Foundation\Testing\Concerns\InteractsWithDatabase', 'seeInDatabase', diff --git a/config/sets/laravel55.php b/config/sets/laravel55.php index a49f5b05..0da6add4 100644 --- a/config/sets/laravel55.php +++ b/config/sets/laravel55.php @@ -3,14 +3,13 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use Rector\Renaming\Rector\MethodCall\RenameMethodRector; use Rector\Renaming\Rector\Name\RenameClassRector; use Rector\Renaming\Rector\PropertyFetch\RenamePropertyRector; use Rector\Renaming\ValueObject\MethodCallRename; use Rector\Renaming\ValueObject\RenameProperty; -# see: https://laravel.com/docs/5.5/upgrade +// see: https://laravel.com/docs/5.5/upgrade return static function (RectorConfig $rectorConfig): void { $rectorConfig->import(__DIR__ . '/../config.php'); diff --git a/config/sets/laravel56.php b/config/sets/laravel56.php index ce8b78dc..07a47eac 100644 --- a/config/sets/laravel56.php +++ b/config/sets/laravel56.php @@ -3,14 +3,13 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use Rector\Core\ValueObject\Visibility; use Rector\Renaming\Rector\MethodCall\RenameMethodRector; use Rector\Renaming\ValueObject\MethodCallRename; use Rector\Visibility\Rector\ClassMethod\ChangeMethodVisibilityRector; use Rector\Visibility\ValueObject\ChangeMethodVisibility; -# see: https://laravel.com/docs/5.6/upgrade +// see: https://laravel.com/docs/5.6/upgrade return static function (RectorConfig $rectorConfig): void { $rectorConfig->import(__DIR__ . '/../config.php'); diff --git a/config/sets/laravel57.php b/config/sets/laravel57.php index 02264e42..997f39b8 100644 --- a/config/sets/laravel57.php +++ b/config/sets/laravel57.php @@ -3,7 +3,6 @@ declare(strict_types=1); use PHPStan\Type\ObjectType; - use Rector\Arguments\Rector\ClassMethod\ArgumentAdderRector; use Rector\Arguments\ValueObject\ArgumentAdder; use Rector\Config\RectorConfig; @@ -18,7 +17,7 @@ use RectorLaravel\Rector\New_\AddGuardToLoginEventRector; use RectorLaravel\Rector\StaticCall\Redirect301ToPermanentRedirectRector; -# see: https://laravel.com/docs/5.7/upgrade +// see: https://laravel.com/docs/5.7/upgrade return static function (RectorConfig $rectorConfig): void { $rectorConfig->import(__DIR__ . '/../config.php'); $rectorConfig diff --git a/config/sets/laravel58.php b/config/sets/laravel58.php index 420e5b86..9c057850 100644 --- a/config/sets/laravel58.php +++ b/config/sets/laravel58.php @@ -3,7 +3,6 @@ declare(strict_types=1); use PHPStan\Type\BooleanType; - use Rector\Config\RectorConfig; use Rector\Renaming\Rector\PropertyFetch\RenamePropertyRector; use Rector\Renaming\ValueObject\RenameProperty; @@ -12,9 +11,9 @@ use RectorLaravel\Rector\Class_\PropertyDeferToDeferrableProviderToRector; use RectorLaravel\Rector\StaticCall\MinutesToSecondsInCacheRector; -# https://laravel-news.com/laravel-5-8-deprecates-string-and-array-helpers -# https://github.com/laravel/framework/pull/26898 -# see: https://laravel.com/docs/5.8/upgrade +// https://laravel-news.com/laravel-5-8-deprecates-string-and-array-helpers +// https://github.com/laravel/framework/pull/26898 +// see: https://laravel.com/docs/5.8/upgrade return static function (RectorConfig $rectorConfig): void { $rectorConfig->import(__DIR__ . '/laravel-array-str-functions-to-static-call.php'); $rectorConfig->rule(MinutesToSecondsInCacheRector::class); @@ -22,11 +21,11 @@ $rectorConfig ->ruleWithConfiguration( AddReturnTypeDeclarationRector::class, - [new AddReturnTypeDeclaration('Illuminate\Contracts\Cache\Repository', 'put', new BooleanType()), - new AddReturnTypeDeclaration('Illuminate\Contracts\Cache\Repository', 'forever', new BooleanType()), - new AddReturnTypeDeclaration('Illuminate\Contracts\Cache\Store', 'put', new BooleanType()), - new AddReturnTypeDeclaration('Illuminate\Contracts\Cache\Store', 'putMany', new BooleanType()), - new AddReturnTypeDeclaration('Illuminate\Contracts\Cache\Store', 'forever', new BooleanType()), + [new AddReturnTypeDeclaration('Illuminate\Contracts\Cache\Repository', 'put', new BooleanType), + new AddReturnTypeDeclaration('Illuminate\Contracts\Cache\Repository', 'forever', new BooleanType), + new AddReturnTypeDeclaration('Illuminate\Contracts\Cache\Store', 'put', new BooleanType), + new AddReturnTypeDeclaration('Illuminate\Contracts\Cache\Store', 'putMany', new BooleanType), + new AddReturnTypeDeclaration('Illuminate\Contracts\Cache\Store', 'forever', new BooleanType), ] ); $rectorConfig diff --git a/config/sets/laravel60.php b/config/sets/laravel60.php index 2744d6ae..1a84a5a0 100644 --- a/config/sets/laravel60.php +++ b/config/sets/laravel60.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Arguments\Rector\ClassMethod\ArgumentAdderRector; - use Rector\Arguments\ValueObject\ArgumentAdder; use Rector\Config\RectorConfig; use Rector\Core\ValueObject\Visibility; @@ -15,8 +14,8 @@ use Rector\Visibility\Rector\ClassMethod\ChangeMethodVisibilityRector; use Rector\Visibility\ValueObject\ChangeMethodVisibility; -# see https://laravel.com/docs/6.x/upgrade -# https://github.com/laravel/docs/pull/5531/files +// see https://laravel.com/docs/6.x/upgrade +// https://github.com/laravel/docs/pull/5531/files return static function (RectorConfig $rectorConfig): void { $rectorConfig->import(__DIR__ . '/../config.php'); @@ -25,20 +24,20 @@ ->ruleWithConfiguration(RenameMethodRector::class, [ new MethodCallRename( 'Illuminate\Auth\Access\Gate', - # https://github.com/laravel/framework/commit/69de466ddc25966a0f6551f48acab1afa7bb9424 + // https://github.com/laravel/framework/commit/69de466ddc25966a0f6551f48acab1afa7bb9424 'access', 'inspect' ), new MethodCallRename( 'Illuminate\Support\Facades\Lang', - # https://github.com/laravel/framework/commit/efbe23c4116f86846ad6edc0d95cd56f4175a446 + // https://github.com/laravel/framework/commit/efbe23c4116f86846ad6edc0d95cd56f4175a446 'trans', 'get' ), new MethodCallRename('Illuminate\Support\Facades\Lang', 'transChoice', 'choice'), new MethodCallRename( 'Illuminate\Translation\Translator', - # https://github.com/laravel/framework/commit/697b898a1c89881c91af83ecc4493fa681e2aa38 + // https://github.com/laravel/framework/commit/697b898a1c89881c91af83ecc4493fa681e2aa38 'getFromJson', 'get' ), diff --git a/config/sets/laravel70.php b/config/sets/laravel70.php index d1b4c8a2..7ef4624a 100644 --- a/config/sets/laravel70.php +++ b/config/sets/laravel70.php @@ -3,7 +3,6 @@ declare(strict_types=1); use PHPStan\Type\ObjectType; - use Rector\Arguments\Rector\ClassMethod\ArgumentAdderRector; use Rector\Arguments\ValueObject\ArgumentAdder; use Rector\Config\RectorConfig; @@ -13,11 +12,11 @@ use Rector\TypeDeclaration\Rector\ClassMethod\AddParamTypeDeclarationRector; use Rector\TypeDeclaration\ValueObject\AddParamTypeDeclaration; -# see https://laravel.com/docs/7.x/upgrade +// see https://laravel.com/docs/7.x/upgrade return static function (RectorConfig $rectorConfig): void { $rectorConfig->import(__DIR__ . '/../config.php'); - # https://github.com/laravel/framework/pull/30610/files + // https://github.com/laravel/framework/pull/30610/files $rectorConfig ->ruleWithConfiguration(AddParamTypeDeclarationRector::class, [ new AddParamTypeDeclaration( @@ -46,7 +45,7 @@ ), ]); - # https://github.com/laravel/framework/pull/30471/files + // https://github.com/laravel/framework/pull/30471/files $rectorConfig ->ruleWithConfiguration(ArgumentAdderRector::class, [new ArgumentAdder( 'Illuminate\Contracts\Routing\UrlRoutable', @@ -58,15 +57,15 @@ ]); $rectorConfig - ->ruleWithConfiguration(RenameMethodRector::class, [ # https://github.com/laravel/framework/commit/aece7d78f3d28b2cdb63185dcc4a9b6092841310 + ->ruleWithConfiguration(RenameMethodRector::class, [ // https://github.com/laravel/framework/commit/aece7d78f3d28b2cdb63185dcc4a9b6092841310 new MethodCallRename('Illuminate\Support\Facades\Blade', 'component', 'aliasComponent'), - # https://github.com/laravel/framework/pull/31463/files + // https://github.com/laravel/framework/pull/31463/files new MethodCallRename( 'Illuminate\Database\Eloquent\Concerns\HidesAttributes', 'addHidden', 'makeHidden' ), - # https://github.com/laravel/framework/pull/30348/files + // https://github.com/laravel/framework/pull/30348/files new MethodCallRename( 'Illuminate\Database\Eloquent\Concerns\HidesAttributes', 'addVisible', @@ -75,9 +74,9 @@ ]); $rectorConfig ->ruleWithConfiguration(RenameClassRector::class, [ - # https://github.com/laravel/framework/pull/30619/files + // https://github.com/laravel/framework/pull/30619/files 'Illuminate\Http\Resources\Json\Resource' => 'Illuminate\Http\Resources\Json\JsonResource', - # https://github.com/laravel/framework/pull/31050/files + // https://github.com/laravel/framework/pull/31050/files 'Illuminate\Foundation\Testing\TestResponse' => 'Illuminate\Testing\TestResponse', 'Illuminate\Foundation\Testing\Assert' => 'Illuminate\Testing\Assert', ]); diff --git a/config/sets/laravel80.php b/config/sets/laravel80.php index 7450bda3..8bf358c9 100644 --- a/config/sets/laravel80.php +++ b/config/sets/laravel80.php @@ -3,7 +3,6 @@ declare(strict_types=1); use PHPStan\Type\ArrayType; - use PHPStan\Type\MixedType; use Rector\Arguments\Rector\ClassMethod\ArgumentAdderRector; use Rector\Arguments\ValueObject\ArgumentAdder; @@ -16,11 +15,11 @@ use RectorLaravel\Rector\ClassMethod\AddParentRegisterToEventServiceProviderRector; use RectorLaravel\ValueObject\AddArgumentDefaultValue; -# see https://laravel.com/docs/8.x/upgrade +// see https://laravel.com/docs/8.x/upgrade return static function (RectorConfig $rectorConfig): void { $rectorConfig->import(__DIR__ . '/../config.php'); - # https://github.com/laravel/framework/commit/4d228d6e9dbcbd4d97c45665980d8b8c685b27e6 + // https://github.com/laravel/framework/commit/4d228d6e9dbcbd4d97c45665980d8b8c685b27e6 $rectorConfig ->ruleWithConfiguration(ArgumentAdderRector::class, [new ArgumentAdder( 'Illuminate\Contracts\Database\Eloquent\Castable', @@ -28,37 +27,37 @@ 0, 'arguments', [], // TODO: Add argument without default value - new ArrayType(new MixedType(), new MixedType()) + new ArrayType(new MixedType, new MixedType) ), ]); - # https://github.com/laravel/framework/commit/46084d946cdcd1ae1f32fc87a4f1cc9e3a5bccf6 + // https://github.com/laravel/framework/commit/46084d946cdcd1ae1f32fc87a4f1cc9e3a5bccf6 $rectorConfig ->ruleWithConfiguration( AddArgumentDefaultValueRector::class, [new AddArgumentDefaultValue('Illuminate\Contracts\Events\Dispatcher', 'listen', 1, null)] ); - # https://github.com/laravel/framework/commit/f1289515b27e93248c09f04e3011bb7ce21b2737 + // https://github.com/laravel/framework/commit/f1289515b27e93248c09f04e3011bb7ce21b2737 $rectorConfig->rule(AddParentRegisterToEventServiceProviderRector::class); $rectorConfig - ->ruleWithConfiguration(RenamePropertyRector::class, [ # https://github.com/laravel/framework/pull/32092/files + ->ruleWithConfiguration(RenamePropertyRector::class, [ // https://github.com/laravel/framework/pull/32092/files new RenameProperty('Illuminate\Support\Manager', 'app', 'container'), - # https://github.com/laravel/framework/commit/4656c2cf012ac62739ab5ea2bce006e1e9fe8f09 + // https://github.com/laravel/framework/commit/4656c2cf012ac62739ab5ea2bce006e1e9fe8f09 new RenameProperty('Illuminate\Contracts\Queue\ShouldQueue', 'retryAfter', 'backoff'), - # https://github.com/laravel/framework/commit/12c35e57c0a6da96f36ad77f88f083e96f927205 + // https://github.com/laravel/framework/commit/12c35e57c0a6da96f36ad77f88f083e96f927205 new RenameProperty('Illuminate\Contracts\Queue\ShouldQueue', 'timeoutAt', 'retryUntil'), ]); $rectorConfig - ->ruleWithConfiguration(RenameMethodRector::class, [ # https://github.com/laravel/framework/pull/32092/files + ->ruleWithConfiguration(RenameMethodRector::class, [ // https://github.com/laravel/framework/pull/32092/files new MethodCallRename('Illuminate\Mail\PendingMail', 'sendNow', 'send'), - # https://github.com/laravel/framework/commit/4656c2cf012ac62739ab5ea2bce006e1e9fe8f09 + // https://github.com/laravel/framework/commit/4656c2cf012ac62739ab5ea2bce006e1e9fe8f09 new MethodCallRename('Illuminate\Contracts\Queue\ShouldQueue', 'retryAfter', 'backoff'), - # https://github.com/laravel/framework/commit/12c35e57c0a6da96f36ad77f88f083e96f927205 + // https://github.com/laravel/framework/commit/12c35e57c0a6da96f36ad77f88f083e96f927205 new MethodCallRename('Illuminate\Contracts\Queue\ShouldQueue', 'timeoutAt', 'retryUntil'), - # https://github.com/laravel/framework/commit/f9374fa5fb0450721fb2f90e96adef9d409b112c + // https://github.com/laravel/framework/commit/f9374fa5fb0450721fb2f90e96adef9d409b112c new MethodCallRename('Illuminate\Testing\TestResponse', 'decodeResponseJson', 'json'), ]); }; diff --git a/config/sets/laravel90.php b/config/sets/laravel90.php index a90e3bfb..6618230e 100644 --- a/config/sets/laravel90.php +++ b/config/sets/laravel90.php @@ -13,7 +13,7 @@ use RectorLaravel\Rector\Class_\AddExtendsAnnotationToModelFactoriesRector; use RectorLaravel\Rector\PropertyFetch\ReplaceFakerInstanceWithHelperRector; -# see https://laravel.com/docs/9.x/upgrade +// see https://laravel.com/docs/9.x/upgrade return static function (RectorConfig $rectorConfig): void { $rectorConfig->import(__DIR__ . '/../config.php'); diff --git a/config/sets/level/up-to-laravel-100.php b/config/sets/level/up-to-laravel-100.php index 3de57cfd..b6c9044b 100644 --- a/config/sets/level/up-to-laravel-100.php +++ b/config/sets/level/up-to-laravel-100.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Set\LaravelLevelSetList; use RectorLaravel\Set\LaravelSetList; diff --git a/config/sets/level/up-to-laravel-51.php b/config/sets/level/up-to-laravel-51.php index f601f29d..31fdb088 100644 --- a/config/sets/level/up-to-laravel-51.php +++ b/config/sets/level/up-to-laravel-51.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Set\LaravelSetList; return static function (RectorConfig $rectorConfig): void { diff --git a/config/sets/level/up-to-laravel-52.php b/config/sets/level/up-to-laravel-52.php index 838b0115..2043018d 100644 --- a/config/sets/level/up-to-laravel-52.php +++ b/config/sets/level/up-to-laravel-52.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Set\LaravelLevelSetList; use RectorLaravel\Set\LaravelSetList; diff --git a/config/sets/level/up-to-laravel-53.php b/config/sets/level/up-to-laravel-53.php index 6f7ce17f..1e4038a3 100644 --- a/config/sets/level/up-to-laravel-53.php +++ b/config/sets/level/up-to-laravel-53.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Set\LaravelLevelSetList; use RectorLaravel\Set\LaravelSetList; diff --git a/config/sets/level/up-to-laravel-54.php b/config/sets/level/up-to-laravel-54.php index dc6a2dc4..1c7dd097 100644 --- a/config/sets/level/up-to-laravel-54.php +++ b/config/sets/level/up-to-laravel-54.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Set\LaravelLevelSetList; use RectorLaravel\Set\LaravelSetList; diff --git a/config/sets/level/up-to-laravel-55.php b/config/sets/level/up-to-laravel-55.php index 63f12517..86192c61 100644 --- a/config/sets/level/up-to-laravel-55.php +++ b/config/sets/level/up-to-laravel-55.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Set\LaravelLevelSetList; use RectorLaravel\Set\LaravelSetList; diff --git a/config/sets/level/up-to-laravel-56.php b/config/sets/level/up-to-laravel-56.php index 3ff9b5b8..6324cfe7 100644 --- a/config/sets/level/up-to-laravel-56.php +++ b/config/sets/level/up-to-laravel-56.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Set\LaravelLevelSetList; use RectorLaravel\Set\LaravelSetList; diff --git a/config/sets/level/up-to-laravel-57.php b/config/sets/level/up-to-laravel-57.php index 8d0836f7..b02807dd 100644 --- a/config/sets/level/up-to-laravel-57.php +++ b/config/sets/level/up-to-laravel-57.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Set\LaravelLevelSetList; use RectorLaravel\Set\LaravelSetList; diff --git a/config/sets/level/up-to-laravel-58.php b/config/sets/level/up-to-laravel-58.php index 4fe05613..c7cdf665 100644 --- a/config/sets/level/up-to-laravel-58.php +++ b/config/sets/level/up-to-laravel-58.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Set\LaravelLevelSetList; use RectorLaravel\Set\LaravelSetList; diff --git a/config/sets/level/up-to-laravel-60.php b/config/sets/level/up-to-laravel-60.php index 33c292e7..a23e0571 100644 --- a/config/sets/level/up-to-laravel-60.php +++ b/config/sets/level/up-to-laravel-60.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Set\LaravelLevelSetList; use RectorLaravel\Set\LaravelSetList; diff --git a/config/sets/level/up-to-laravel-70.php b/config/sets/level/up-to-laravel-70.php index 6292ea23..18ed6e05 100644 --- a/config/sets/level/up-to-laravel-70.php +++ b/config/sets/level/up-to-laravel-70.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Set\LaravelLevelSetList; use RectorLaravel\Set\LaravelSetList; diff --git a/config/sets/level/up-to-laravel-80.php b/config/sets/level/up-to-laravel-80.php index e5e664c0..d227a948 100644 --- a/config/sets/level/up-to-laravel-80.php +++ b/config/sets/level/up-to-laravel-80.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Set\LaravelLevelSetList; use RectorLaravel\Set\LaravelSetList; diff --git a/config/sets/level/up-to-laravel-90.php b/config/sets/level/up-to-laravel-90.php index 57557e2c..ce88de87 100644 --- a/config/sets/level/up-to-laravel-90.php +++ b/config/sets/level/up-to-laravel-90.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Set\LaravelLevelSetList; use RectorLaravel\Set\LaravelSetList; diff --git a/config/sets/packages/cashier/cashier-13.php b/config/sets/packages/cashier/cashier-13.php index e6a2c14f..69c0b532 100644 --- a/config/sets/packages/cashier/cashier-13.php +++ b/config/sets/packages/cashier/cashier-13.php @@ -7,7 +7,7 @@ use Rector\Renaming\ValueObject\MethodCallRename; use RectorLaravel\Rector\Class_\CashierStripeOptionsToStripeRector; -# see https://github.com/laravel/cashier-stripe/blob/master/UPGRADE.md#upgrading-to-130-from-12x +// see https://github.com/laravel/cashier-stripe/blob/master/UPGRADE.md#upgrading-to-130-from-12x return static function (RectorConfig $rectorConfig): void { $rectorConfig->import(__DIR__ . '/../../../config.php'); diff --git a/config/sets/packages/cashier/cashier-14.php b/config/sets/packages/cashier/cashier-14.php index cdeccbd9..6a8e4d5a 100644 --- a/config/sets/packages/cashier/cashier-14.php +++ b/config/sets/packages/cashier/cashier-14.php @@ -6,7 +6,7 @@ use Rector\Renaming\Rector\MethodCall\RenameMethodRector; use Rector\Renaming\ValueObject\MethodCallRename; -# see https://github.com/laravel/cashier-stripe/blob/master/UPGRADE.md#upgrading-to-140-from-13x +// see https://github.com/laravel/cashier-stripe/blob/master/UPGRADE.md#upgrading-to-140-from-13x return static function (RectorConfig $rectorConfig): void { $rectorConfig->import(__DIR__ . '/../../../config.php'); diff --git a/duster.json b/duster.json new file mode 100644 index 00000000..2c98327c --- /dev/null +++ b/duster.json @@ -0,0 +1,10 @@ +{ + "include": [ + "build", + "config", + "src" + ], + "exclude": [ + "tests/Rector/**/**/Fixture" + ] +} diff --git a/easy-ci.php b/easy-ci.php deleted file mode 100644 index 0e16f5ac..00000000 --- a/easy-ci.php +++ /dev/null @@ -1,13 +0,0 @@ -paths([__DIR__ . '/config', __DIR__ . '/src']); - - $easyCIConfig->typesToSkip([ - \Rector\Core\Contract\Rector\RectorInterface::class, - ]); -}; diff --git a/ecs.php b/ecs.php deleted file mode 100644 index 32d444f2..00000000 --- a/ecs.php +++ /dev/null @@ -1,19 +0,0 @@ -sets([SetList::PSR_12, SetList::SYMPLIFY, SetList::COMMON, SetList::CLEAN_CODE]); - - $ecsConfig->paths([__DIR__ . '/src', __DIR__ . '/tests', __DIR__ . '/config', __DIR__ . '/ecs.php']); - - $ecsConfig->skip([ - '*/Source/*', '*/Fixture/*', - // breaks annotated code - removed on symplify dev-main - ReturnAssignmentFixer::class, - ]); -}; diff --git a/rector.php b/rector.php index 7b4ce3ec..3ee1469f 100644 --- a/rector.php +++ b/rector.php @@ -22,5 +22,5 @@ StringClassNameToClassConstantRector::class, ]); - $rectorConfig->sets([LevelSetList::UP_TO_PHP_81, SetList::DEAD_CODE, SetList::CODE_QUALITY, SetList::NAMING]); + $rectorConfig->sets([LevelSetList::UP_TO_PHP_82, SetList::DEAD_CODE, SetList::CODE_QUALITY, SetList::NAMING]); }; diff --git a/src/NodeAnalyzer/LumenRouteRegisteringMethodAnalyzer.php b/src/NodeAnalyzer/LumenRouteRegisteringMethodAnalyzer.php index 4f21496e..e5d8e2b8 100644 --- a/src/NodeAnalyzer/LumenRouteRegisteringMethodAnalyzer.php +++ b/src/NodeAnalyzer/LumenRouteRegisteringMethodAnalyzer.php @@ -11,11 +11,11 @@ use Rector\NodeNameResolver\NodeNameResolver; use Rector\NodeTypeResolver\NodeTypeResolver; -final class LumenRouteRegisteringMethodAnalyzer +final readonly class LumenRouteRegisteringMethodAnalyzer { public function __construct( - private readonly NodeTypeResolver $nodeTypeResolver, - private readonly NodeNameResolver $nodeNameResolver + private NodeTypeResolver $nodeTypeResolver, + private NodeNameResolver $nodeNameResolver ) { } diff --git a/src/NodeAnalyzer/StaticCallAnalyzer.php b/src/NodeAnalyzer/StaticCallAnalyzer.php index 1dd569c2..001e2acc 100644 --- a/src/NodeAnalyzer/StaticCallAnalyzer.php +++ b/src/NodeAnalyzer/StaticCallAnalyzer.php @@ -9,10 +9,10 @@ use PhpParser\Node\Expr\StaticCall; use Rector\NodeNameResolver\NodeNameResolver; -final class StaticCallAnalyzer +final readonly class StaticCallAnalyzer { public function __construct( - private readonly NodeNameResolver $nodeNameResolver + private NodeNameResolver $nodeNameResolver ) { } diff --git a/src/NodeFactory/AppAssignFactory.php b/src/NodeFactory/AppAssignFactory.php index 726e2467..13d199fb 100644 --- a/src/NodeFactory/AppAssignFactory.php +++ b/src/NodeFactory/AppAssignFactory.php @@ -13,10 +13,10 @@ use Rector\BetterPhpDocParser\ValueObject\Type\FullyQualifiedIdentifierTypeNode; use RectorLaravel\ValueObject\ServiceNameTypeAndVariableName; -final class AppAssignFactory +final readonly class AppAssignFactory { public function __construct( - private readonly PhpDocInfoFactory $phpDocInfoFactory + private PhpDocInfoFactory $phpDocInfoFactory ) { } diff --git a/src/NodeFactory/ModelFactoryNodeFactory.php b/src/NodeFactory/ModelFactoryNodeFactory.php index 4b10c243..5bcd5753 100644 --- a/src/NodeFactory/ModelFactoryNodeFactory.php +++ b/src/NodeFactory/ModelFactoryNodeFactory.php @@ -25,7 +25,7 @@ use Rector\NodeNameResolver\NodeNameResolver; use Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser; -final class ModelFactoryNodeFactory +final readonly class ModelFactoryNodeFactory { /** * @var string @@ -33,10 +33,10 @@ final class ModelFactoryNodeFactory private const THIS = 'this'; public function __construct( - private readonly NodeNameResolver $nodeNameResolver, - private readonly NodeFactory $nodeFactory, - private readonly ValueResolver $valueResolver, - private readonly SimpleCallableNodeTraverser $simpleCallableNodeTraverser + private NodeNameResolver $nodeNameResolver, + private NodeFactory $nodeFactory, + private ValueResolver $valueResolver, + private SimpleCallableNodeTraverser $simpleCallableNodeTraverser ) { } @@ -59,7 +59,7 @@ public function createEmptyFactory(string $name, Expr $expr): Class_ 'replaceNodes' => false, 'preserveOriginalNames' => true, ]); - $nodeTraverser = new NodeTraverser(); + $nodeTraverser = new NodeTraverser; $nodeTraverser->addVisitor($nameResolver); $nodeTraverser->traverse([$class]); @@ -113,6 +113,7 @@ public function createStateMethod(MethodCall $methodCall): ?ClassMethod public function createEmptyConfigure(): ClassMethod { $return = new Return_(new Variable(self::THIS)); + return $this->createPublicMethod('configure', [$return]); } @@ -136,13 +137,14 @@ function (Node $node) use ($closure, $name): ?Return_ { } $node->expr = $this->nodeFactory->createMethodCall($node->expr, $name, [$closure]); + return $node; } ); } /** - * @param Node\Stmt[] $stmts + * @param Node\Stmt[] $stmts */ private function fakerVariableToPropertyFetch(array $stmts, Param $param): void { @@ -168,13 +170,14 @@ private function fakerVariableToPropertyFetch(array $stmts, Param $param): void } /** - * @param Node\Stmt[] $stmts + * @param Node\Stmt[] $stmts */ private function createPublicMethod(string $name, array $stmts): ClassMethod { $method = new Method($name); $method->makePublic(); $method->addStmts($stmts); + return $method->getNode(); } } diff --git a/src/NodeFactory/RouterRegisterNodeAnalyzer.php b/src/NodeFactory/RouterRegisterNodeAnalyzer.php index 35e82b13..1a2a4a18 100644 --- a/src/NodeFactory/RouterRegisterNodeAnalyzer.php +++ b/src/NodeFactory/RouterRegisterNodeAnalyzer.php @@ -12,11 +12,11 @@ use Rector\NodeNameResolver\NodeNameResolver; use Rector\NodeTypeResolver\NodeTypeResolver; -final class RouterRegisterNodeAnalyzer +final readonly class RouterRegisterNodeAnalyzer { public function __construct( - private readonly NodeNameResolver $nodeNameResolver, - private readonly NodeTypeResolver $nodeTypeResolver + private NodeNameResolver $nodeNameResolver, + private NodeTypeResolver $nodeTypeResolver ) { } diff --git a/src/Rector/Assign/CallOnAppArrayAccessToStandaloneAssignRector.php b/src/Rector/Assign/CallOnAppArrayAccessToStandaloneAssignRector.php index 51938bc7..18823396 100644 --- a/src/Rector/Assign/CallOnAppArrayAccessToStandaloneAssignRector.php +++ b/src/Rector/Assign/CallOnAppArrayAccessToStandaloneAssignRector.php @@ -52,7 +52,7 @@ public function getNodeTypes(): array } /** - * @param Expression $node + * @param Expression $node */ public function refactor(Node $node): Node|array|int|null { @@ -99,7 +99,7 @@ public function refactor(Node $node): Node|array|int|null // the nop is a workaround because the docs of the first node are somehow stripped away // this will add a newline but the docs will be preserved - return [new Nop(), $assignExpression, $node]; + return [new Nop, $assignExpression, $node]; } return null; diff --git a/src/Rector/Cast/DatabaseExpressionCastsToMethodCallRector.php b/src/Rector/Cast/DatabaseExpressionCastsToMethodCallRector.php index 9cc1f6dc..b1504dd8 100644 --- a/src/Rector/Cast/DatabaseExpressionCastsToMethodCallRector.php +++ b/src/Rector/Cast/DatabaseExpressionCastsToMethodCallRector.php @@ -44,7 +44,7 @@ public function getNodeTypes(): array } /** - * @param String_ $node + * @param String_ $node */ public function refactor(Node $node): ?Node { diff --git a/src/Rector/ClassMethod/AddArgumentDefaultValueRector.php b/src/Rector/ClassMethod/AddArgumentDefaultValueRector.php index b1012452..3705553e 100644 --- a/src/Rector/ClassMethod/AddArgumentDefaultValueRector.php +++ b/src/Rector/ClassMethod/AddArgumentDefaultValueRector.php @@ -74,7 +74,7 @@ public function getNodeTypes(): array } /** - * @param ClassMethod $node + * @param ClassMethod $node */ public function refactor(Node $node): ClassMethod { @@ -107,7 +107,7 @@ public function refactor(Node $node): ClassMethod } /** - * @param mixed[] $configuration + * @param mixed[] $configuration */ public function configure(array $configuration): void { diff --git a/src/Rector/ClassMethod/AddGenericReturnTypeToRelationsRector.php b/src/Rector/ClassMethod/AddGenericReturnTypeToRelationsRector.php index f2b31a8c..9b12b471 100644 --- a/src/Rector/ClassMethod/AddGenericReturnTypeToRelationsRector.php +++ b/src/Rector/ClassMethod/AddGenericReturnTypeToRelationsRector.php @@ -307,6 +307,7 @@ private function areGenericTypesEqual( if ($classForChildGeneric === null || ! $phpDocHasChildGeneric) { return false; } + return $this->typeComparator->areTypesEqual($phpDocTypes[1], new ObjectType($classForChildGeneric)); } @@ -321,11 +322,12 @@ private function shouldSkipNode(ClassMethod $classMethod, Scope $scope): bool if (! $classReflection instanceof ClassReflection || $classReflection->isAnonymous()) { return true; } + return ! $classReflection->isTrait() && ! $classReflection->isSubclassOf('Illuminate\Database\Eloquent\Model'); } /** - * @param array $methodNames + * @param array $methodNames */ private function doesMethodHasName(MethodCall $methodCall, array $methodNames): bool { @@ -334,6 +336,7 @@ private function doesMethodHasName(MethodCall $methodCall, array $methodNames): if (! $methodName instanceof Identifier) { return false; } + return in_array($methodName->name, $methodNames, true); } diff --git a/src/Rector/ClassMethod/AddParentBootToModelClassMethodRector.php b/src/Rector/ClassMethod/AddParentBootToModelClassMethodRector.php index f9bf3d4c..9e8f9cf5 100644 --- a/src/Rector/ClassMethod/AddParentBootToModelClassMethodRector.php +++ b/src/Rector/ClassMethod/AddParentBootToModelClassMethodRector.php @@ -75,7 +75,7 @@ public function getNodeTypes(): array } /** - * @param ClassMethod $node + * @param ClassMethod $node */ public function refactor(Node $node): ?Node { diff --git a/src/Rector/ClassMethod/AddParentRegisterToEventServiceProviderRector.php b/src/Rector/ClassMethod/AddParentRegisterToEventServiceProviderRector.php index ebe42457..17106c52 100644 --- a/src/Rector/ClassMethod/AddParentRegisterToEventServiceProviderRector.php +++ b/src/Rector/ClassMethod/AddParentRegisterToEventServiceProviderRector.php @@ -75,7 +75,7 @@ public function getNodeTypes(): array } /** - * @param ClassMethod $node + * @param ClassMethod $node */ public function refactor(Node $node): ?Node { diff --git a/src/Rector/ClassMethod/MigrateToSimplifiedAttributeRector.php b/src/Rector/ClassMethod/MigrateToSimplifiedAttributeRector.php index 90f27b83..2129e5f9 100644 --- a/src/Rector/ClassMethod/MigrateToSimplifiedAttributeRector.php +++ b/src/Rector/ClassMethod/MigrateToSimplifiedAttributeRector.php @@ -45,7 +45,7 @@ public function getNodeTypes(): array } /** - * @param Class_ $node + * @param Class_ $node */ public function refactor(Node $node): Node|array|int|null { @@ -118,7 +118,7 @@ protected function firstName(): \Illuminate\Database\Eloquent\Casts\Attribute } /** - * @param ClassMethod[] $allClassMethods + * @param ClassMethod[] $allClassMethods */ private function refactorClassMethod(ClassMethod $classMethod, array $allClassMethods): ClassMethod|int|null { @@ -231,7 +231,7 @@ private function createAccessorAndMutator( } /** - * @param array|null $statements + * @param array|null $statements */ private function createAttributeClassMethod( string $attributeName, @@ -278,7 +278,7 @@ private function isMutator(string $nodeName): bool } /** - * @param ClassMethod[] $allClassMethods + * @param ClassMethod[] $allClassMethods */ private function findPossibleAccessor(array $allClassMethods, string $attributeName): ?ClassMethod { @@ -292,7 +292,7 @@ private function findPossibleAccessor(array $allClassMethods, string $attributeN } /** - * @param ClassMethod[] $allClassMethods + * @param ClassMethod[] $allClassMethods */ private function findPossibleMutator(array $allClassMethods, string $attributeName): ?ClassMethod { @@ -374,6 +374,7 @@ private function parseAttributeName(string $nodeName): string { $attributeName = substr($nodeName, 3); $attributeName = substr($attributeName, 0, -strlen('Attribute')); + return lcfirst($attributeName); } } diff --git a/src/Rector/Class_/AddExtendsAnnotationToModelFactoriesRector.php b/src/Rector/Class_/AddExtendsAnnotationToModelFactoriesRector.php index 4a3f71ee..bbb58efe 100644 --- a/src/Rector/Class_/AddExtendsAnnotationToModelFactoriesRector.php +++ b/src/Rector/Class_/AddExtendsAnnotationToModelFactoriesRector.php @@ -76,7 +76,7 @@ public function getNodeTypes(): array } /** - * @param Class_ $node + * @param Class_ $node */ public function refactor(Node $node): ?Node { diff --git a/src/Rector/Class_/AddMockConsoleOutputFalseToConsoleTestsRector.php b/src/Rector/Class_/AddMockConsoleOutputFalseToConsoleTestsRector.php index 254c8bc3..dfc02b50 100644 --- a/src/Rector/Class_/AddMockConsoleOutputFalseToConsoleTestsRector.php +++ b/src/Rector/Class_/AddMockConsoleOutputFalseToConsoleTestsRector.php @@ -95,7 +95,7 @@ public function getNodeTypes(): array } /** - * @param Class_ $node + * @param Class_ $node */ public function refactor(Node $node): ?Node { @@ -166,6 +166,7 @@ private function hasMockConsoleOutputFalse(Class_ $class): bool private function createAssign(): Assign { $propertyFetch = new PropertyFetch(new Variable('this'), 'mockConsoleOutput'); + return new Assign($propertyFetch, $this->nodeFactory->createFalse()); } } diff --git a/src/Rector/Class_/AnonymousMigrationsRector.php b/src/Rector/Class_/AnonymousMigrationsRector.php index 8ca6cd0a..4e2cbdee 100644 --- a/src/Rector/Class_/AnonymousMigrationsRector.php +++ b/src/Rector/Class_/AnonymousMigrationsRector.php @@ -62,7 +62,7 @@ public function getNodeTypes(): array } /** - * @param Class_ $node + * @param Class_ $node */ public function refactor(Node $node): ?Node { diff --git a/src/Rector/Class_/PropertyDeferToDeferrableProviderToRector.php b/src/Rector/Class_/PropertyDeferToDeferrableProviderToRector.php index dd5cf3ba..e579421f 100644 --- a/src/Rector/Class_/PropertyDeferToDeferrableProviderToRector.php +++ b/src/Rector/Class_/PropertyDeferToDeferrableProviderToRector.php @@ -67,7 +67,7 @@ public function getNodeTypes(): array } /** - * @param Class_ $node + * @param Class_ $node */ public function refactor(Node $node): ?Node { diff --git a/src/Rector/Class_/RemoveModelPropertyFromFactoriesRector.php b/src/Rector/Class_/RemoveModelPropertyFromFactoriesRector.php index bc890446..f07a9c51 100644 --- a/src/Rector/Class_/RemoveModelPropertyFromFactoriesRector.php +++ b/src/Rector/Class_/RemoveModelPropertyFromFactoriesRector.php @@ -53,7 +53,7 @@ public function getNodeTypes(): array } /** - * @param Class_ $node + * @param Class_ $node */ public function refactor(Node $node): ?Node { diff --git a/src/Rector/Class_/UnifyModelDatesWithCastsRector.php b/src/Rector/Class_/UnifyModelDatesWithCastsRector.php index f89ae8ef..30a57967 100644 --- a/src/Rector/Class_/UnifyModelDatesWithCastsRector.php +++ b/src/Rector/Class_/UnifyModelDatesWithCastsRector.php @@ -4,6 +4,7 @@ namespace RectorLaravel\Rector\Class_; +use PhpParser\Builder\Property as PropertyBuilder; use PhpParser\Node; use PhpParser\Node\Expr\Array_; use PhpParser\Node\Expr\ArrayItem; @@ -74,7 +75,7 @@ public function getNodeTypes(): array } /** - * @param Class_ $node + * @param Class_ $node */ public function refactor(Node $node) { @@ -134,7 +135,7 @@ public function refactor(Node $node) private function createCastsProperty(): Property { - $propertyBuilder = new \PhpParser\Builder\Property('casts'); + $propertyBuilder = new PropertyBuilder('casts'); $propertyBuilder->makeProtected(); $propertyBuilder->setDefault([]); diff --git a/src/Rector/Expr/SubStrToStartsWithOrEndsWithStaticMethodCallRector/SubStrToStartsWithOrEndsWithStaticMethodCallRector.php b/src/Rector/Expr/SubStrToStartsWithOrEndsWithStaticMethodCallRector/SubStrToStartsWithOrEndsWithStaticMethodCallRector.php index 23b605ee..4274230a 100644 --- a/src/Rector/Expr/SubStrToStartsWithOrEndsWithStaticMethodCallRector/SubStrToStartsWithOrEndsWithStaticMethodCallRector.php +++ b/src/Rector/Expr/SubStrToStartsWithOrEndsWithStaticMethodCallRector/SubStrToStartsWithOrEndsWithStaticMethodCallRector.php @@ -51,7 +51,7 @@ public function getNodeTypes(): array } /** - * @param Expr $node + * @param Expr $node */ public function refactor(Node $node): ?StaticCall { diff --git a/src/Rector/FuncCall/ArgumentFuncCallToMethodCallRector.php b/src/Rector/FuncCall/ArgumentFuncCallToMethodCallRector.php index 4cdd672a..da01b526 100644 --- a/src/Rector/FuncCall/ArgumentFuncCallToMethodCallRector.php +++ b/src/Rector/FuncCall/ArgumentFuncCallToMethodCallRector.php @@ -89,7 +89,7 @@ public function getNodeTypes(): array } /** - * @param Class_ $node + * @param Class_ $node */ public function refactor(Node $node): ?Node { @@ -160,7 +160,7 @@ public function refactor(Node $node): ?Node } /** - * @param mixed[] $configuration + * @param mixed[] $configuration */ public function configure(array $configuration): void { @@ -181,7 +181,7 @@ public function refactorFuncCallToMethodCall( $methodIfArgs = $argumentFuncCallToMethodCall->getMethodIfArgs(); if (! is_string($methodIfArgs)) { - throw new ShouldNotHappenException(); + throw new ShouldNotHappenException; } return $this->nodeFactory->createMethodCall($expr, $methodIfArgs, $funcCall->args); @@ -210,7 +210,7 @@ private function refactorArrayFunctionToMethodCall( private function refactorEmptyFuncCallArgs( ArgumentFuncCallToMethodCall $argumentFuncCallToMethodCall, MethodCall|PropertyFetch|Variable $expr - ): MethodCall | PropertyFetch | Variable { + ): MethodCall|PropertyFetch|Variable { if ($argumentFuncCallToMethodCall->getMethodIfNoArgs() !== null) { return $this->nodeFactory->createMethodCall($expr, $argumentFuncCallToMethodCall->getMethodIfNoArgs()); } diff --git a/src/Rector/FuncCall/FactoryFuncCallToStaticCallRector.php b/src/Rector/FuncCall/FactoryFuncCallToStaticCallRector.php index b35f4414..73cc73b1 100644 --- a/src/Rector/FuncCall/FactoryFuncCallToStaticCallRector.php +++ b/src/Rector/FuncCall/FactoryFuncCallToStaticCallRector.php @@ -51,7 +51,7 @@ public function getNodeTypes(): array } /** - * @param Node\Expr\FuncCall $node + * @param Node\Expr\FuncCall $node */ public function refactor(Node $node): ?Node { diff --git a/src/Rector/FuncCall/HelperFuncCallToFacadeClassRector.php b/src/Rector/FuncCall/HelperFuncCallToFacadeClassRector.php index 85ac0a8e..fce95311 100644 --- a/src/Rector/FuncCall/HelperFuncCallToFacadeClassRector.php +++ b/src/Rector/FuncCall/HelperFuncCallToFacadeClassRector.php @@ -55,7 +55,7 @@ public function getNodeTypes(): array } /** - * @param FuncCall $node + * @param FuncCall $node */ public function refactor(Node $node): ?Node { diff --git a/src/Rector/FuncCall/NotFilledBlankFuncCallToBlankFilledFuncCallRector.php b/src/Rector/FuncCall/NotFilledBlankFuncCallToBlankFilledFuncCallRector.php index 2cde4563..2827ad42 100644 --- a/src/Rector/FuncCall/NotFilledBlankFuncCallToBlankFilledFuncCallRector.php +++ b/src/Rector/FuncCall/NotFilledBlankFuncCallToBlankFilledFuncCallRector.php @@ -43,7 +43,7 @@ public function getNodeTypes(): array } /** - * @param BooleanNot $node + * @param BooleanNot $node */ public function refactor(Node $node): ?FuncCall { @@ -59,6 +59,7 @@ public function refactor(Node $node): ?FuncCall } $method = $this->isName($node->expr->name, 'filled') ? 'blank' : 'filled'; + return $this->nodeFactory->createFuncCall($method, $node->expr->args); } } diff --git a/src/Rector/FuncCall/NowFuncWithStartOfDayMethodCallToTodayFuncRector.php b/src/Rector/FuncCall/NowFuncWithStartOfDayMethodCallToTodayFuncRector.php index 024f571c..ef3b0f7f 100644 --- a/src/Rector/FuncCall/NowFuncWithStartOfDayMethodCallToTodayFuncRector.php +++ b/src/Rector/FuncCall/NowFuncWithStartOfDayMethodCallToTodayFuncRector.php @@ -37,7 +37,7 @@ public function getNodeTypes(): array } /** - * @param MethodCall $node + * @param MethodCall $node */ public function refactor(Node $node): ?FuncCall { diff --git a/src/Rector/FuncCall/RemoveDumpDataDeadCodeRector.php b/src/Rector/FuncCall/RemoveDumpDataDeadCodeRector.php index 25640053..da679e4d 100644 --- a/src/Rector/FuncCall/RemoveDumpDataDeadCodeRector.php +++ b/src/Rector/FuncCall/RemoveDumpDataDeadCodeRector.php @@ -15,7 +15,6 @@ /** * @see \RectorLaravel\Tests\Rector\FuncCall\RemoveDumpDataDeadCodeRector\RemoveDumpDataDeadCodeRectorTest */ - final class RemoveDumpDataDeadCodeRector extends AbstractRector { public function getRuleDefinition(): RuleDefinition @@ -69,7 +68,7 @@ public function getNodeTypes(): array } /** - * @param Expression $node + * @param Expression $node */ public function refactor(Node $node): int|Node|array|null { diff --git a/src/Rector/FuncCall/SleepFuncToSleepStaticCallRector.php b/src/Rector/FuncCall/SleepFuncToSleepStaticCallRector.php index bf42a3db..9cfecf49 100644 --- a/src/Rector/FuncCall/SleepFuncToSleepStaticCallRector.php +++ b/src/Rector/FuncCall/SleepFuncToSleepStaticCallRector.php @@ -41,7 +41,7 @@ public function getNodeTypes(): array } /** - * @param Node\Stmt\Expression $node + * @param Node\Stmt\Expression $node */ public function refactor(Node $node): ?Node { diff --git a/src/Rector/If_/ThrowIfRector.php b/src/Rector/If_/ThrowIfRector.php index c4c7fcbb..99876161 100644 --- a/src/Rector/If_/ThrowIfRector.php +++ b/src/Rector/If_/ThrowIfRector.php @@ -3,8 +3,11 @@ namespace RectorLaravel\Rector\If_; use PhpParser\Node; +use PhpParser\Node\Arg; use PhpParser\Node\Expr\BooleanNot; use PhpParser\Node\Expr\FuncCall; +use PhpParser\Node\Name; +use PhpParser\Node\Stmt\Expression; use PhpParser\Node\Stmt\If_; use PhpParser\Node\Stmt\Throw_; use Rector\Core\Rector\AbstractRector; @@ -44,7 +47,7 @@ public function getNodeTypes(): array public function refactor(Node $node): ?Node { - if (!$node instanceof If_) { + if (! $node instanceof If_) { return null; } @@ -58,15 +61,15 @@ public function refactor(Node $node): ?Node // Check if the condition is a negation if ($condition instanceof BooleanNot) { // Create a new throw_unless function call - return new Node\Stmt\Expression(new FuncCall(new Node\Name('throw_unless'), [ - new Node\Arg($condition->expr), - new Node\Arg($throwExpr), + return new Expression(new FuncCall(new Name('throw_unless'), [ + new Arg($condition->expr), + new Arg($throwExpr), ])); } else { // Create a new throw_if function call - return new Node\Stmt\Expression(new FuncCall(new Node\Name('throw_if'), [ - new Node\Arg($condition), - new Node\Arg($throwExpr), + return new Expression(new FuncCall(new Name('throw_if'), [ + new Arg($condition), + new Arg($throwExpr), ])); } } diff --git a/src/Rector/MethodCall/AssertStatusToAssertMethodRector.php b/src/Rector/MethodCall/AssertStatusToAssertMethodRector.php index 3c0bbe11..e290567b 100644 --- a/src/Rector/MethodCall/AssertStatusToAssertMethodRector.php +++ b/src/Rector/MethodCall/AssertStatusToAssertMethodRector.php @@ -17,7 +17,6 @@ /** * @see \RectorLaravel\Tests\Rector\MethodCall\RedirectBackToBackHelperRector\RedirectBackToBackHelperRectorTest */ - final class AssertStatusToAssertMethodRector extends AbstractRector { public function getRuleDefinition(): RuleDefinition @@ -189,7 +188,7 @@ public function getNodeTypes(): array } /** - * @param MethodCall $node + * @param MethodCall $node */ public function refactor(Node $node): ?Node { diff --git a/src/Rector/MethodCall/ChangeQueryWhereDateValueWithCarbonRector.php b/src/Rector/MethodCall/ChangeQueryWhereDateValueWithCarbonRector.php index 16d02c0a..16cfa60d 100644 --- a/src/Rector/MethodCall/ChangeQueryWhereDateValueWithCarbonRector.php +++ b/src/Rector/MethodCall/ChangeQueryWhereDateValueWithCarbonRector.php @@ -77,7 +77,7 @@ public function getNodeTypes(): array } /** - * @param Expression $node + * @param Expression $node */ public function refactor(Node $node): Node|array|int|null { diff --git a/src/Rector/MethodCall/DatabaseExpressionToStringToMethodCallRector.php b/src/Rector/MethodCall/DatabaseExpressionToStringToMethodCallRector.php index 9b59e162..11bc5bb0 100644 --- a/src/Rector/MethodCall/DatabaseExpressionToStringToMethodCallRector.php +++ b/src/Rector/MethodCall/DatabaseExpressionToStringToMethodCallRector.php @@ -44,7 +44,7 @@ public function getNodeTypes(): array } /** - * @param MethodCall $node + * @param MethodCall $node */ public function refactor(Node $node): ?Node { diff --git a/src/Rector/MethodCall/EloquentOrderByToLatestOrOldestRector.php b/src/Rector/MethodCall/EloquentOrderByToLatestOrOldestRector.php index e2372761..1bc575e4 100644 --- a/src/Rector/MethodCall/EloquentOrderByToLatestOrOldestRector.php +++ b/src/Rector/MethodCall/EloquentOrderByToLatestOrOldestRector.php @@ -5,11 +5,15 @@ namespace RectorLaravel\Rector\MethodCall; use PhpParser\Node; +use PhpParser\Node\Arg; use PhpParser\Node\Expr\MethodCall; +use PhpParser\Node\Expr\Variable; +use PhpParser\Node\Identifier; +use PhpParser\Node\Scalar\String_; +use PhpParser\Node\VariadicPlaceholder; use PHPStan\Type\ObjectType; use Rector\Core\Contract\Rector\ConfigurableRectorInterface; use Rector\Core\Rector\AbstractRector; -use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; use Webmozart\Assert\Assert; @@ -47,7 +51,7 @@ public function getRuleDefinition(): RuleDefinition $builder->orderBy($unallowed_variable_name); $builder->orderBy('unallowed_column_name'); CODE_SAMPLE -,<<<'CODE_SAMPLE' + , <<<'CODE_SAMPLE' use Illuminate\Database\Eloquent\Builder; $column = 'tested_at'; @@ -60,10 +64,10 @@ public function getRuleDefinition(): RuleDefinition $builder->orderBy($unallowed_variable_name); $builder->orderBy('unallowed_column_name'); CODE_SAMPLE -, [self::ALLOWED_PATTERNS => [ - 'submitted_a*', - '*tested_at', - '$allowed_variable_name',]]), + , [self::ALLOWED_PATTERNS => [ + 'submitted_a*', + '*tested_at', + '$allowed_variable_name', ]]), ] ); } @@ -86,12 +90,24 @@ public function refactor(Node $node): ?Node return null; } + /** + * @param mixed[] $configuration + */ + public function configure(array $configuration): void + { + $allowedPatterns = $configuration[self::ALLOWED_PATTERNS] ?? []; + Assert::isArray($allowedPatterns); + Assert::allString($allowedPatterns); + + $this->allowedPatterns = $allowedPatterns; + } + private function isOrderByMethodCall(MethodCall $methodCall): bool { // Check if it's a method call to `orderBy` return $this->isObjectType($methodCall->var, new ObjectType('Illuminate\Database\Query\Builder')) - && $methodCall->name instanceof Node\Identifier + && $methodCall->name instanceof Identifier && ($methodCall->name->name === 'orderBy' || $methodCall->name->name === 'orderByDesc') && count($methodCall->args) > 0; } @@ -105,33 +121,32 @@ private function isAllowedPattern(MethodCall $methodCall): bool return true; } - if ($columnArg instanceof Node\Scalar\String_) { + if ($columnArg instanceof String_) { $columnName = $columnArg->value; // If specified, only allow certain patterns - foreach ($this->allowedPatterns as $pattern) { - if (fnmatch($pattern, $columnName)) { + foreach ($this->allowedPatterns as $allowedPattern) { + if (fnmatch($allowedPattern, $columnName)) { return true; } } } - if ($columnArg instanceof Node\Expr\Variable && is_string($columnArg->name)) { + if ($columnArg instanceof Variable && is_string($columnArg->name)) { // Check against allowed patterns - foreach ($this->allowedPatterns as $pattern) { - if (fnmatch(ltrim($pattern, '$'), $columnArg->name)) { + foreach ($this->allowedPatterns as $allowedPattern) { + if (fnmatch(ltrim($allowedPattern, '$'), $columnArg->name)) { return true; } } } - return false; } private function convertOrderByToLatest(MethodCall $methodCall): MethodCall { - if (! isset($methodCall->args[0]) && ! $methodCall->args[0] instanceof Node\VariadicPlaceholder) { + if (! isset($methodCall->args[0]) && ! $methodCall->args[0] instanceof VariadicPlaceholder) { return $methodCall; } @@ -146,36 +161,23 @@ private function convertOrderByToLatest(MethodCall $methodCall): MethodCall } else { $newMethod = $direction === 'asc' ? 'oldest' : 'latest'; } - if ($columnVar instanceof Node\Scalar\String_ && $columnVar->value === 'created_at') { - $methodCall->name = new Node\Identifier($newMethod); + if ($columnVar instanceof String_ && $columnVar->value === 'created_at') { + $methodCall->name = new Identifier($newMethod); $methodCall->args = []; return $methodCall; } - if ($columnVar instanceof Node\Scalar\String_) { - $methodCall->name = new Node\Identifier($newMethod); - $methodCall->args = [new Node\Arg(new Node\Scalar\String_($columnVar->value))]; + if ($columnVar instanceof String_) { + $methodCall->name = new Identifier($newMethod); + $methodCall->args = [new Arg(new String_($columnVar->value))]; return $methodCall; } - $methodCall->name = new Node\Identifier($newMethod); - $methodCall->args = [new Node\Arg($columnVar)]; + $methodCall->name = new Identifier($newMethod); + $methodCall->args = [new Arg($columnVar)]; return $methodCall; } - - - /** - * @param mixed[] $configuration - */ - public function configure(array $configuration): void - { - $allowedPatterns = $configuration[self::ALLOWED_PATTERNS] ?? []; - Assert::isArray($allowedPatterns); - Assert::allString($allowedPatterns); - - $this->allowedPatterns = $allowedPatterns; - } } diff --git a/src/Rector/MethodCall/EloquentWhereRelationTypeHintingParameterRector.php b/src/Rector/MethodCall/EloquentWhereRelationTypeHintingParameterRector.php index 311b4bef..eef873bb 100644 --- a/src/Rector/MethodCall/EloquentWhereRelationTypeHintingParameterRector.php +++ b/src/Rector/MethodCall/EloquentWhereRelationTypeHintingParameterRector.php @@ -82,6 +82,7 @@ private function isWhereRelationMethodWithClosureOrArrowFunction(MethodCall|Stat $node->name, ['whereHasMorph', 'orWhereHasMorph', 'whereDoesntHaveMorph', 'orWhereDoesntHaveMorph'] ) ? 2 : 1; + return ! (! ($node->getArgs()[$position]->value ?? null) instanceof Closure && ! ($node->getArgs()[$position]->value ?? null) instanceof ArrowFunction); } diff --git a/src/Rector/MethodCall/EloquentWhereTypeHintClosureParameterRector.php b/src/Rector/MethodCall/EloquentWhereTypeHintClosureParameterRector.php index 344f473b..5684788f 100644 --- a/src/Rector/MethodCall/EloquentWhereTypeHintClosureParameterRector.php +++ b/src/Rector/MethodCall/EloquentWhereTypeHintClosureParameterRector.php @@ -69,6 +69,7 @@ private function isWhereMethodWithClosureOrArrowFunction(MethodCall|StaticCall $ if (! $this->expectedObjectTypeAndMethodCall($node)) { return false; } + return ! (! ($node->getArgs()[0]->value ?? null) instanceof Closure && ! ($node->getArgs()[0]->value ?? null) instanceof ArrowFunction); } diff --git a/src/Rector/MethodCall/FactoryApplyingStatesRector.php b/src/Rector/MethodCall/FactoryApplyingStatesRector.php index 974bb474..d019a05b 100644 --- a/src/Rector/MethodCall/FactoryApplyingStatesRector.php +++ b/src/Rector/MethodCall/FactoryApplyingStatesRector.php @@ -56,7 +56,7 @@ public function getNodeTypes(): array } /** - * @param MethodCall $node + * @param MethodCall $node */ public function refactor(Node $node): ?Node { @@ -81,7 +81,7 @@ public function refactor(Node $node): ?Node } /** - * @param array $args + * @param array $args * @return mixed[] */ private function getStatesFromArgs(array $args): array diff --git a/src/Rector/MethodCall/LumenRoutesStringMiddlewareToArrayRector.php b/src/Rector/MethodCall/LumenRoutesStringMiddlewareToArrayRector.php index 703ce16e..a48ff331 100644 --- a/src/Rector/MethodCall/LumenRoutesStringMiddlewareToArrayRector.php +++ b/src/Rector/MethodCall/LumenRoutesStringMiddlewareToArrayRector.php @@ -123,8 +123,10 @@ private function findItemInArrayByKey(Array_ $array, string $keyName): ?ArrayIte if (! $foundArrayItem instanceof ArrayItem) { continue; } + return $item; } + return null; } diff --git a/src/Rector/MethodCall/RedirectBackToBackHelperRector.php b/src/Rector/MethodCall/RedirectBackToBackHelperRector.php index 1e04fe83..072290e1 100644 --- a/src/Rector/MethodCall/RedirectBackToBackHelperRector.php +++ b/src/Rector/MethodCall/RedirectBackToBackHelperRector.php @@ -16,7 +16,6 @@ /** * @see \RectorLaravel\Tests\Rector\MethodCall\RedirectBackToBackHelperRector\RedirectBackToBackHelperRectorTest */ - final class RedirectBackToBackHelperRector extends AbstractRector { public function getRuleDefinition(): RuleDefinition @@ -72,7 +71,7 @@ public function getNodeTypes(): array } /** - * @param MethodCall|StaticCall $node + * @param MethodCall|StaticCall $node */ public function refactor(Node $node): ?Node { @@ -83,7 +82,7 @@ public function refactor(Node $node): ?Node return $this->updateRedirectStaticCall($node); } - private function updateRedirectHelperCall(MethodCall $methodCall): FuncCall|null + private function updateRedirectHelperCall(MethodCall $methodCall): ?FuncCall { if (! $this->isName($methodCall->name, 'back')) { return null; @@ -103,6 +102,7 @@ private function updateRedirectHelperCall(MethodCall $methodCall): FuncCall|null $methodCall->var->name = new Name('back'); $methodCall->var->args = $methodCall->getArgs(); + return $methodCall->var; } diff --git a/src/Rector/MethodCall/RedirectRouteToToRouteHelperRector.php b/src/Rector/MethodCall/RedirectRouteToToRouteHelperRector.php index 4a86f34b..d558fb07 100644 --- a/src/Rector/MethodCall/RedirectRouteToToRouteHelperRector.php +++ b/src/Rector/MethodCall/RedirectRouteToToRouteHelperRector.php @@ -16,7 +16,6 @@ /** * @see \RectorLaravel\Tests\Rector\MethodCall\RedirectRouteToToRouteHelperRector\RedirectRouteToToRouteHelperRectorTest */ - final class RedirectRouteToToRouteHelperRector extends AbstractRector { public function getRuleDefinition(): RuleDefinition @@ -72,7 +71,7 @@ public function getNodeTypes(): array } /** - * @param MethodCall|StaticCall $node + * @param MethodCall|StaticCall $node */ public function refactor(Node $node): ?Node { @@ -103,6 +102,7 @@ private function updateRedirectHelperCall(MethodCall $methodCall): ?FuncCall $methodCall->var->name = new Name('to_route'); $methodCall->var->args = $methodCall->getArgs(); + return $methodCall->var; } diff --git a/src/Rector/MethodCall/UseComponentPropertyWithinCommandsRector.php b/src/Rector/MethodCall/UseComponentPropertyWithinCommandsRector.php index dc2cbafe..5a35c2f8 100644 --- a/src/Rector/MethodCall/UseComponentPropertyWithinCommandsRector.php +++ b/src/Rector/MethodCall/UseComponentPropertyWithinCommandsRector.php @@ -66,7 +66,7 @@ public function getNodeTypes(): array } /** - * @param Class_ $node + * @param Class_ $node */ public function refactor(Node $node): ?Node { diff --git a/src/Rector/Namespace_/FactoryDefinitionRector.php b/src/Rector/Namespace_/FactoryDefinitionRector.php index 4d0b22bd..8bba9276 100644 --- a/src/Rector/Namespace_/FactoryDefinitionRector.php +++ b/src/Rector/Namespace_/FactoryDefinitionRector.php @@ -79,7 +79,7 @@ public function getNodeTypes(): array } /** - * @param Namespace_|FileWithoutNamespace $node + * @param Namespace_|FileWithoutNamespace $node */ public function refactor(Node $node): ?Node { @@ -123,6 +123,7 @@ public function refactor(Node $node): ?Node } $node->stmts = array_merge($node->stmts, $factories); + return $node; } diff --git a/src/Rector/New_/AddGuardToLoginEventRector.php b/src/Rector/New_/AddGuardToLoginEventRector.php index 7bee8e41..c4ff5db0 100644 --- a/src/Rector/New_/AddGuardToLoginEventRector.php +++ b/src/Rector/New_/AddGuardToLoginEventRector.php @@ -67,7 +67,7 @@ public function getNodeTypes(): array } /** - * @param Expression $node + * @param Expression $node */ public function refactor(Node $node): Node|array|int|null { @@ -100,7 +100,7 @@ private function createGuardAssign(Variable $guardVariable): Assign return new Assign($guardVariable, $this->nodeFactory->createFuncCall('config', [$string])); } - private function getNewNode(Expression $expression): New_|null + private function getNewNode(Expression $expression): ?New_ { if ($expression->expr instanceof Assign && $expression->expr->expr instanceof New_) { return $expression->expr->expr; diff --git a/src/Rector/PropertyFetch/OptionalToNullsafeOperatorRector.php b/src/Rector/PropertyFetch/OptionalToNullsafeOperatorRector.php index 0eba6aa9..8d2d81e0 100644 --- a/src/Rector/PropertyFetch/OptionalToNullsafeOperatorRector.php +++ b/src/Rector/PropertyFetch/OptionalToNullsafeOperatorRector.php @@ -32,7 +32,7 @@ * * @see \RectorLaravel\Tests\Rector\PropertyFetch\OptionalToNullsafeOperatorRector\OptionalToNullsafeOperatorRectorTest */ -final class OptionalToNullsafeOperatorRector extends AbstractRector implements MinPhpVersionInterface, ConfigurableRectorInterface +final class OptionalToNullsafeOperatorRector extends AbstractRector implements ConfigurableRectorInterface, MinPhpVersionInterface { /** * @var string @@ -91,7 +91,7 @@ public function getNodeTypes(): array } /** - * @param MethodCall|PropertyFetch $node + * @param MethodCall|PropertyFetch $node */ public function refactor(Node $node): ?Node { @@ -138,7 +138,7 @@ public function provideMinPhpVersion(): int } /** - * @param mixed[] $configuration + * @param mixed[] $configuration */ public function configure(array $configuration): void { diff --git a/src/Rector/PropertyFetch/ReplaceFakerInstanceWithHelperRector.php b/src/Rector/PropertyFetch/ReplaceFakerInstanceWithHelperRector.php index 8a08e27b..d259d110 100644 --- a/src/Rector/PropertyFetch/ReplaceFakerInstanceWithHelperRector.php +++ b/src/Rector/PropertyFetch/ReplaceFakerInstanceWithHelperRector.php @@ -69,7 +69,7 @@ public function getNodeTypes(): array } /** - * @param PropertyFetch|MethodCall $node + * @param PropertyFetch|MethodCall $node */ public function refactor(Node $node): ?Node { @@ -117,6 +117,7 @@ private function refactorPropertyFetch(MethodCall|PropertyFetch $node): MethodCa } $node->var = $funcCall; + return $node; } diff --git a/src/Rector/StaticCall/EloquentMagicMethodToQueryBuilderRector.php b/src/Rector/StaticCall/EloquentMagicMethodToQueryBuilderRector.php index cbfc2eb0..d26f05d8 100644 --- a/src/Rector/StaticCall/EloquentMagicMethodToQueryBuilderRector.php +++ b/src/Rector/StaticCall/EloquentMagicMethodToQueryBuilderRector.php @@ -26,21 +26,21 @@ public function getRuleDefinition(): RuleDefinition return new RuleDefinition( 'The EloquentMagicMethodToQueryBuilderRule is designed to automatically transform certain magic method calls on Eloquent Models into corresponding Query Builder method calls.', [ - new CodeSample( - <<<'CODE_SAMPLE' + new CodeSample( + <<<'CODE_SAMPLE' use App\Models\User; $user = User::find(1); CODE_SAMPLE -, - <<<'CODE_SAMPLE' + , + <<<'CODE_SAMPLE' use App\Models\User; $user = User::query()->find(1); CODE_SAMPLE - ), - - ]); + ), + + ]); } /** @@ -52,7 +52,7 @@ public function getNodeTypes(): array } /** - * @param StaticCall $node + * @param StaticCall $node */ public function refactor(Node $node): ?Node { diff --git a/src/Rector/StaticCall/MinutesToSecondsInCacheRector.php b/src/Rector/StaticCall/MinutesToSecondsInCacheRector.php index 8897967f..3bfae00c 100644 --- a/src/Rector/StaticCall/MinutesToSecondsInCacheRector.php +++ b/src/Rector/StaticCall/MinutesToSecondsInCacheRector.php @@ -102,7 +102,7 @@ public function getNodeTypes(): array } /** - * @param StaticCall|MethodCall $node + * @param StaticCall|MethodCall $node */ public function refactor(Node $node): ?Node { @@ -127,6 +127,7 @@ public function refactor(Node $node): ?Node } $argValue = $node->args[$typeToTimeMethodAndPosition->getPosition()]->value; + return $this->processArgumentOnPosition($node, $argValue, $typeToTimeMethodAndPosition->getPosition()); } @@ -134,10 +135,10 @@ public function refactor(Node $node): ?Node } private function processArgumentOnPosition( - StaticCall | MethodCall $node, + StaticCall|MethodCall $node, Expr $argExpr, int $argumentPosition - ): StaticCall | MethodCall | null { + ): StaticCall|MethodCall|null { if (! $this->nodeTypeResolver->isNumberType($argExpr)) { return null; } diff --git a/src/Rector/StaticCall/Redirect301ToPermanentRedirectRector.php b/src/Rector/StaticCall/Redirect301ToPermanentRedirectRector.php index 41c1ccbc..7e013abe 100644 --- a/src/Rector/StaticCall/Redirect301ToPermanentRedirectRector.php +++ b/src/Rector/StaticCall/Redirect301ToPermanentRedirectRector.php @@ -16,6 +16,7 @@ /** * @changelog https://laravel.com/docs/5.7/upgrade + * * @see \RectorLaravel\Tests\Rector\StaticCall\Redirect301ToPermanentRedirectRector\Redirect301ToPermanentRedirectRectorTest */ final class Redirect301ToPermanentRedirectRector extends AbstractRector @@ -73,7 +74,7 @@ public function getNodeTypes(): array } /** - * @param StaticCall $node + * @param StaticCall $node */ public function refactor(Node $node): ?Node { diff --git a/src/Rector/StaticCall/RequestStaticValidateToInjectRector.php b/src/Rector/StaticCall/RequestStaticValidateToInjectRector.php index 6c518c23..980183b6 100644 --- a/src/Rector/StaticCall/RequestStaticValidateToInjectRector.php +++ b/src/Rector/StaticCall/RequestStaticValidateToInjectRector.php @@ -23,6 +23,7 @@ /** * @changelog https://github.com/laravel/framework/pull/27276 + * * @see \RectorLaravel\Tests\Rector\StaticCall\RequestStaticValidateToInjectRector\RequestStaticValidateToInjectRectorTest */ final class RequestStaticValidateToInjectRector extends AbstractScopeAwareRector diff --git a/src/Rector/StaticCall/RouteActionCallableRector.php b/src/Rector/StaticCall/RouteActionCallableRector.php index 59633762..3a1eaed0 100644 --- a/src/Rector/StaticCall/RouteActionCallableRector.php +++ b/src/Rector/StaticCall/RouteActionCallableRector.php @@ -90,7 +90,7 @@ public function getNodeTypes(): array } /** - * @param MethodCall|StaticCall $node + * @param MethodCall|StaticCall $node */ public function refactor(Node $node): ?Node { @@ -156,7 +156,7 @@ public function refactor(Node $node): ?Node } /** - * @param mixed[] $configuration + * @param mixed[] $configuration */ public function configure(array $configuration): void { diff --git a/src/ValueObject/AddArgumentDefaultValue.php b/src/ValueObject/AddArgumentDefaultValue.php index e8a55283..6ab9a18f 100644 --- a/src/ValueObject/AddArgumentDefaultValue.php +++ b/src/ValueObject/AddArgumentDefaultValue.php @@ -6,13 +6,13 @@ use PHPStan\Type\ObjectType; -final class AddArgumentDefaultValue +final readonly class AddArgumentDefaultValue { public function __construct( - private readonly string $class, - private readonly string $method, - private readonly int $position, - private readonly mixed $defaultValue + private string $class, + private string $method, + private int $position, + private mixed $defaultValue ) { } diff --git a/src/ValueObject/ArgumentFuncCallToMethodCall.php b/src/ValueObject/ArgumentFuncCallToMethodCall.php index ad8e967a..920a098f 100644 --- a/src/ValueObject/ArgumentFuncCallToMethodCall.php +++ b/src/ValueObject/ArgumentFuncCallToMethodCall.php @@ -7,13 +7,13 @@ use Rector\Core\Validation\RectorAssert; use RectorLaravel\Contract\ValueObject\ArgumentFuncCallToMethodCallInterface; -final class ArgumentFuncCallToMethodCall implements ArgumentFuncCallToMethodCallInterface +final readonly class ArgumentFuncCallToMethodCall implements ArgumentFuncCallToMethodCallInterface { public function __construct( - private readonly string $function, - private readonly string $class, - private readonly ?string $methodIfArgs = null, - private readonly ?string $methodIfNoArgs = null + private string $function, + private string $class, + private ?string $methodIfArgs = null, + private ?string $methodIfNoArgs = null ) { RectorAssert::className($class); RectorAssert::functionName($function); diff --git a/src/ValueObject/ArrayFuncCallToMethodCall.php b/src/ValueObject/ArrayFuncCallToMethodCall.php index 53c9734c..7430c247 100644 --- a/src/ValueObject/ArrayFuncCallToMethodCall.php +++ b/src/ValueObject/ArrayFuncCallToMethodCall.php @@ -7,19 +7,19 @@ use Rector\Core\Validation\RectorAssert; use RectorLaravel\Contract\ValueObject\ArgumentFuncCallToMethodCallInterface; -final class ArrayFuncCallToMethodCall implements ArgumentFuncCallToMethodCallInterface +final readonly class ArrayFuncCallToMethodCall implements ArgumentFuncCallToMethodCallInterface { /** - * @param non-empty-string $function - * @param non-empty-string $class - * @param non-empty-string $arrayMethod - * @param non-empty-string $nonArrayMethod + * @param non-empty-string $function + * @param non-empty-string $class + * @param non-empty-string $arrayMethod + * @param non-empty-string $nonArrayMethod */ public function __construct( - private readonly string $function, - private readonly string $class, - private readonly string $arrayMethod, - private readonly string $nonArrayMethod + private string $function, + private string $class, + private string $arrayMethod, + private string $nonArrayMethod ) { RectorAssert::className($class); RectorAssert::functionName($function); diff --git a/src/ValueObject/ServiceNameTypeAndVariableName.php b/src/ValueObject/ServiceNameTypeAndVariableName.php index ca8a4c3e..3c2a7b8c 100644 --- a/src/ValueObject/ServiceNameTypeAndVariableName.php +++ b/src/ValueObject/ServiceNameTypeAndVariableName.php @@ -4,12 +4,12 @@ namespace RectorLaravel\ValueObject; -final class ServiceNameTypeAndVariableName +final readonly class ServiceNameTypeAndVariableName { public function __construct( - private readonly string $serviceName, - private readonly string $type, - private readonly string $variableName + private string $serviceName, + private string $type, + private string $variableName ) { } diff --git a/src/ValueObject/TypeToTimeMethodAndPosition.php b/src/ValueObject/TypeToTimeMethodAndPosition.php index 83b9d5d3..74684bd7 100644 --- a/src/ValueObject/TypeToTimeMethodAndPosition.php +++ b/src/ValueObject/TypeToTimeMethodAndPosition.php @@ -6,12 +6,12 @@ use PHPStan\Type\ObjectType; -final class TypeToTimeMethodAndPosition +final readonly class TypeToTimeMethodAndPosition { public function __construct( - private readonly string $type, - private readonly string $methodName, - private readonly int $position + private string $type, + private string $methodName, + private int $position ) { } diff --git a/stubs/Carbon/Carbon.php b/stubs/Carbon/Carbon.php index 71c0e2bc..22ab416a 100644 --- a/stubs/Carbon/Carbon.php +++ b/stubs/Carbon/Carbon.php @@ -2,24 +2,22 @@ namespace Carbon; -use DateInterval; -use DateTimeInterface; -use DateTimeZone; +use DateTime; if (class_exists('Carbon\Carbon')) { return; } -class Carbon extends \DateTime +class Carbon extends DateTime { public static function now(): self { - return new self(); + return new self; } public static function today(): self { - return new self(); + return new self; } public function subDays(int $days): self diff --git a/stubs/Illuminate/Contracts/Cache/Store.php b/stubs/Illuminate/Contracts/Cache/Store.php index e251e2dc..cf1ae18a 100644 --- a/stubs/Illuminate/Contracts/Cache/Store.php +++ b/stubs/Illuminate/Contracts/Cache/Store.php @@ -10,5 +10,4 @@ interface Store { - } diff --git a/stubs/Illuminate/Contracts/Events/Dispatcher.php b/stubs/Illuminate/Contracts/Events/Dispatcher.php index efd671cf..97d7158d 100644 --- a/stubs/Illuminate/Contracts/Events/Dispatcher.php +++ b/stubs/Illuminate/Contracts/Events/Dispatcher.php @@ -1,9 +1,10 @@ doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/Assign/CallOnAppArrayAccessToStandaloneAssignRector/config/configured_rule.php b/tests/Rector/Assign/CallOnAppArrayAccessToStandaloneAssignRector/config/configured_rule.php index a838c7e5..b9b4ccbf 100644 --- a/tests/Rector/Assign/CallOnAppArrayAccessToStandaloneAssignRector/config/configured_rule.php +++ b/tests/Rector/Assign/CallOnAppArrayAccessToStandaloneAssignRector/config/configured_rule.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\Assign\CallOnAppArrayAccessToStandaloneAssignRector; return static function (RectorConfig $rectorConfig): void { diff --git a/tests/Rector/Cast/DatabaseExpressionCastsToMethodCallRector/DatabaseExpressionCastsToMethodCallRectorTest.php b/tests/Rector/Cast/DatabaseExpressionCastsToMethodCallRector/DatabaseExpressionCastsToMethodCallRectorTest.php index 2d108b9a..6c285fb4 100644 --- a/tests/Rector/Cast/DatabaseExpressionCastsToMethodCallRector/DatabaseExpressionCastsToMethodCallRectorTest.php +++ b/tests/Rector/Cast/DatabaseExpressionCastsToMethodCallRector/DatabaseExpressionCastsToMethodCallRectorTest.php @@ -10,15 +10,18 @@ final class DatabaseExpressionCastsToMethodCallRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/ClassMethod/AddArgumentDefaultValueRector/AddArgumentDefaultValueRectorTest.php b/tests/Rector/ClassMethod/AddArgumentDefaultValueRector/AddArgumentDefaultValueRectorTest.php index 003c0b2b..47479178 100644 --- a/tests/Rector/ClassMethod/AddArgumentDefaultValueRector/AddArgumentDefaultValueRectorTest.php +++ b/tests/Rector/ClassMethod/AddArgumentDefaultValueRector/AddArgumentDefaultValueRectorTest.php @@ -10,15 +10,18 @@ final class AddArgumentDefaultValueRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/ClassMethod/AddGenericReturnTypeToRelationsRector/AddGenericReturnTypeToRelationsRectorTest.php b/tests/Rector/ClassMethod/AddGenericReturnTypeToRelationsRector/AddGenericReturnTypeToRelationsRectorTest.php index 3eab5fd7..3876b6a2 100644 --- a/tests/Rector/ClassMethod/AddGenericReturnTypeToRelationsRector/AddGenericReturnTypeToRelationsRectorTest.php +++ b/tests/Rector/ClassMethod/AddGenericReturnTypeToRelationsRector/AddGenericReturnTypeToRelationsRectorTest.php @@ -10,15 +10,18 @@ final class AddGenericReturnTypeToRelationsRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/ClassMethod/AddGenericReturnTypeToRelationsRector/config/configured_rule.php b/tests/Rector/ClassMethod/AddGenericReturnTypeToRelationsRector/config/configured_rule.php index db746339..aacc7549 100644 --- a/tests/Rector/ClassMethod/AddGenericReturnTypeToRelationsRector/config/configured_rule.php +++ b/tests/Rector/ClassMethod/AddGenericReturnTypeToRelationsRector/config/configured_rule.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\ClassMethod\AddGenericReturnTypeToRelationsRector; return static function (RectorConfig $rectorConfig): void { diff --git a/tests/Rector/ClassMethod/AddParentBootToModelClassMethodRector/AddParentBootToModelClassMethodRectorTest.php b/tests/Rector/ClassMethod/AddParentBootToModelClassMethodRector/AddParentBootToModelClassMethodRectorTest.php index f4cd2580..821edf09 100644 --- a/tests/Rector/ClassMethod/AddParentBootToModelClassMethodRector/AddParentBootToModelClassMethodRectorTest.php +++ b/tests/Rector/ClassMethod/AddParentBootToModelClassMethodRector/AddParentBootToModelClassMethodRectorTest.php @@ -10,15 +10,18 @@ final class AddParentBootToModelClassMethodRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/ClassMethod/AddParentBootToModelClassMethodRector/config/configured_rule.php b/tests/Rector/ClassMethod/AddParentBootToModelClassMethodRector/config/configured_rule.php index 5f7dd24e..46fbd68a 100644 --- a/tests/Rector/ClassMethod/AddParentBootToModelClassMethodRector/config/configured_rule.php +++ b/tests/Rector/ClassMethod/AddParentBootToModelClassMethodRector/config/configured_rule.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\ClassMethod\AddParentBootToModelClassMethodRector; return static function (RectorConfig $rectorConfig): void { diff --git a/tests/Rector/ClassMethod/AddParentRegisterToEventServiceProviderRector/AddParentRegisterToEventServiceProviderRectorTest.php b/tests/Rector/ClassMethod/AddParentRegisterToEventServiceProviderRector/AddParentRegisterToEventServiceProviderRectorTest.php index a7c57abf..4e2a3c61 100644 --- a/tests/Rector/ClassMethod/AddParentRegisterToEventServiceProviderRector/AddParentRegisterToEventServiceProviderRectorTest.php +++ b/tests/Rector/ClassMethod/AddParentRegisterToEventServiceProviderRector/AddParentRegisterToEventServiceProviderRectorTest.php @@ -10,15 +10,18 @@ final class AddParentRegisterToEventServiceProviderRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/ClassMethod/AddParentRegisterToEventServiceProviderRector/config/configured_rule.php b/tests/Rector/ClassMethod/AddParentRegisterToEventServiceProviderRector/config/configured_rule.php index e790bc0d..d5513074 100644 --- a/tests/Rector/ClassMethod/AddParentRegisterToEventServiceProviderRector/config/configured_rule.php +++ b/tests/Rector/ClassMethod/AddParentRegisterToEventServiceProviderRector/config/configured_rule.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\ClassMethod\AddParentRegisterToEventServiceProviderRector; return static function (RectorConfig $rectorConfig): void { diff --git a/tests/Rector/ClassMethod/MigrateToSimplifiedAttributeRector/MigrateToSimplifiedAttributeRectorTest.php b/tests/Rector/ClassMethod/MigrateToSimplifiedAttributeRector/MigrateToSimplifiedAttributeRectorTest.php index fcef320c..c92939d1 100644 --- a/tests/Rector/ClassMethod/MigrateToSimplifiedAttributeRector/MigrateToSimplifiedAttributeRectorTest.php +++ b/tests/Rector/ClassMethod/MigrateToSimplifiedAttributeRector/MigrateToSimplifiedAttributeRectorTest.php @@ -10,12 +10,6 @@ class MigrateToSimplifiedAttributeRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void - { - $this->doTestFile($filePath); - } - /** * @return Iterator */ @@ -24,6 +18,15 @@ public static function provideData(): Iterator return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void + { + $this->doTestFile($filePath); + } + public function provideConfigFilePath(): string { return __DIR__ . '/config/configured_rule.php'; diff --git a/tests/Rector/Class_/AddExtendsAnnotationToModelFactoriesRector/AddExtendsAnnotationToModelFactoriesRectorTest.php b/tests/Rector/Class_/AddExtendsAnnotationToModelFactoriesRector/AddExtendsAnnotationToModelFactoriesRectorTest.php index 03be9229..e9260292 100644 --- a/tests/Rector/Class_/AddExtendsAnnotationToModelFactoriesRector/AddExtendsAnnotationToModelFactoriesRectorTest.php +++ b/tests/Rector/Class_/AddExtendsAnnotationToModelFactoriesRector/AddExtendsAnnotationToModelFactoriesRectorTest.php @@ -10,15 +10,18 @@ final class AddExtendsAnnotationToModelFactoriesRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/Class_/AddExtendsAnnotationToModelFactoriesRector/config/configured_rule.php b/tests/Rector/Class_/AddExtendsAnnotationToModelFactoriesRector/config/configured_rule.php index 5208b5c2..0ac8b9ef 100644 --- a/tests/Rector/Class_/AddExtendsAnnotationToModelFactoriesRector/config/configured_rule.php +++ b/tests/Rector/Class_/AddExtendsAnnotationToModelFactoriesRector/config/configured_rule.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\Class_\AddExtendsAnnotationToModelFactoriesRector; return static function (RectorConfig $rectorConfig): void { diff --git a/tests/Rector/Class_/AddMockConsoleOutputFalseToConsoleTestsRector/AddMockConsoleOutputFalseToConsoleTestsRectorTest.php b/tests/Rector/Class_/AddMockConsoleOutputFalseToConsoleTestsRector/AddMockConsoleOutputFalseToConsoleTestsRectorTest.php index 3da07d4f..fd7f2ca1 100644 --- a/tests/Rector/Class_/AddMockConsoleOutputFalseToConsoleTestsRector/AddMockConsoleOutputFalseToConsoleTestsRectorTest.php +++ b/tests/Rector/Class_/AddMockConsoleOutputFalseToConsoleTestsRector/AddMockConsoleOutputFalseToConsoleTestsRectorTest.php @@ -10,15 +10,18 @@ final class AddMockConsoleOutputFalseToConsoleTestsRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/Class_/AddMockConsoleOutputFalseToConsoleTestsRector/config/configured_rule.php b/tests/Rector/Class_/AddMockConsoleOutputFalseToConsoleTestsRector/config/configured_rule.php index d524d808..4a96c9f0 100644 --- a/tests/Rector/Class_/AddMockConsoleOutputFalseToConsoleTestsRector/config/configured_rule.php +++ b/tests/Rector/Class_/AddMockConsoleOutputFalseToConsoleTestsRector/config/configured_rule.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\Class_\AddMockConsoleOutputFalseToConsoleTestsRector; return static function (RectorConfig $rectorConfig): void { diff --git a/tests/Rector/Class_/AnonymousMigrationsRector/AnonymousMigrationsRectorTest.php b/tests/Rector/Class_/AnonymousMigrationsRector/AnonymousMigrationsRectorTest.php index 2f1eb6b7..75cd343e 100644 --- a/tests/Rector/Class_/AnonymousMigrationsRector/AnonymousMigrationsRectorTest.php +++ b/tests/Rector/Class_/AnonymousMigrationsRector/AnonymousMigrationsRectorTest.php @@ -10,15 +10,18 @@ final class AnonymousMigrationsRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/Class_/AnonymousMigrationsRector/config/configured_rule.php b/tests/Rector/Class_/AnonymousMigrationsRector/config/configured_rule.php index b250da38..454659d3 100644 --- a/tests/Rector/Class_/AnonymousMigrationsRector/config/configured_rule.php +++ b/tests/Rector/Class_/AnonymousMigrationsRector/config/configured_rule.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\Class_\AnonymousMigrationsRector; return static function (RectorConfig $rectorConfig): void { diff --git a/tests/Rector/Class_/CashierStripeOptionsToStripeRector/CashierStripeOptionsToStripeRectorTest.php b/tests/Rector/Class_/CashierStripeOptionsToStripeRector/CashierStripeOptionsToStripeRectorTest.php index 0d1e49cf..f18262f1 100644 --- a/tests/Rector/Class_/CashierStripeOptionsToStripeRector/CashierStripeOptionsToStripeRectorTest.php +++ b/tests/Rector/Class_/CashierStripeOptionsToStripeRector/CashierStripeOptionsToStripeRectorTest.php @@ -10,15 +10,18 @@ final class CashierStripeOptionsToStripeRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/Class_/CashierStripeOptionsToStripeRector/config/configured_rule.php b/tests/Rector/Class_/CashierStripeOptionsToStripeRector/config/configured_rule.php index da745434..e0ffc488 100644 --- a/tests/Rector/Class_/CashierStripeOptionsToStripeRector/config/configured_rule.php +++ b/tests/Rector/Class_/CashierStripeOptionsToStripeRector/config/configured_rule.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\Class_\CashierStripeOptionsToStripeRector; return static function (RectorConfig $rectorConfig): void { diff --git a/tests/Rector/Class_/PropertyDeferToDeferrableProviderToRector/PropertyDeferToDeferrableProviderToRectorTest.php b/tests/Rector/Class_/PropertyDeferToDeferrableProviderToRector/PropertyDeferToDeferrableProviderToRectorTest.php index 693d37c4..e03d0eae 100644 --- a/tests/Rector/Class_/PropertyDeferToDeferrableProviderToRector/PropertyDeferToDeferrableProviderToRectorTest.php +++ b/tests/Rector/Class_/PropertyDeferToDeferrableProviderToRector/PropertyDeferToDeferrableProviderToRectorTest.php @@ -10,15 +10,18 @@ final class PropertyDeferToDeferrableProviderToRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/Class_/PropertyDeferToDeferrableProviderToRector/config/configured_rule.php b/tests/Rector/Class_/PropertyDeferToDeferrableProviderToRector/config/configured_rule.php index 468295ec..3296df6e 100644 --- a/tests/Rector/Class_/PropertyDeferToDeferrableProviderToRector/config/configured_rule.php +++ b/tests/Rector/Class_/PropertyDeferToDeferrableProviderToRector/config/configured_rule.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\Class_\PropertyDeferToDeferrableProviderToRector; return static function (RectorConfig $rectorConfig): void { diff --git a/tests/Rector/Class_/RemoveModelPropertyFromFactoriesRector/RemoveModelPropertyFromFactoriesRectorTest.php b/tests/Rector/Class_/RemoveModelPropertyFromFactoriesRector/RemoveModelPropertyFromFactoriesRectorTest.php index 8600366c..7a0986d4 100644 --- a/tests/Rector/Class_/RemoveModelPropertyFromFactoriesRector/RemoveModelPropertyFromFactoriesRectorTest.php +++ b/tests/Rector/Class_/RemoveModelPropertyFromFactoriesRector/RemoveModelPropertyFromFactoriesRectorTest.php @@ -10,15 +10,18 @@ final class RemoveModelPropertyFromFactoriesRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/Class_/RemoveModelPropertyFromFactoriesRector/config/configured_rule.php b/tests/Rector/Class_/RemoveModelPropertyFromFactoriesRector/config/configured_rule.php index d60363e2..c82e1aeb 100644 --- a/tests/Rector/Class_/RemoveModelPropertyFromFactoriesRector/config/configured_rule.php +++ b/tests/Rector/Class_/RemoveModelPropertyFromFactoriesRector/config/configured_rule.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\Class_\RemoveModelPropertyFromFactoriesRector; return static function (RectorConfig $rectorConfig): void { diff --git a/tests/Rector/Class_/UnifyModelDatesWithCastsRector/UnifyModelDatesWithCastsRectorTest.php b/tests/Rector/Class_/UnifyModelDatesWithCastsRector/UnifyModelDatesWithCastsRectorTest.php index 755607bb..b3743c30 100644 --- a/tests/Rector/Class_/UnifyModelDatesWithCastsRector/UnifyModelDatesWithCastsRectorTest.php +++ b/tests/Rector/Class_/UnifyModelDatesWithCastsRector/UnifyModelDatesWithCastsRectorTest.php @@ -10,15 +10,18 @@ final class UnifyModelDatesWithCastsRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/Class_/UnifyModelDatesWithCastsRector/config/configured_rule.php b/tests/Rector/Class_/UnifyModelDatesWithCastsRector/config/configured_rule.php index 9a3c7ca9..e5f85c39 100644 --- a/tests/Rector/Class_/UnifyModelDatesWithCastsRector/config/configured_rule.php +++ b/tests/Rector/Class_/UnifyModelDatesWithCastsRector/config/configured_rule.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\Class_\UnifyModelDatesWithCastsRector; return static function (RectorConfig $rectorConfig): void { diff --git a/tests/Rector/Empty_/EmptyToBlankAndFilledFuncRector/EmptyToBlankAndFilledFuncRectorTest.php b/tests/Rector/Empty_/EmptyToBlankAndFilledFuncRector/EmptyToBlankAndFilledFuncRectorTest.php index a6809230..5cf7943f 100644 --- a/tests/Rector/Empty_/EmptyToBlankAndFilledFuncRector/EmptyToBlankAndFilledFuncRectorTest.php +++ b/tests/Rector/Empty_/EmptyToBlankAndFilledFuncRector/EmptyToBlankAndFilledFuncRectorTest.php @@ -10,15 +10,18 @@ final class EmptyToBlankAndFilledFuncRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/Expr/AppEnvironmentComparisonToParameterRector/AppEnvironmentComparisonToParameterRectorTest.php b/tests/Rector/Expr/AppEnvironmentComparisonToParameterRector/AppEnvironmentComparisonToParameterRectorTest.php index 750700a0..09d366b3 100644 --- a/tests/Rector/Expr/AppEnvironmentComparisonToParameterRector/AppEnvironmentComparisonToParameterRectorTest.php +++ b/tests/Rector/Expr/AppEnvironmentComparisonToParameterRector/AppEnvironmentComparisonToParameterRectorTest.php @@ -10,15 +10,18 @@ final class AppEnvironmentComparisonToParameterRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/Expr/AppEnvironmentComparisonToParameterRector/config/configured_rule.php b/tests/Rector/Expr/AppEnvironmentComparisonToParameterRector/config/configured_rule.php index 3f726e26..f8cced15 100644 --- a/tests/Rector/Expr/AppEnvironmentComparisonToParameterRector/config/configured_rule.php +++ b/tests/Rector/Expr/AppEnvironmentComparisonToParameterRector/config/configured_rule.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\Expr\AppEnvironmentComparisonToParameterRector; return static function (RectorConfig $rectorConfig): void { diff --git a/tests/Rector/Expr/SubStrToStartsWithOrEndsWithStaticMethodCallRector/SubStrToStartsWithOrEndsWithStaticMethodCallRectorTest.php b/tests/Rector/Expr/SubStrToStartsWithOrEndsWithStaticMethodCallRector/SubStrToStartsWithOrEndsWithStaticMethodCallRectorTest.php index 55c39bb9..9ee4d13b 100644 --- a/tests/Rector/Expr/SubStrToStartsWithOrEndsWithStaticMethodCallRector/SubStrToStartsWithOrEndsWithStaticMethodCallRectorTest.php +++ b/tests/Rector/Expr/SubStrToStartsWithOrEndsWithStaticMethodCallRector/SubStrToStartsWithOrEndsWithStaticMethodCallRectorTest.php @@ -10,15 +10,18 @@ final class SubStrToStartsWithOrEndsWithStaticMethodCallRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/FuncCall/ArgumentFuncCallToMethodCallRector/ArgumentFuncCallToMethodCallRectorTest.php b/tests/Rector/FuncCall/ArgumentFuncCallToMethodCallRector/ArgumentFuncCallToMethodCallRectorTest.php index 09cfa6e3..5be94539 100644 --- a/tests/Rector/FuncCall/ArgumentFuncCallToMethodCallRector/ArgumentFuncCallToMethodCallRectorTest.php +++ b/tests/Rector/FuncCall/ArgumentFuncCallToMethodCallRector/ArgumentFuncCallToMethodCallRectorTest.php @@ -10,15 +10,18 @@ final class ArgumentFuncCallToMethodCallRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/FuncCall/FactoryFuncCallToStaticCallRector/FactoryFuncCallToStaticCallRectorTest.php b/tests/Rector/FuncCall/FactoryFuncCallToStaticCallRector/FactoryFuncCallToStaticCallRectorTest.php index b9a34d8a..3f0d070f 100644 --- a/tests/Rector/FuncCall/FactoryFuncCallToStaticCallRector/FactoryFuncCallToStaticCallRectorTest.php +++ b/tests/Rector/FuncCall/FactoryFuncCallToStaticCallRector/FactoryFuncCallToStaticCallRectorTest.php @@ -10,15 +10,18 @@ final class FactoryFuncCallToStaticCallRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/FuncCall/FactoryFuncCallToStaticCallRector/config/configured_rule.php b/tests/Rector/FuncCall/FactoryFuncCallToStaticCallRector/config/configured_rule.php index caaabed0..361b02b5 100644 --- a/tests/Rector/FuncCall/FactoryFuncCallToStaticCallRector/config/configured_rule.php +++ b/tests/Rector/FuncCall/FactoryFuncCallToStaticCallRector/config/configured_rule.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\FuncCall\FactoryFuncCallToStaticCallRector; return static function (RectorConfig $rectorConfig): void { diff --git a/tests/Rector/FuncCall/HelperFuncCallToFacadeClassRector/HelperFuncCallToFacadeClassRectorTest.php b/tests/Rector/FuncCall/HelperFuncCallToFacadeClassRector/HelperFuncCallToFacadeClassRectorTest.php index b5b9066e..4ea04d21 100644 --- a/tests/Rector/FuncCall/HelperFuncCallToFacadeClassRector/HelperFuncCallToFacadeClassRectorTest.php +++ b/tests/Rector/FuncCall/HelperFuncCallToFacadeClassRector/HelperFuncCallToFacadeClassRectorTest.php @@ -10,15 +10,18 @@ final class HelperFuncCallToFacadeClassRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/FuncCall/HelperFuncCallToFacadeClassRector/config/configured_rule.php b/tests/Rector/FuncCall/HelperFuncCallToFacadeClassRector/config/configured_rule.php index 9520208c..e60b8ba0 100644 --- a/tests/Rector/FuncCall/HelperFuncCallToFacadeClassRector/config/configured_rule.php +++ b/tests/Rector/FuncCall/HelperFuncCallToFacadeClassRector/config/configured_rule.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\FuncCall\HelperFuncCallToFacadeClassRector; return static function (RectorConfig $rectorConfig): void { diff --git a/tests/Rector/FuncCall/NotFilledBlankFuncCallToBlankFilledFuncCallRector/NotFilledBlankFuncCallToBlankFilledFuncCallRectorTest.php b/tests/Rector/FuncCall/NotFilledBlankFuncCallToBlankFilledFuncCallRector/NotFilledBlankFuncCallToBlankFilledFuncCallRectorTest.php index 77bc9c9e..7b65deff 100644 --- a/tests/Rector/FuncCall/NotFilledBlankFuncCallToBlankFilledFuncCallRector/NotFilledBlankFuncCallToBlankFilledFuncCallRectorTest.php +++ b/tests/Rector/FuncCall/NotFilledBlankFuncCallToBlankFilledFuncCallRector/NotFilledBlankFuncCallToBlankFilledFuncCallRectorTest.php @@ -10,15 +10,18 @@ final class NotFilledBlankFuncCallToBlankFilledFuncCallRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/FuncCall/NotFilledBlankFuncCallToBlankFilledFuncCallRector/config/configured_rule.php b/tests/Rector/FuncCall/NotFilledBlankFuncCallToBlankFilledFuncCallRector/config/configured_rule.php index 70ed29a4..ea0681bd 100644 --- a/tests/Rector/FuncCall/NotFilledBlankFuncCallToBlankFilledFuncCallRector/config/configured_rule.php +++ b/tests/Rector/FuncCall/NotFilledBlankFuncCallToBlankFilledFuncCallRector/config/configured_rule.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\FuncCall\NotFilledBlankFuncCallToBlankFilledFuncCallRector; return static function (RectorConfig $rectorConfig): void { diff --git a/tests/Rector/FuncCall/NowFuncWithStartOfDayMethodCallToTodayFuncRector/NowFuncWithStartOfDayMethodCallToTodayFuncRectorTest.php b/tests/Rector/FuncCall/NowFuncWithStartOfDayMethodCallToTodayFuncRector/NowFuncWithStartOfDayMethodCallToTodayFuncRectorTest.php index 93962897..b7d0e8f7 100644 --- a/tests/Rector/FuncCall/NowFuncWithStartOfDayMethodCallToTodayFuncRector/NowFuncWithStartOfDayMethodCallToTodayFuncRectorTest.php +++ b/tests/Rector/FuncCall/NowFuncWithStartOfDayMethodCallToTodayFuncRector/NowFuncWithStartOfDayMethodCallToTodayFuncRectorTest.php @@ -10,15 +10,18 @@ final class NowFuncWithStartOfDayMethodCallToTodayFuncRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/FuncCall/NowFuncWithStartOfDayMethodCallToTodayFuncRector/config/configured_rule.php b/tests/Rector/FuncCall/NowFuncWithStartOfDayMethodCallToTodayFuncRector/config/configured_rule.php index b6dd6e5e..f0704817 100644 --- a/tests/Rector/FuncCall/NowFuncWithStartOfDayMethodCallToTodayFuncRector/config/configured_rule.php +++ b/tests/Rector/FuncCall/NowFuncWithStartOfDayMethodCallToTodayFuncRector/config/configured_rule.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\FuncCall\NowFuncWithStartOfDayMethodCallToTodayFuncRector; return static function (RectorConfig $rectorConfig): void { diff --git a/tests/Rector/FuncCall/RemoveDumpDataDeadCodeRector/RemoveDumpDataDeadCodeRectorTest.php b/tests/Rector/FuncCall/RemoveDumpDataDeadCodeRector/RemoveDumpDataDeadCodeRectorTest.php index 4dcc4d41..bb03daa6 100644 --- a/tests/Rector/FuncCall/RemoveDumpDataDeadCodeRector/RemoveDumpDataDeadCodeRectorTest.php +++ b/tests/Rector/FuncCall/RemoveDumpDataDeadCodeRector/RemoveDumpDataDeadCodeRectorTest.php @@ -10,15 +10,18 @@ final class RemoveDumpDataDeadCodeRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/FuncCall/RemoveDumpDataDeadCodeRector/config/configured_rule.php b/tests/Rector/FuncCall/RemoveDumpDataDeadCodeRector/config/configured_rule.php index bb9b9708..444b262c 100644 --- a/tests/Rector/FuncCall/RemoveDumpDataDeadCodeRector/config/configured_rule.php +++ b/tests/Rector/FuncCall/RemoveDumpDataDeadCodeRector/config/configured_rule.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\FuncCall\RemoveDumpDataDeadCodeRector; return static function (RectorConfig $rectorConfig): void { diff --git a/tests/Rector/FuncCall/SleepFuncToSleepStaticCallRector/SleepFuncToSleepStaticCallRectorTest.php b/tests/Rector/FuncCall/SleepFuncToSleepStaticCallRector/SleepFuncToSleepStaticCallRectorTest.php index c0850ac5..232a8bd1 100644 --- a/tests/Rector/FuncCall/SleepFuncToSleepStaticCallRector/SleepFuncToSleepStaticCallRectorTest.php +++ b/tests/Rector/FuncCall/SleepFuncToSleepStaticCallRector/SleepFuncToSleepStaticCallRectorTest.php @@ -10,15 +10,18 @@ final class SleepFuncToSleepStaticCallRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/FuncCall/SleepFuncToSleepStaticCallRector/config/configured_rule.php b/tests/Rector/FuncCall/SleepFuncToSleepStaticCallRector/config/configured_rule.php index 3d4ca175..11ed7060 100644 --- a/tests/Rector/FuncCall/SleepFuncToSleepStaticCallRector/config/configured_rule.php +++ b/tests/Rector/FuncCall/SleepFuncToSleepStaticCallRector/config/configured_rule.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\FuncCall\SleepFuncToSleepStaticCallRector; return static function (RectorConfig $rectorConfig): void { diff --git a/tests/Rector/If_/ThrowIfRector/ThrowIfRectorTest.php b/tests/Rector/If_/ThrowIfRector/ThrowIfRectorTest.php index 55c51e66..13ed5a3b 100644 --- a/tests/Rector/If_/ThrowIfRector/ThrowIfRectorTest.php +++ b/tests/Rector/If_/ThrowIfRector/ThrowIfRectorTest.php @@ -10,15 +10,18 @@ final class ThrowIfRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/If_/ThrowIfRector/config/configured_rule.php b/tests/Rector/If_/ThrowIfRector/config/configured_rule.php index 0a4d20d0..9af9c6a8 100644 --- a/tests/Rector/If_/ThrowIfRector/config/configured_rule.php +++ b/tests/Rector/If_/ThrowIfRector/config/configured_rule.php @@ -1,11 +1,11 @@ import(__DIR__ . '/../../../../../config/config.php'); - $rectorConfig->rule(\RectorLaravel\Rector\If_\ThrowIfRector::class); + $rectorConfig->rule(ThrowIfRector::class); }; diff --git a/tests/Rector/MethodCall/AssertStatusToAssertMethodRector/AssertStatusToAssertMethodTest.php b/tests/Rector/MethodCall/AssertStatusToAssertMethodRector/AssertStatusToAssertMethodTest.php index dcfb2847..9f4dbd7b 100644 --- a/tests/Rector/MethodCall/AssertStatusToAssertMethodRector/AssertStatusToAssertMethodTest.php +++ b/tests/Rector/MethodCall/AssertStatusToAssertMethodRector/AssertStatusToAssertMethodTest.php @@ -10,15 +10,18 @@ final class AssertStatusToAssertMethodTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/MethodCall/AssertStatusToAssertMethodRector/config/configured_rule.php b/tests/Rector/MethodCall/AssertStatusToAssertMethodRector/config/configured_rule.php index d11e231c..56d05b42 100644 --- a/tests/Rector/MethodCall/AssertStatusToAssertMethodRector/config/configured_rule.php +++ b/tests/Rector/MethodCall/AssertStatusToAssertMethodRector/config/configured_rule.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\MethodCall\AssertStatusToAssertMethodRector; return static function (RectorConfig $rectorConfig): void { diff --git a/tests/Rector/MethodCall/ChangeQueryWhereDateValueWithCarbonRector/ChangeQueryWhereDateValueWithCarbonRectorTest.php b/tests/Rector/MethodCall/ChangeQueryWhereDateValueWithCarbonRector/ChangeQueryWhereDateValueWithCarbonRectorTest.php index b0cbafed..a6aa5418 100644 --- a/tests/Rector/MethodCall/ChangeQueryWhereDateValueWithCarbonRector/ChangeQueryWhereDateValueWithCarbonRectorTest.php +++ b/tests/Rector/MethodCall/ChangeQueryWhereDateValueWithCarbonRector/ChangeQueryWhereDateValueWithCarbonRectorTest.php @@ -10,15 +10,18 @@ final class ChangeQueryWhereDateValueWithCarbonRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/MethodCall/ChangeQueryWhereDateValueWithCarbonRector/config/configured_rule.php b/tests/Rector/MethodCall/ChangeQueryWhereDateValueWithCarbonRector/config/configured_rule.php index 03a73ca3..a854d482 100644 --- a/tests/Rector/MethodCall/ChangeQueryWhereDateValueWithCarbonRector/config/configured_rule.php +++ b/tests/Rector/MethodCall/ChangeQueryWhereDateValueWithCarbonRector/config/configured_rule.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\MethodCall\ChangeQueryWhereDateValueWithCarbonRector; return static function (RectorConfig $rectorConfig): void { diff --git a/tests/Rector/MethodCall/DatabaseExpressionToStringToMethodCallRector/DatabaseExpressionToStringToMethodCallRectorTest.php b/tests/Rector/MethodCall/DatabaseExpressionToStringToMethodCallRector/DatabaseExpressionToStringToMethodCallRectorTest.php index d17dbf1e..04e28e03 100644 --- a/tests/Rector/MethodCall/DatabaseExpressionToStringToMethodCallRector/DatabaseExpressionToStringToMethodCallRectorTest.php +++ b/tests/Rector/MethodCall/DatabaseExpressionToStringToMethodCallRector/DatabaseExpressionToStringToMethodCallRectorTest.php @@ -10,15 +10,18 @@ final class DatabaseExpressionToStringToMethodCallRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/MethodCall/EloquentOrderByToLatestOrOldestRector/EloquentOrderByToLatestOrOldestRectorTest.php b/tests/Rector/MethodCall/EloquentOrderByToLatestOrOldestRector/EloquentOrderByToLatestOrOldestRectorTest.php index 55916ee9..f0866e2b 100644 --- a/tests/Rector/MethodCall/EloquentOrderByToLatestOrOldestRector/EloquentOrderByToLatestOrOldestRectorTest.php +++ b/tests/Rector/MethodCall/EloquentOrderByToLatestOrOldestRector/EloquentOrderByToLatestOrOldestRectorTest.php @@ -10,15 +10,18 @@ final class EloquentOrderByToLatestOrOldestRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/MethodCall/EloquentWhereRelationTypeHintingParameterRector/EloquentWhereRelationTypeHintingParameterRectorTest.php b/tests/Rector/MethodCall/EloquentWhereRelationTypeHintingParameterRector/EloquentWhereRelationTypeHintingParameterRectorTest.php index e2e85038..bb305bac 100644 --- a/tests/Rector/MethodCall/EloquentWhereRelationTypeHintingParameterRector/EloquentWhereRelationTypeHintingParameterRectorTest.php +++ b/tests/Rector/MethodCall/EloquentWhereRelationTypeHintingParameterRector/EloquentWhereRelationTypeHintingParameterRectorTest.php @@ -10,15 +10,18 @@ final class EloquentWhereRelationTypeHintingParameterRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/MethodCall/EloquentWhereTypeHintClosureParameterRector/EloquentWhereTypeHintClosureParameterRectorTest.php b/tests/Rector/MethodCall/EloquentWhereTypeHintClosureParameterRector/EloquentWhereTypeHintClosureParameterRectorTest.php index d7ffb1a2..62954145 100644 --- a/tests/Rector/MethodCall/EloquentWhereTypeHintClosureParameterRector/EloquentWhereTypeHintClosureParameterRectorTest.php +++ b/tests/Rector/MethodCall/EloquentWhereTypeHintClosureParameterRector/EloquentWhereTypeHintClosureParameterRectorTest.php @@ -10,15 +10,18 @@ final class EloquentWhereTypeHintClosureParameterRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/MethodCall/EloquentWhereTypeHintClosureParameterRector/config/configured_rule.php b/tests/Rector/MethodCall/EloquentWhereTypeHintClosureParameterRector/config/configured_rule.php index a78b053a..80ece6f6 100644 --- a/tests/Rector/MethodCall/EloquentWhereTypeHintClosureParameterRector/config/configured_rule.php +++ b/tests/Rector/MethodCall/EloquentWhereTypeHintClosureParameterRector/config/configured_rule.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\MethodCall\EloquentWhereTypeHintClosureParameterRector; return static function (RectorConfig $rectorConfig): void { diff --git a/tests/Rector/MethodCall/FactoryApplyingStatesRector/FactoryApplyingStatesRectorTest.php b/tests/Rector/MethodCall/FactoryApplyingStatesRector/FactoryApplyingStatesRectorTest.php index 4c415894..05605231 100644 --- a/tests/Rector/MethodCall/FactoryApplyingStatesRector/FactoryApplyingStatesRectorTest.php +++ b/tests/Rector/MethodCall/FactoryApplyingStatesRector/FactoryApplyingStatesRectorTest.php @@ -10,15 +10,18 @@ final class FactoryApplyingStatesRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/MethodCall/FactoryApplyingStatesRector/config/configured_rule.php b/tests/Rector/MethodCall/FactoryApplyingStatesRector/config/configured_rule.php index c81f6292..4469bee8 100644 --- a/tests/Rector/MethodCall/FactoryApplyingStatesRector/config/configured_rule.php +++ b/tests/Rector/MethodCall/FactoryApplyingStatesRector/config/configured_rule.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\MethodCall\FactoryApplyingStatesRector; return static function (RectorConfig $rectorConfig): void { diff --git a/tests/Rector/MethodCall/LumenRoutesStringActionToUsesArrayRector/LumenRoutesStringActionToUsesArrayRectorTest.php b/tests/Rector/MethodCall/LumenRoutesStringActionToUsesArrayRector/LumenRoutesStringActionToUsesArrayRectorTest.php index c96a4337..8fc1d696 100644 --- a/tests/Rector/MethodCall/LumenRoutesStringActionToUsesArrayRector/LumenRoutesStringActionToUsesArrayRectorTest.php +++ b/tests/Rector/MethodCall/LumenRoutesStringActionToUsesArrayRector/LumenRoutesStringActionToUsesArrayRectorTest.php @@ -10,15 +10,18 @@ final class LumenRoutesStringActionToUsesArrayRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/MethodCall/LumenRoutesStringMiddlewareToArrayRector/LumenRoutesStringMiddlewareToArrayRectorTest.php b/tests/Rector/MethodCall/LumenRoutesStringMiddlewareToArrayRector/LumenRoutesStringMiddlewareToArrayRectorTest.php index 28849523..d70b19af 100644 --- a/tests/Rector/MethodCall/LumenRoutesStringMiddlewareToArrayRector/LumenRoutesStringMiddlewareToArrayRectorTest.php +++ b/tests/Rector/MethodCall/LumenRoutesStringMiddlewareToArrayRector/LumenRoutesStringMiddlewareToArrayRectorTest.php @@ -10,15 +10,18 @@ final class LumenRoutesStringMiddlewareToArrayRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/MethodCall/RedirectBackToBackHelperRector/RedirectBackToBackHelperRectorTest.php b/tests/Rector/MethodCall/RedirectBackToBackHelperRector/RedirectBackToBackHelperRectorTest.php index ea6b819e..1e634d7d 100644 --- a/tests/Rector/MethodCall/RedirectBackToBackHelperRector/RedirectBackToBackHelperRectorTest.php +++ b/tests/Rector/MethodCall/RedirectBackToBackHelperRector/RedirectBackToBackHelperRectorTest.php @@ -10,15 +10,18 @@ final class RedirectBackToBackHelperRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/MethodCall/RedirectBackToBackHelperRector/config/configured_rule.php b/tests/Rector/MethodCall/RedirectBackToBackHelperRector/config/configured_rule.php index d1285ae5..430e2a7e 100644 --- a/tests/Rector/MethodCall/RedirectBackToBackHelperRector/config/configured_rule.php +++ b/tests/Rector/MethodCall/RedirectBackToBackHelperRector/config/configured_rule.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\MethodCall\RedirectBackToBackHelperRector; return static function (RectorConfig $rectorConfig): void { diff --git a/tests/Rector/MethodCall/RedirectRouteToToRouteHelperRector/RedirectRouteToToRouteHelperRectorTest.php b/tests/Rector/MethodCall/RedirectRouteToToRouteHelperRector/RedirectRouteToToRouteHelperRectorTest.php index c6733ee7..07273943 100644 --- a/tests/Rector/MethodCall/RedirectRouteToToRouteHelperRector/RedirectRouteToToRouteHelperRectorTest.php +++ b/tests/Rector/MethodCall/RedirectRouteToToRouteHelperRector/RedirectRouteToToRouteHelperRectorTest.php @@ -10,15 +10,18 @@ final class RedirectRouteToToRouteHelperRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/MethodCall/RedirectRouteToToRouteHelperRector/config/configured_rule.php b/tests/Rector/MethodCall/RedirectRouteToToRouteHelperRector/config/configured_rule.php index 066c7e0b..4a234f4e 100644 --- a/tests/Rector/MethodCall/RedirectRouteToToRouteHelperRector/config/configured_rule.php +++ b/tests/Rector/MethodCall/RedirectRouteToToRouteHelperRector/config/configured_rule.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\MethodCall\RedirectRouteToToRouteHelperRector; return static function (RectorConfig $rectorConfig): void { diff --git a/tests/Rector/MethodCall/UseComponentPropertyWithinCommandsRector/UseComponentPropertyWithinCommandsRectorTest.php b/tests/Rector/MethodCall/UseComponentPropertyWithinCommandsRector/UseComponentPropertyWithinCommandsRectorTest.php index 39d6fb58..958de18c 100644 --- a/tests/Rector/MethodCall/UseComponentPropertyWithinCommandsRector/UseComponentPropertyWithinCommandsRectorTest.php +++ b/tests/Rector/MethodCall/UseComponentPropertyWithinCommandsRector/UseComponentPropertyWithinCommandsRectorTest.php @@ -10,15 +10,18 @@ final class UseComponentPropertyWithinCommandsRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/MethodCall/UseComponentPropertyWithinCommandsRector/config/configured_rule.php b/tests/Rector/MethodCall/UseComponentPropertyWithinCommandsRector/config/configured_rule.php index 08a1a4ee..c7ae9c6f 100644 --- a/tests/Rector/MethodCall/UseComponentPropertyWithinCommandsRector/config/configured_rule.php +++ b/tests/Rector/MethodCall/UseComponentPropertyWithinCommandsRector/config/configured_rule.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\MethodCall\UseComponentPropertyWithinCommandsRector; return static function (RectorConfig $rectorConfig): void { diff --git a/tests/Rector/Namespace_/FactoryDefinitionRector/FactoryDefinitionRectorTest.php b/tests/Rector/Namespace_/FactoryDefinitionRector/FactoryDefinitionRectorTest.php index 3493b4c5..8cd41bfe 100644 --- a/tests/Rector/Namespace_/FactoryDefinitionRector/FactoryDefinitionRectorTest.php +++ b/tests/Rector/Namespace_/FactoryDefinitionRector/FactoryDefinitionRectorTest.php @@ -10,15 +10,18 @@ final class FactoryDefinitionRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/Namespace_/FactoryDefinitionRector/Source/Model.php b/tests/Rector/Namespace_/FactoryDefinitionRector/Source/Model.php index f116d54e..b90ad074 100644 --- a/tests/Rector/Namespace_/FactoryDefinitionRector/Source/Model.php +++ b/tests/Rector/Namespace_/FactoryDefinitionRector/Source/Model.php @@ -4,5 +4,4 @@ class Model { - } diff --git a/tests/Rector/Namespace_/FactoryDefinitionRector/config/configured_rule.php b/tests/Rector/Namespace_/FactoryDefinitionRector/config/configured_rule.php index 24f79964..392273d0 100644 --- a/tests/Rector/Namespace_/FactoryDefinitionRector/config/configured_rule.php +++ b/tests/Rector/Namespace_/FactoryDefinitionRector/config/configured_rule.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\Namespace_\FactoryDefinitionRector; return static function (RectorConfig $rectorConfig): void { diff --git a/tests/Rector/New_/AddGuardToLoginEventRector/AddGuardToLoginEventRectorTest.php b/tests/Rector/New_/AddGuardToLoginEventRector/AddGuardToLoginEventRectorTest.php index d141bc38..f497d7e6 100644 --- a/tests/Rector/New_/AddGuardToLoginEventRector/AddGuardToLoginEventRectorTest.php +++ b/tests/Rector/New_/AddGuardToLoginEventRector/AddGuardToLoginEventRectorTest.php @@ -10,15 +10,18 @@ final class AddGuardToLoginEventRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/New_/AddGuardToLoginEventRector/config/configured_rule.php b/tests/Rector/New_/AddGuardToLoginEventRector/config/configured_rule.php index 67547bf3..e3ab7c6b 100644 --- a/tests/Rector/New_/AddGuardToLoginEventRector/config/configured_rule.php +++ b/tests/Rector/New_/AddGuardToLoginEventRector/config/configured_rule.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\New_\AddGuardToLoginEventRector; return static function (RectorConfig $rectorConfig): void { diff --git a/tests/Rector/PropertyFetch/OptionalToNullsafeOperatorRector/OptionalToNullsafeOperatorRectorTest.php b/tests/Rector/PropertyFetch/OptionalToNullsafeOperatorRector/OptionalToNullsafeOperatorRectorTest.php index 6fa85b1c..c2be02b6 100644 --- a/tests/Rector/PropertyFetch/OptionalToNullsafeOperatorRector/OptionalToNullsafeOperatorRectorTest.php +++ b/tests/Rector/PropertyFetch/OptionalToNullsafeOperatorRector/OptionalToNullsafeOperatorRectorTest.php @@ -10,15 +10,18 @@ final class OptionalToNullsafeOperatorRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/PropertyFetch/OptionalToNullsafeOperatorRector/config/configured_rule.php b/tests/Rector/PropertyFetch/OptionalToNullsafeOperatorRector/config/configured_rule.php index 6425760a..7cef31a9 100644 --- a/tests/Rector/PropertyFetch/OptionalToNullsafeOperatorRector/config/configured_rule.php +++ b/tests/Rector/PropertyFetch/OptionalToNullsafeOperatorRector/config/configured_rule.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\PropertyFetch\OptionalToNullsafeOperatorRector; return static function (RectorConfig $rectorConfig): void { diff --git a/tests/Rector/PropertyFetch/ReplaceFakerInstanceWithHelperRector/ReplaceFakerInstanceWithHelperRectorTest.php b/tests/Rector/PropertyFetch/ReplaceFakerInstanceWithHelperRector/ReplaceFakerInstanceWithHelperRectorTest.php index d3cfa4c6..99e469d2 100644 --- a/tests/Rector/PropertyFetch/ReplaceFakerInstanceWithHelperRector/ReplaceFakerInstanceWithHelperRectorTest.php +++ b/tests/Rector/PropertyFetch/ReplaceFakerInstanceWithHelperRector/ReplaceFakerInstanceWithHelperRectorTest.php @@ -10,15 +10,18 @@ final class ReplaceFakerInstanceWithHelperRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/StaticCall/EloquentMagicMethodToQueryBuilderRector/EloquentMagicMethodToQueryBuilderRectorTest.php b/tests/Rector/StaticCall/EloquentMagicMethodToQueryBuilderRector/EloquentMagicMethodToQueryBuilderRectorTest.php index c86bd56e..fefff2d2 100644 --- a/tests/Rector/StaticCall/EloquentMagicMethodToQueryBuilderRector/EloquentMagicMethodToQueryBuilderRectorTest.php +++ b/tests/Rector/StaticCall/EloquentMagicMethodToQueryBuilderRector/EloquentMagicMethodToQueryBuilderRectorTest.php @@ -15,15 +15,18 @@ final class User extends Model final class EloquentMagicMethodToQueryBuilderRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/StaticCall/EloquentMagicMethodToQueryBuilderRector/config/configured_rule.php b/tests/Rector/StaticCall/EloquentMagicMethodToQueryBuilderRector/config/configured_rule.php index 6841bc57..e9397515 100644 --- a/tests/Rector/StaticCall/EloquentMagicMethodToQueryBuilderRector/config/configured_rule.php +++ b/tests/Rector/StaticCall/EloquentMagicMethodToQueryBuilderRector/config/configured_rule.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\StaticCall\EloquentMagicMethodToQueryBuilderRector; return static function (RectorConfig $rectorConfig): void { diff --git a/tests/Rector/StaticCall/MinutesToSecondsInCacheRector/MinutesToSecondsInCacheRectorTest.php b/tests/Rector/StaticCall/MinutesToSecondsInCacheRector/MinutesToSecondsInCacheRectorTest.php index e83bc80e..cf166c0f 100644 --- a/tests/Rector/StaticCall/MinutesToSecondsInCacheRector/MinutesToSecondsInCacheRectorTest.php +++ b/tests/Rector/StaticCall/MinutesToSecondsInCacheRector/MinutesToSecondsInCacheRectorTest.php @@ -10,15 +10,18 @@ final class MinutesToSecondsInCacheRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/StaticCall/MinutesToSecondsInCacheRector/config/configured_rule.php b/tests/Rector/StaticCall/MinutesToSecondsInCacheRector/config/configured_rule.php index eebd204f..62824e79 100644 --- a/tests/Rector/StaticCall/MinutesToSecondsInCacheRector/config/configured_rule.php +++ b/tests/Rector/StaticCall/MinutesToSecondsInCacheRector/config/configured_rule.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\StaticCall\MinutesToSecondsInCacheRector; return static function (RectorConfig $rectorConfig): void { diff --git a/tests/Rector/StaticCall/Redirect301ToPermanentRedirectRector/Redirect301ToPermanentRedirectRectorTest.php b/tests/Rector/StaticCall/Redirect301ToPermanentRedirectRector/Redirect301ToPermanentRedirectRectorTest.php index 32749158..02c6d668 100644 --- a/tests/Rector/StaticCall/Redirect301ToPermanentRedirectRector/Redirect301ToPermanentRedirectRectorTest.php +++ b/tests/Rector/StaticCall/Redirect301ToPermanentRedirectRector/Redirect301ToPermanentRedirectRectorTest.php @@ -10,15 +10,18 @@ final class Redirect301ToPermanentRedirectRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/StaticCall/Redirect301ToPermanentRedirectRector/config/configured_rule.php b/tests/Rector/StaticCall/Redirect301ToPermanentRedirectRector/config/configured_rule.php index f5e23de7..e582903f 100644 --- a/tests/Rector/StaticCall/Redirect301ToPermanentRedirectRector/config/configured_rule.php +++ b/tests/Rector/StaticCall/Redirect301ToPermanentRedirectRector/config/configured_rule.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\StaticCall\Redirect301ToPermanentRedirectRector; return static function (RectorConfig $rectorConfig): void { diff --git a/tests/Rector/StaticCall/RequestStaticValidateToInjectRector/RequestStaticValidateToInjectRectorTest.php b/tests/Rector/StaticCall/RequestStaticValidateToInjectRector/RequestStaticValidateToInjectRectorTest.php index e92cd834..130a5fb2 100644 --- a/tests/Rector/StaticCall/RequestStaticValidateToInjectRector/RequestStaticValidateToInjectRectorTest.php +++ b/tests/Rector/StaticCall/RequestStaticValidateToInjectRector/RequestStaticValidateToInjectRectorTest.php @@ -10,15 +10,18 @@ final class RequestStaticValidateToInjectRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/StaticCall/RequestStaticValidateToInjectRector/config/configured_rule.php b/tests/Rector/StaticCall/RequestStaticValidateToInjectRector/config/configured_rule.php index a34e62d7..3254b8e2 100644 --- a/tests/Rector/StaticCall/RequestStaticValidateToInjectRector/config/configured_rule.php +++ b/tests/Rector/StaticCall/RequestStaticValidateToInjectRector/config/configured_rule.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\StaticCall\RequestStaticValidateToInjectRector; return static function (RectorConfig $rectorConfig): void { diff --git a/tests/Rector/StaticCall/RouteActionCallableRector/RouteActionCallableRectorTest.php b/tests/Rector/StaticCall/RouteActionCallableRector/RouteActionCallableRectorTest.php index e40245e1..fbdd73f8 100644 --- a/tests/Rector/StaticCall/RouteActionCallableRector/RouteActionCallableRectorTest.php +++ b/tests/Rector/StaticCall/RouteActionCallableRector/RouteActionCallableRectorTest.php @@ -10,15 +10,18 @@ final class RouteActionCallableRectorTest extends AbstractRectorTestCase { - #[DataProvider('provideData')] - public function test(string $filePath): void + public static function provideData(): Iterator { - $this->doTestFile($filePath); + return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); } - public static function provideData(): Iterator + /** + * @test + */ + #[DataProvider('provideData')] + public function test(string $filePath): void { - return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); + $this->doTestFile($filePath); } public function provideConfigFilePath(): string diff --git a/tests/Rector/StaticCall/RouteActionCallableRector/config/configured_rule.php b/tests/Rector/StaticCall/RouteActionCallableRector/config/configured_rule.php index b5a2967c..f8b613e8 100644 --- a/tests/Rector/StaticCall/RouteActionCallableRector/config/configured_rule.php +++ b/tests/Rector/StaticCall/RouteActionCallableRector/config/configured_rule.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; - use RectorLaravel\Rector\StaticCall\RouteActionCallableRector; return static function (RectorConfig $rectorConfig): void {