From e76c20acaf3c26cc1200519d213994563736b912 Mon Sep 17 00:00:00 2001 From: Anthony Clark Date: Mon, 17 Apr 2023 10:16:55 -0700 Subject: [PATCH 01/12] Drop `tformat.json` config, use single `tlint.json` --- readme.md | 14 +------------- src/Commands/FormatCommand.php | 2 +- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/readme.md b/readme.md index ce662f5..fe35959 100644 --- a/readme.md +++ b/readme.md @@ -171,19 +171,7 @@ Then your config could look like: } ``` -This lets you define whatever custom linting functionality, or modify the existing linters to your liking. - -## Formatting Configuration (Beta) - -Similar to linting there are two "preset" styles for formatting: Laravel & Tighten. - -The default configuration is "tighten", but you may change this by adding a `tformat.json` file to your project's root directory with the following schema: - -```json -{ - "preset": "laravel" -} -``` +This lets you define custom linting/formatting functionality, or modify the existing linters/formatters to your liking. ## Editor Integrations diff --git a/src/Commands/FormatCommand.php b/src/Commands/FormatCommand.php index 10039af..1155e3b 100644 --- a/src/Commands/FormatCommand.php +++ b/src/Commands/FormatCommand.php @@ -142,7 +142,7 @@ private function formatFile(InputInterface $input, OutputInterface $output, $fil private function getFormatters($path) { - $configPath = getcwd() . '/tformat.json'; + $configPath = getcwd() . '/tlint.json'; $config = new Config(json_decode(is_file($configPath) ? file_get_contents($configPath) : '', true) ?? null); return array_filter($config->getFormatters(), function ($className) use ($path) { From f9c4454031ef3a47fa608e69ded5a9118e857d58 Mon Sep 17 00:00:00 2001 From: Anthony Clark Date: Thu, 11 May 2023 16:36:13 -0700 Subject: [PATCH 02/12] Drop some excluded paths --- src/Commands/BaseCommand.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/Commands/BaseCommand.php b/src/Commands/BaseCommand.php index 20294ce..4a99ef2 100644 --- a/src/Commands/BaseCommand.php +++ b/src/Commands/BaseCommand.php @@ -100,13 +100,6 @@ protected function isBlacklisted($filepath) return strpos($filepath, 'vendor') !== false || strpos($filepath, 'node_modules') !== false - || strpos($filepath, "public{$DS}") !== false - || strpos($filepath, "bootstrap{$DS}") !== false - || strpos($filepath, 'server.php') !== false - || strpos($filepath, "app{$DS}Http{$DS}Middleware{$DS}RedirectIfAuthenticated.php") !== false - || strpos($filepath, "app{$DS}Exceptions{$DS}Handler.php") !== false - || strpos($filepath, "app{$DS}Http{$DS}Controllers{$DS}Auth") !== false - || strpos($filepath, "app{$DS}Http{$DS}Kernel.php") !== false || strpos($filepath, "storage{$DS}framework{$DS}views") !== false || $this->isExcluded($filepath); } From 868018cb58cba02ac9b385ea593d04013ce5ddc9 Mon Sep 17 00:00:00 2001 From: Anthony Clark Date: Thu, 11 May 2023 16:56:29 -0700 Subject: [PATCH 03/12] Fix tests --- .github/workflows/run-duster.yml | 2 +- src/Presets/LaravelPreset.php | 3 --- tests/Linting/LaravelPresetPassesForFreshInstallTest.php | 2 ++ 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/run-duster.yml b/.github/workflows/run-duster.yml index 597405f..7b70e74 100644 --- a/.github/workflows/run-duster.yml +++ b/.github/workflows/run-duster.yml @@ -9,6 +9,6 @@ jobs: duster: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - name: "Duster" uses: tighten/duster-action@v1 diff --git a/src/Presets/LaravelPreset.php b/src/Presets/LaravelPreset.php index 4862ebd..b8608ec 100644 --- a/src/Presets/LaravelPreset.php +++ b/src/Presets/LaravelPreset.php @@ -18,13 +18,11 @@ public function getLinters(): array Linters\NoLeadingSlashesOnRoutePaths::class, Linters\NoSpaceAfterBladeDirectives::class, Linters\OneLineBetweenClassVisibilityChanges::class, - Linters\QualifiedNamesOnlyForClassName::class, Linters\RemoveLeadingSlashNamespaces::class, Linters\RequestHelperFunctionWherePossible::class, Linters\RequestValidation::class, Linters\SpaceAfterBladeDirectives::class, Linters\SpacesAroundBladeRenderContent::class, - Linters\UseAuthHelperOverFacade::class, ]; } @@ -43,7 +41,6 @@ public function getFormatters(): array Formatters\RequestValidation::class, Formatters\SpaceAfterBladeDirectives::class, Formatters\SpacesAroundBladeRenderContent::class, - Formatters\UseAuthHelperOverFacade::class, ]; } } diff --git a/tests/Linting/LaravelPresetPassesForFreshInstallTest.php b/tests/Linting/LaravelPresetPassesForFreshInstallTest.php index 1ffc8b8..6c4edcf 100644 --- a/tests/Linting/LaravelPresetPassesForFreshInstallTest.php +++ b/tests/Linting/LaravelPresetPassesForFreshInstallTest.php @@ -22,6 +22,8 @@ public function no_lints_when_using_laravel_preset() 'file or directory' => '.', ]); + dd($commandTester->getDisplay()); + $this->assertEquals(0, $commandTester->getStatusCode()); } } From 8bcf322b9f1abd02ee13d48cac7771b7c8072316 Mon Sep 17 00:00:00 2001 From: Anthony Clark Date: Thu, 11 May 2023 16:58:53 -0700 Subject: [PATCH 04/12] Remove debugging --- tests/Linting/LaravelPresetPassesForFreshInstallTest.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/Linting/LaravelPresetPassesForFreshInstallTest.php b/tests/Linting/LaravelPresetPassesForFreshInstallTest.php index 6c4edcf..1ffc8b8 100644 --- a/tests/Linting/LaravelPresetPassesForFreshInstallTest.php +++ b/tests/Linting/LaravelPresetPassesForFreshInstallTest.php @@ -22,8 +22,6 @@ public function no_lints_when_using_laravel_preset() 'file or directory' => '.', ]); - dd($commandTester->getDisplay()); - $this->assertEquals(0, $commandTester->getStatusCode()); } } From a0d5c25f5a8b8ac32b43f1984aed38f9cdc7b872 Mon Sep 17 00:00:00 2001 From: Anthony Clark Date: Thu, 11 May 2023 17:01:15 -0700 Subject: [PATCH 05/12] Update duster gh action --- .github/workflows/run-duster.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run-duster.yml b/.github/workflows/run-duster.yml index 7b70e74..4a5c912 100644 --- a/.github/workflows/run-duster.yml +++ b/.github/workflows/run-duster.yml @@ -10,5 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: "Duster" + - name: "duster" uses: tighten/duster-action@v1 + with: + args: lint From 60e2bc74c766336d25c9f5ff790218d38c5a2359 Mon Sep 17 00:00:00 2001 From: Anthony Clark Date: Mon, 22 May 2023 08:50:02 -0700 Subject: [PATCH 06/12] Update dependencies, drop PHP 8.0 --- .github/workflows/run-duster.yml | 13 ++++++++----- .github/workflows/run-tests.yml | 9 +-------- bin/tlint | 2 +- composer.json | 18 +++++++++--------- 4 files changed, 19 insertions(+), 23 deletions(-) diff --git a/.github/workflows/run-duster.yml b/.github/workflows/run-duster.yml index 597405f..7d0df1b 100644 --- a/.github/workflows/run-duster.yml +++ b/.github/workflows/run-duster.yml @@ -1,14 +1,17 @@ name: Run Duster on: - push: - branches: [ main ] - pull_request: + push: + branches: main + pull_request: jobs: duster: runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - name: "Duster" - uses: tighten/duster-action@v1 + uses: tighten/duster-action@v2 + with: + args: lint diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 1012b90..01da46c 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -12,13 +12,7 @@ jobs: strategy: matrix: os: [ubuntu, macos, windows] - php: ["8.0", "8.1", "8.2"] - symfony: - [ - [4, "^4.4.30", "^4.4.20"], - [5, "^5.3.7", "^5.0.9"], - [6, "^6.0", "^6.0"], - ] + php: ["8.1", "8.2"] dependencies: [lowest, stable] steps: - uses: actions/checkout@v2 @@ -33,7 +27,6 @@ jobs: with: php-version: ${{ matrix.php }} - run: | - composer require symfony/console:${{ matrix.symfony[1] }} symfony/process:${{ matrix.symfony[2] }} --no-update --no-interaction composer update --prefer-${{ matrix.dependencies }} --prefer-dist --no-interaction composer require illuminate/view:* --with-all-dependencies --no-interaction - run: vendor/bin/phpunit diff --git a/bin/tlint b/bin/tlint index 88f1e02..bd8bc16 100755 --- a/bin/tlint +++ b/bin/tlint @@ -1,7 +1,7 @@ #!/usr/bin/env php =8.0", + "php": ">=8.1", "illuminate/view": "*", "nikic/php-parser": "^4.15", - "symfony/console": "^4.4.30 || ^5.3.7 || ^6.0", - "symfony/process": "^4.4.20 || ^5.0.9 || ^6.0" + "symfony/console": "^6.1", + "symfony/process": "^6.1" }, "require-dev": { - "phpunit/phpunit": "^9.0", - "spatie/ray": "^1.36", - "symfony/var-dumper": "^5.0", - "tightenco/duster": "^1.0" + "phpunit/phpunit": "^9.6", + "spatie/ray": "^1.37", + "symfony/var-dumper": "^6.1", + "tightenco/duster": "^2.0" }, "autoload": { "psr-4": { @@ -47,10 +47,10 @@ "rm -rf ./tests/fixtures/laravel/composer.lock" ], "lint": [ - "vendor/bin/duster" + "vendor/bin/duster lint" ], "fix": [ - "vendor/bin/duster --fix" + "vendor/bin/duster fix" ] }, "config": { From cb5d2c6bd6961b368d6f4ee579cbd7133fe6a814 Mon Sep 17 00:00:00 2001 From: Anthony Clark Date: Mon, 22 May 2023 09:01:45 -0700 Subject: [PATCH 07/12] Clean up composer scripts --- composer.json | 2 -- scripts/generateLintersFormattersTables.php | 34 --------------------- 2 files changed, 36 deletions(-) delete mode 100644 scripts/generateLintersFormattersTables.php diff --git a/composer.json b/composer.json index 618b65f..086b48b 100644 --- a/composer.json +++ b/composer.json @@ -38,8 +38,6 @@ "bin/tlint" ], "scripts": { - "bumpVersion": "sed -i '' \"/TLINT_VERSION/ s/'v.*'/'$(git describe --abbrev=0 --tag)'/\" ./bin/tlint", - "generate-readme-tables": "php ./scripts/generateLintersFormattersTables.php", "update-fixture-app": [ "rm -rf ./tests/fixtures/laravel", "composer create-project laravel/laravel ./tests/fixtures/laravel", diff --git a/scripts/generateLintersFormattersTables.php b/scripts/generateLintersFormattersTables.php deleted file mode 100644 index cac7547..0000000 --- a/scripts/generateLintersFormattersTables.php +++ /dev/null @@ -1,34 +0,0 @@ -reduce(function ($carry, $file) { - $linter = new ReflectionClass('\Tighten\TLint\Linters\\' . basename($file, '.php')); - - return <<getShortName()}` | {$linter->getConstants()['DESCRIPTION']} | - MD; -}, <<<'MD' -| Linter | Description | -| --- | --- | -MD); - -$formatters = collect(glob(__DIR__ . '/../src/Formatters/*.php'))->reduce(function ($carry, $file) { - $formatter = new ReflectionClass('\Tighten\TLint\Formatters\\' . basename($file, '.php')); - - return <<getShortName()}` | {$formatter->getConstants()['DESCRIPTION']} | - MD; -}, <<<'MD' -| Formatter | Description | -| --- | --- | -MD); - -file_put_contents($readme, preg_replace([ - '/(?<=\n)(.*)(?=\n)/', - '/(?<=\n)(.*)(?=\n)/', -], [$linters, $formatters], file_get_contents($readme))); From ec3b6fbbf8425b2c0c31730f1e6b1cc0ac3fe800 Mon Sep 17 00:00:00 2001 From: Anthony Clark Date: Mon, 22 May 2023 09:02:00 -0700 Subject: [PATCH 08/12] Update readme --- readme.md | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/readme.md b/readme.md index ce662f5..661a616 100644 --- a/readme.md +++ b/readme.md @@ -4,21 +4,34 @@ [![Latest Version on Packagist](https://img.shields.io/packagist/v/tightenco/tlint.svg?style=flat-square)](https://packagist.org/packages/tightenco/tlint) -## Install (Requires PHP 8.0+) +## Install (Requires PHP 8.1+) >**Note** >TLint is intended to work with the tools included in [Duster](https://github.com/tighten/duster). To receive the best coverage we recommend using Duster to install and configure TLint. -``` +```bash +# Include in project +composer require tightenco/tlint --dev + +# Include globally composer global require tightenco/tlint ``` ## Upgrade -``` +```bash +# Upgrade in project +composer update tightenco/tlint + +#Upgrade globally composer global update tightenco/tlint ``` +### Upgrading from 8.x to 9.x + +TLint 9 requires PHP >= 8.1. +`tformat.json` has been dropped in favor of a single `tlint.json` file. + ### Upgrading from 7.x to 8.x A significant number of formatters were added between the 7.x and 8.x releases. @@ -201,7 +214,6 @@ The default configuration is "tighten", but you may change this by adding a `tfo ## Available Linters - | Linter | Description | | --- | --- | | `ApplyMiddlewareInRoutes` | Apply middleware in routes (not controllers). | @@ -224,7 +236,6 @@ The default configuration is "tighten", but you may change this by adding a `tfo | `SpacesAroundBladeRenderContent` | Spaces around blade rendered content:`{{1 + 1}}` -> `{{ 1 + 1 }}` | | `UseAnonymousMigrations` | Prefer anonymous class migrations. | | `UseAuthHelperOverFacade` | Prefer the `auth()` helper function over the `Auth` Facade. | - ### General PHP @@ -256,7 +267,6 @@ The default configuration is "tighten", but you may change this by adding a `tfo - Formatting is designed to alter the least amount of code possible. - Import related formatters are not designed to alter grouped imports. - | Formatter | Description | | --- | --- | | `ArrayParametersOverViewWith` | Prefer `view(..., [...])` over `view(...)->with(...)`. | @@ -274,7 +284,6 @@ The default configuration is "tighten", but you may change this by adding a `tfo | `SpacesAroundBladeRenderContent` | Spaces around blade rendered content:`{{1 + 1}}` -> `{{ 1 + 1 }}` | | `UseAnonymousMigrations` | Prefer anonymous class migrations. | | `UseAuthHelperOverFacade` | Prefer the `auth()` helper function over the `Auth` Facade. | - ### General PHP @@ -309,6 +318,7 @@ If you discover any security related issues, please email hello@tighten.co inste - [Logan Henson](https://github.com/loganhenson) - [Jacob Baker-Kretzmar](https://github.com/bakerkretzmar) +- [Anthony Clark](https://github.com/driftingly) - [All Contributors](../../contributors) ## License From 133df1c1a7c05819a12e9f16dda371456932f594 Mon Sep 17 00:00:00 2001 From: Anthony Clark Date: Mon, 22 May 2023 09:04:50 -0700 Subject: [PATCH 09/12] Remove ref to symfony in test name --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 01da46c..ddc09c5 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -7,7 +7,7 @@ on: - cron: "0 0 * * *" jobs: test: - name: PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony[0] }}, ${{ matrix.dependencies }}, ${{ matrix.os }} + name: PHP ${{ matrix.php }}, ${{ matrix.dependencies }}, ${{ matrix.os }} runs-on: ${{ matrix.os }}-latest strategy: matrix: From 42809075a75d79342a869aabd9c11a9955f1c962 Mon Sep 17 00:00:00 2001 From: Anthony Clark Date: Mon, 10 Jul 2023 14:17:57 -0700 Subject: [PATCH 10/12] Update fixture app --- tests/fixtures/laravel/.editorconfig | 4 +- tests/fixtures/laravel/.env.example | 2 +- tests/fixtures/laravel/.gitattributes | 2 +- tests/fixtures/laravel/.gitignore | 3 + tests/fixtures/laravel/README.md | 2 +- tests/fixtures/laravel/app/Console/Kernel.php | 9 +- .../laravel/app/Exceptions/Handler.php | 24 +-- .../app/Http/Controllers/Controller.php | 3 +- tests/fixtures/laravel/app/Http/Kernel.php | 9 +- .../app/Http/Middleware/Authenticate.php | 10 +- .../Middleware/RedirectIfAuthenticated.php | 8 +- .../app/Http/Middleware/TrustHosts.php | 2 +- tests/fixtures/laravel/app/Models/User.php | 1 + .../app/Providers/AppServiceProvider.php | 8 +- .../app/Providers/AuthServiceProvider.php | 8 +- .../Providers/BroadcastServiceProvider.php | 4 +- .../app/Providers/EventServiceProvider.php | 8 +- .../app/Providers/RouteServiceProvider.php | 22 +-- tests/fixtures/laravel/composer.json | 25 +-- tests/fixtures/laravel/config/app.php | 35 +--- tests/fixtures/laravel/config/auth.php | 8 +- .../fixtures/laravel/config/broadcasting.php | 3 +- tests/fixtures/laravel/config/cache.php | 1 + tests/fixtures/laravel/config/logging.php | 9 + tests/fixtures/laravel/config/mail.php | 9 +- tests/fixtures/laravel/config/queue.php | 16 ++ .../database/factories/UserFactory.php | 6 +- .../2014_10_12_000000_create_users_table.php | 8 +- ...00_create_password_reset_tokens_table.php} | 14 +- ..._08_19_000000_create_failed_jobs_table.php | 8 +- ...01_create_personal_access_tokens_table.php | 8 +- .../database/seeders/DatabaseSeeder.php | 4 +- tests/fixtures/laravel/lang/en/auth.php | 20 -- tests/fixtures/laravel/lang/en/pagination.php | 19 -- tests/fixtures/laravel/lang/en/passwords.php | 22 --- tests/fixtures/laravel/lang/en/validation.php | 174 ------------------ tests/fixtures/laravel/package.json | 9 +- tests/fixtures/laravel/phpunit.xml | 4 +- .../laravel/resources/js/bootstrap.js | 6 +- .../laravel/resources/views/welcome.blade.php | 156 ++++++++-------- tests/fixtures/laravel/routes/api.php | 4 +- tests/fixtures/laravel/routes/web.php | 4 +- .../laravel/tests/CreatesApplication.php | 5 +- .../laravel/tests/Feature/ExampleTest.php | 4 +- .../laravel/tests/Unit/ExampleTest.php | 4 +- 45 files changed, 209 insertions(+), 505 deletions(-) rename tests/fixtures/laravel/database/migrations/{2014_10_12_100000_create_password_resets_table.php => 2014_10_12_100000_create_password_reset_tokens_table.php} (59%) delete mode 100644 tests/fixtures/laravel/lang/en/auth.php delete mode 100644 tests/fixtures/laravel/lang/en/pagination.php delete mode 100644 tests/fixtures/laravel/lang/en/passwords.php delete mode 100644 tests/fixtures/laravel/lang/en/validation.php diff --git a/tests/fixtures/laravel/.editorconfig b/tests/fixtures/laravel/.editorconfig index 1671c9b..8f0de65 100644 --- a/tests/fixtures/laravel/.editorconfig +++ b/tests/fixtures/laravel/.editorconfig @@ -3,9 +3,9 @@ root = true [*] charset = utf-8 end_of_line = lf -insert_final_newline = true -indent_style = space indent_size = 4 +indent_style = space +insert_final_newline = true trim_trailing_whitespace = true [*.md] diff --git a/tests/fixtures/laravel/.env.example b/tests/fixtures/laravel/.env.example index 00b6110..478972c 100644 --- a/tests/fixtures/laravel/.env.example +++ b/tests/fixtures/laravel/.env.example @@ -29,7 +29,7 @@ REDIS_PASSWORD=null REDIS_PORT=6379 MAIL_MAILER=smtp -MAIL_HOST=mailhog +MAIL_HOST=mailpit MAIL_PORT=1025 MAIL_USERNAME=null MAIL_PASSWORD=null diff --git a/tests/fixtures/laravel/.gitattributes b/tests/fixtures/laravel/.gitattributes index 7dbbf41..fcb21d3 100644 --- a/tests/fixtures/laravel/.gitattributes +++ b/tests/fixtures/laravel/.gitattributes @@ -1,4 +1,4 @@ -* text=auto +* text=auto eol=lf *.blade.php diff=html *.css diff=css diff --git a/tests/fixtures/laravel/.gitignore b/tests/fixtures/laravel/.gitignore index 38e5b25..7fe978f 100644 --- a/tests/fixtures/laravel/.gitignore +++ b/tests/fixtures/laravel/.gitignore @@ -1,3 +1,4 @@ +/.phpunit.cache /node_modules /public/build /public/hot @@ -6,11 +7,13 @@ /vendor .env .env.backup +.env.production .phpunit.result.cache Homestead.json Homestead.yaml auth.json npm-debug.log yarn-error.log +/.fleet /.idea /.vscode diff --git a/tests/fixtures/laravel/README.md b/tests/fixtures/laravel/README.md index bf0ddd9..3ed385a 100644 --- a/tests/fixtures/laravel/README.md +++ b/tests/fixtures/laravel/README.md @@ -1,7 +1,7 @@

Laravel Logo

-Build Status +Build Status Total Downloads Latest Stable Version License diff --git a/tests/fixtures/laravel/app/Console/Kernel.php b/tests/fixtures/laravel/app/Console/Kernel.php index d8bc1d2..e6b9960 100644 --- a/tests/fixtures/laravel/app/Console/Kernel.php +++ b/tests/fixtures/laravel/app/Console/Kernel.php @@ -9,21 +9,16 @@ class Kernel extends ConsoleKernel { /** * Define the application's command schedule. - * - * @param \Illuminate\Console\Scheduling\Schedule $schedule - * @return void */ - protected function schedule(Schedule $schedule) + protected function schedule(Schedule $schedule): void { // $schedule->command('inspire')->hourly(); } /** * Register the commands for the application. - * - * @return void */ - protected function commands() + protected function commands(): void { $this->load(__DIR__.'/Commands'); diff --git a/tests/fixtures/laravel/app/Exceptions/Handler.php b/tests/fixtures/laravel/app/Exceptions/Handler.php index 82a37e4..56af264 100644 --- a/tests/fixtures/laravel/app/Exceptions/Handler.php +++ b/tests/fixtures/laravel/app/Exceptions/Handler.php @@ -8,25 +8,7 @@ class Handler extends ExceptionHandler { /** - * A list of exception types with their corresponding custom log levels. - * - * @var array, \Psr\Log\LogLevel::*> - */ - protected $levels = [ - // - ]; - - /** - * A list of the exception types that are not reported. - * - * @var array> - */ - protected $dontReport = [ - // - ]; - - /** - * A list of the inputs that are never flashed to the session on validation exceptions. + * The list of the inputs that are never flashed to the session on validation exceptions. * * @var array */ @@ -38,10 +20,8 @@ class Handler extends ExceptionHandler /** * Register the exception handling callbacks for the application. - * - * @return void */ - public function register() + public function register(): void { $this->reportable(function (Throwable $e) { // diff --git a/tests/fixtures/laravel/app/Http/Controllers/Controller.php b/tests/fixtures/laravel/app/Http/Controllers/Controller.php index a0a2a8a..77ec359 100644 --- a/tests/fixtures/laravel/app/Http/Controllers/Controller.php +++ b/tests/fixtures/laravel/app/Http/Controllers/Controller.php @@ -3,11 +3,10 @@ namespace App\Http\Controllers; use Illuminate\Foundation\Auth\Access\AuthorizesRequests; -use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Routing\Controller as BaseController; class Controller extends BaseController { - use AuthorizesRequests, DispatchesJobs, ValidatesRequests; + use AuthorizesRequests, ValidatesRequests; } diff --git a/tests/fixtures/laravel/app/Http/Kernel.php b/tests/fixtures/laravel/app/Http/Kernel.php index 0079688..494c050 100644 --- a/tests/fixtures/laravel/app/Http/Kernel.php +++ b/tests/fixtures/laravel/app/Http/Kernel.php @@ -40,19 +40,19 @@ class Kernel extends HttpKernel 'api' => [ // \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class, - 'throttle:api', + \Illuminate\Routing\Middleware\ThrottleRequests::class.':api', \Illuminate\Routing\Middleware\SubstituteBindings::class, ], ]; /** - * The application's route middleware. + * The application's middleware aliases. * - * These middleware may be assigned to groups or used individually. + * Aliases may be used instead of class names to conveniently assign middleware to routes and groups. * * @var array */ - protected $routeMiddleware = [ + protected $middlewareAliases = [ 'auth' => \App\Http\Middleware\Authenticate::class, 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class, @@ -60,6 +60,7 @@ class Kernel extends HttpKernel 'can' => \Illuminate\Auth\Middleware\Authorize::class, 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, + 'precognitive' => \Illuminate\Foundation\Http\Middleware\HandlePrecognitiveRequests::class, 'signed' => \App\Http\Middleware\ValidateSignature::class, 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, diff --git a/tests/fixtures/laravel/app/Http/Middleware/Authenticate.php b/tests/fixtures/laravel/app/Http/Middleware/Authenticate.php index 704089a..d4ef644 100644 --- a/tests/fixtures/laravel/app/Http/Middleware/Authenticate.php +++ b/tests/fixtures/laravel/app/Http/Middleware/Authenticate.php @@ -3,19 +3,15 @@ namespace App\Http\Middleware; use Illuminate\Auth\Middleware\Authenticate as Middleware; +use Illuminate\Http\Request; class Authenticate extends Middleware { /** * Get the path the user should be redirected to when they are not authenticated. - * - * @param \Illuminate\Http\Request $request - * @return string|null */ - protected function redirectTo($request) + protected function redirectTo(Request $request): ?string { - if (! $request->expectsJson()) { - return route('login'); - } + return $request->expectsJson() ? null : route('login'); } } diff --git a/tests/fixtures/laravel/app/Http/Middleware/RedirectIfAuthenticated.php b/tests/fixtures/laravel/app/Http/Middleware/RedirectIfAuthenticated.php index a2813a0..afc78c4 100644 --- a/tests/fixtures/laravel/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/tests/fixtures/laravel/app/Http/Middleware/RedirectIfAuthenticated.php @@ -6,18 +6,16 @@ use Closure; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; +use Symfony\Component\HttpFoundation\Response; class RedirectIfAuthenticated { /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request - * @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next - * @param string|null ...$guards - * @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse + * @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next */ - public function handle(Request $request, Closure $next, ...$guards) + public function handle(Request $request, Closure $next, string ...$guards): Response { $guards = empty($guards) ? [null] : $guards; diff --git a/tests/fixtures/laravel/app/Http/Middleware/TrustHosts.php b/tests/fixtures/laravel/app/Http/Middleware/TrustHosts.php index 7186414..c9c58bd 100644 --- a/tests/fixtures/laravel/app/Http/Middleware/TrustHosts.php +++ b/tests/fixtures/laravel/app/Http/Middleware/TrustHosts.php @@ -11,7 +11,7 @@ class TrustHosts extends Middleware * * @return array */ - public function hosts() + public function hosts(): array { return [ $this->allSubdomainsOfApplicationUrl(), diff --git a/tests/fixtures/laravel/app/Models/User.php b/tests/fixtures/laravel/app/Models/User.php index 23b4063..4d7f70f 100644 --- a/tests/fixtures/laravel/app/Models/User.php +++ b/tests/fixtures/laravel/app/Models/User.php @@ -40,5 +40,6 @@ class User extends Authenticatable */ protected $casts = [ 'email_verified_at' => 'datetime', + 'password' => 'hashed', ]; } diff --git a/tests/fixtures/laravel/app/Providers/AppServiceProvider.php b/tests/fixtures/laravel/app/Providers/AppServiceProvider.php index ee8ca5b..452e6b6 100644 --- a/tests/fixtures/laravel/app/Providers/AppServiceProvider.php +++ b/tests/fixtures/laravel/app/Providers/AppServiceProvider.php @@ -8,20 +8,16 @@ class AppServiceProvider extends ServiceProvider { /** * Register any application services. - * - * @return void */ - public function register() + public function register(): void { // } /** * Bootstrap any application services. - * - * @return void */ - public function boot() + public function boot(): void { // } diff --git a/tests/fixtures/laravel/app/Providers/AuthServiceProvider.php b/tests/fixtures/laravel/app/Providers/AuthServiceProvider.php index 33b83f5..54756cd 100644 --- a/tests/fixtures/laravel/app/Providers/AuthServiceProvider.php +++ b/tests/fixtures/laravel/app/Providers/AuthServiceProvider.php @@ -13,18 +13,14 @@ class AuthServiceProvider extends ServiceProvider * @var array */ protected $policies = [ - // 'App\Models\Model' => 'App\Policies\ModelPolicy', + // ]; /** * Register any authentication / authorization services. - * - * @return void */ - public function boot() + public function boot(): void { - $this->registerPolicies(); - // } } diff --git a/tests/fixtures/laravel/app/Providers/BroadcastServiceProvider.php b/tests/fixtures/laravel/app/Providers/BroadcastServiceProvider.php index 395c518..2be04f5 100644 --- a/tests/fixtures/laravel/app/Providers/BroadcastServiceProvider.php +++ b/tests/fixtures/laravel/app/Providers/BroadcastServiceProvider.php @@ -9,10 +9,8 @@ class BroadcastServiceProvider extends ServiceProvider { /** * Bootstrap any application services. - * - * @return void */ - public function boot() + public function boot(): void { Broadcast::routes(); diff --git a/tests/fixtures/laravel/app/Providers/EventServiceProvider.php b/tests/fixtures/laravel/app/Providers/EventServiceProvider.php index ab8b2cf..2d65aac 100644 --- a/tests/fixtures/laravel/app/Providers/EventServiceProvider.php +++ b/tests/fixtures/laravel/app/Providers/EventServiceProvider.php @@ -22,20 +22,16 @@ class EventServiceProvider extends ServiceProvider /** * Register any events for your application. - * - * @return void */ - public function boot() + public function boot(): void { // } /** * Determine if events and listeners should be automatically discovered. - * - * @return bool */ - public function shouldDiscoverEvents() + public function shouldDiscoverEvents(): bool { return false; } diff --git a/tests/fixtures/laravel/app/Providers/RouteServiceProvider.php b/tests/fixtures/laravel/app/Providers/RouteServiceProvider.php index ea87f2e..1cf5f15 100644 --- a/tests/fixtures/laravel/app/Providers/RouteServiceProvider.php +++ b/tests/fixtures/laravel/app/Providers/RouteServiceProvider.php @@ -11,7 +11,7 @@ class RouteServiceProvider extends ServiceProvider { /** - * The path to the "home" route for your application. + * The path to your application's "home" route. * * Typically, users are redirected here after authentication. * @@ -21,12 +21,12 @@ class RouteServiceProvider extends ServiceProvider /** * Define your route model bindings, pattern filters, and other route configuration. - * - * @return void */ - public function boot() + public function boot(): void { - $this->configureRateLimiting(); + RateLimiter::for('api', function (Request $request) { + return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()); + }); $this->routes(function () { Route::middleware('api') @@ -37,16 +37,4 @@ public function boot() ->group(base_path('routes/web.php')); }); } - - /** - * Configure the rate limiters for the application. - * - * @return void - */ - protected function configureRateLimiting() - { - RateLimiter::for('api', function (Request $request) { - return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()); - }); - } } diff --git a/tests/fixtures/laravel/composer.json b/tests/fixtures/laravel/composer.json index 299b7e8..e1fb449 100644 --- a/tests/fixtures/laravel/composer.json +++ b/tests/fixtures/laravel/composer.json @@ -1,24 +1,24 @@ { "name": "laravel/laravel", "type": "project", - "description": "The Laravel Framework.", - "keywords": ["framework", "laravel"], + "description": "The skeleton application for the Laravel framework.", + "keywords": ["laravel", "framework"], "license": "MIT", "require": { - "php": "^8.0.2", + "php": "^8.1", "guzzlehttp/guzzle": "^7.2", - "laravel/framework": "^9.19", - "laravel/sanctum": "^3.0", - "laravel/tinker": "^2.7" + "laravel/framework": "^10.10", + "laravel/sanctum": "^3.2", + "laravel/tinker": "^2.8" }, "require-dev": { "fakerphp/faker": "^1.9.1", "laravel/pint": "^1.0", - "laravel/sail": "^1.0.1", + "laravel/sail": "^1.18", "mockery/mockery": "^1.4.4", - "nunomaduro/collision": "^6.1", - "phpunit/phpunit": "^9.5.10", - "spatie/laravel-ignition": "^1.0" + "nunomaduro/collision": "^7.0", + "phpunit/phpunit": "^10.1", + "spatie/laravel-ignition": "^2.0" }, "autoload": { "psr-4": { @@ -57,9 +57,10 @@ "preferred-install": "dist", "sort-packages": true, "allow-plugins": { - "pestphp/pest-plugin": true + "pestphp/pest-plugin": true, + "php-http/discovery": true } }, - "minimum-stability": "dev", + "minimum-stability": "stable", "prefer-stable": true } diff --git a/tests/fixtures/laravel/config/app.php b/tests/fixtures/laravel/config/app.php index ef76a7e..4c231b4 100644 --- a/tests/fixtures/laravel/config/app.php +++ b/tests/fixtures/laravel/config/app.php @@ -1,6 +1,7 @@ [ - - /* - * Laravel Framework Service Providers... - */ - Illuminate\Auth\AuthServiceProvider::class, - Illuminate\Broadcasting\BroadcastServiceProvider::class, - Illuminate\Bus\BusServiceProvider::class, - Illuminate\Cache\CacheServiceProvider::class, - Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class, - Illuminate\Cookie\CookieServiceProvider::class, - Illuminate\Database\DatabaseServiceProvider::class, - Illuminate\Encryption\EncryptionServiceProvider::class, - Illuminate\Filesystem\FilesystemServiceProvider::class, - Illuminate\Foundation\Providers\FoundationServiceProvider::class, - Illuminate\Hashing\HashServiceProvider::class, - Illuminate\Mail\MailServiceProvider::class, - Illuminate\Notifications\NotificationServiceProvider::class, - Illuminate\Pagination\PaginationServiceProvider::class, - Illuminate\Pipeline\PipelineServiceProvider::class, - Illuminate\Queue\QueueServiceProvider::class, - Illuminate\Redis\RedisServiceProvider::class, - Illuminate\Auth\Passwords\PasswordResetServiceProvider::class, - Illuminate\Session\SessionServiceProvider::class, - Illuminate\Translation\TranslationServiceProvider::class, - Illuminate\Validation\ValidationServiceProvider::class, - Illuminate\View\ViewServiceProvider::class, - + 'providers' => ServiceProvider::defaultProviders()->merge([ /* * Package Service Providers... */ @@ -194,8 +168,7 @@ // App\Providers\BroadcastServiceProvider::class, App\Providers\EventServiceProvider::class, App\Providers\RouteServiceProvider::class, - - ], + ])->toArray(), /* |-------------------------------------------------------------------------- @@ -209,7 +182,7 @@ */ 'aliases' => Facade::defaultAliases()->merge([ - // 'ExampleClass' => App\Example\ExampleClass::class, + // 'Example' => App\Facades\Example::class, ])->toArray(), ]; diff --git a/tests/fixtures/laravel/config/auth.php b/tests/fixtures/laravel/config/auth.php index d8c6cee..9548c15 100644 --- a/tests/fixtures/laravel/config/auth.php +++ b/tests/fixtures/laravel/config/auth.php @@ -80,16 +80,20 @@ | than one user table or model in the application and you want to have | separate password reset settings based on the specific user types. | - | The expire time is the number of minutes that each reset token will be + | The expiry time is the number of minutes that each reset token will be | considered valid. This security feature keeps tokens short-lived so | they have less time to be guessed. You may change this as needed. | + | The throttle setting is the number of seconds a user must wait before + | generating more password reset tokens. This prevents the user from + | quickly generating a very large amount of password reset tokens. + | */ 'passwords' => [ 'users' => [ 'provider' => 'users', - 'table' => 'password_resets', + 'table' => 'password_reset_tokens', 'expire' => 60, 'throttle' => 60, ], diff --git a/tests/fixtures/laravel/config/broadcasting.php b/tests/fixtures/laravel/config/broadcasting.php index 1688242..2410485 100644 --- a/tests/fixtures/laravel/config/broadcasting.php +++ b/tests/fixtures/laravel/config/broadcasting.php @@ -36,7 +36,8 @@ 'secret' => env('PUSHER_APP_SECRET'), 'app_id' => env('PUSHER_APP_ID'), 'options' => [ - 'host' => env('PUSHER_HOST', 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com', + 'cluster' => env('PUSHER_APP_CLUSTER'), + 'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com', 'port' => env('PUSHER_PORT', 443), 'scheme' => env('PUSHER_SCHEME', 'https'), 'encrypted' => true, diff --git a/tests/fixtures/laravel/config/cache.php b/tests/fixtures/laravel/config/cache.php index 33bb295..d4171e2 100644 --- a/tests/fixtures/laravel/config/cache.php +++ b/tests/fixtures/laravel/config/cache.php @@ -52,6 +52,7 @@ 'file' => [ 'driver' => 'file', 'path' => storage_path('framework/cache/data'), + 'lock_path' => storage_path('framework/cache/data'), ], 'memcached' => [ diff --git a/tests/fixtures/laravel/config/logging.php b/tests/fixtures/laravel/config/logging.php index 5aa1dbb..c44d276 100644 --- a/tests/fixtures/laravel/config/logging.php +++ b/tests/fixtures/laravel/config/logging.php @@ -3,6 +3,7 @@ use Monolog\Handler\NullHandler; use Monolog\Handler\StreamHandler; use Monolog\Handler\SyslogUdpHandler; +use Monolog\Processor\PsrLogMessageProcessor; return [ @@ -61,6 +62,7 @@ 'driver' => 'single', 'path' => storage_path('logs/laravel.log'), 'level' => env('LOG_LEVEL', 'debug'), + 'replace_placeholders' => true, ], 'daily' => [ @@ -68,6 +70,7 @@ 'path' => storage_path('logs/laravel.log'), 'level' => env('LOG_LEVEL', 'debug'), 'days' => 14, + 'replace_placeholders' => true, ], 'slack' => [ @@ -76,6 +79,7 @@ 'username' => 'Laravel Log', 'emoji' => ':boom:', 'level' => env('LOG_LEVEL', 'critical'), + 'replace_placeholders' => true, ], 'papertrail' => [ @@ -87,6 +91,7 @@ 'port' => env('PAPERTRAIL_PORT'), 'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'), ], + 'processors' => [PsrLogMessageProcessor::class], ], 'stderr' => [ @@ -97,16 +102,20 @@ 'with' => [ 'stream' => 'php://stderr', ], + 'processors' => [PsrLogMessageProcessor::class], ], 'syslog' => [ 'driver' => 'syslog', 'level' => env('LOG_LEVEL', 'debug'), + 'facility' => LOG_USER, + 'replace_placeholders' => true, ], 'errorlog' => [ 'driver' => 'errorlog', 'level' => env('LOG_LEVEL', 'debug'), + 'replace_placeholders' => true, ], 'null' => [ diff --git a/tests/fixtures/laravel/config/mail.php b/tests/fixtures/laravel/config/mail.php index 534395a..e652bd0 100644 --- a/tests/fixtures/laravel/config/mail.php +++ b/tests/fixtures/laravel/config/mail.php @@ -28,7 +28,7 @@ | sending an e-mail. You will specify which one you are using for your | mailers below. You are free to add additional mailers as required. | - | Supported: "smtp", "sendmail", "mailgun", "ses", + | Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2", | "postmark", "log", "array", "failover" | */ @@ -36,6 +36,7 @@ 'mailers' => [ 'smtp' => [ 'transport' => 'smtp', + 'url' => env('MAIL_URL'), 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 'port' => env('MAIL_PORT', 587), 'encryption' => env('MAIL_ENCRYPTION', 'tls'), @@ -51,10 +52,16 @@ 'mailgun' => [ 'transport' => 'mailgun', + // 'client' => [ + // 'timeout' => 5, + // ], ], 'postmark' => [ 'transport' => 'postmark', + // 'client' => [ + // 'timeout' => 5, + // ], ], 'sendmail' => [ diff --git a/tests/fixtures/laravel/config/queue.php b/tests/fixtures/laravel/config/queue.php index 25ea5a8..01c6b05 100644 --- a/tests/fixtures/laravel/config/queue.php +++ b/tests/fixtures/laravel/config/queue.php @@ -73,6 +73,22 @@ ], + /* + |-------------------------------------------------------------------------- + | Job Batching + |-------------------------------------------------------------------------- + | + | The following options configure the database and table that store job + | batching information. These options can be updated to any database + | connection and table which has been defined by your application. + | + */ + + 'batching' => [ + 'database' => env('DB_CONNECTION', 'mysql'), + 'table' => 'job_batches', + ], + /* |-------------------------------------------------------------------------- | Failed Queue Jobs diff --git a/tests/fixtures/laravel/database/factories/UserFactory.php b/tests/fixtures/laravel/database/factories/UserFactory.php index 41f8ae8..a6ecc0a 100644 --- a/tests/fixtures/laravel/database/factories/UserFactory.php +++ b/tests/fixtures/laravel/database/factories/UserFactory.php @@ -15,7 +15,7 @@ class UserFactory extends Factory * * @return array */ - public function definition() + public function definition(): array { return [ 'name' => fake()->name(), @@ -28,10 +28,8 @@ public function definition() /** * Indicate that the model's email address should be unverified. - * - * @return static */ - public function unverified() + public function unverified(): static { return $this->state(fn (array $attributes) => [ 'email_verified_at' => null, diff --git a/tests/fixtures/laravel/database/migrations/2014_10_12_000000_create_users_table.php b/tests/fixtures/laravel/database/migrations/2014_10_12_000000_create_users_table.php index cf6b776..444fafb 100644 --- a/tests/fixtures/laravel/database/migrations/2014_10_12_000000_create_users_table.php +++ b/tests/fixtures/laravel/database/migrations/2014_10_12_000000_create_users_table.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('users', function (Blueprint $table) { $table->id(); @@ -26,10 +24,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('users'); } diff --git a/tests/fixtures/laravel/database/migrations/2014_10_12_100000_create_password_resets_table.php b/tests/fixtures/laravel/database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php similarity index 59% rename from tests/fixtures/laravel/database/migrations/2014_10_12_100000_create_password_resets_table.php rename to tests/fixtures/laravel/database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php index fcacb80..81a7229 100644 --- a/tests/fixtures/laravel/database/migrations/2014_10_12_100000_create_password_resets_table.php +++ b/tests/fixtures/laravel/database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php @@ -8,13 +8,11 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { - Schema::create('password_resets', function (Blueprint $table) { - $table->string('email')->index(); + Schema::create('password_reset_tokens', function (Blueprint $table) { + $table->string('email')->primary(); $table->string('token'); $table->timestamp('created_at')->nullable(); }); @@ -22,11 +20,9 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { - Schema::dropIfExists('password_resets'); + Schema::dropIfExists('password_reset_tokens'); } }; diff --git a/tests/fixtures/laravel/database/migrations/2019_08_19_000000_create_failed_jobs_table.php b/tests/fixtures/laravel/database/migrations/2019_08_19_000000_create_failed_jobs_table.php index 1719198..249da81 100644 --- a/tests/fixtures/laravel/database/migrations/2019_08_19_000000_create_failed_jobs_table.php +++ b/tests/fixtures/laravel/database/migrations/2019_08_19_000000_create_failed_jobs_table.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('failed_jobs', function (Blueprint $table) { $table->id(); @@ -26,10 +24,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('failed_jobs'); } diff --git a/tests/fixtures/laravel/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php b/tests/fixtures/laravel/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php index 6c81fd2..e828ad8 100644 --- a/tests/fixtures/laravel/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php +++ b/tests/fixtures/laravel/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('personal_access_tokens', function (Blueprint $table) { $table->id(); @@ -27,10 +25,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('personal_access_tokens'); } diff --git a/tests/fixtures/laravel/database/seeders/DatabaseSeeder.php b/tests/fixtures/laravel/database/seeders/DatabaseSeeder.php index 76d96dc..a9f4519 100644 --- a/tests/fixtures/laravel/database/seeders/DatabaseSeeder.php +++ b/tests/fixtures/laravel/database/seeders/DatabaseSeeder.php @@ -9,10 +9,8 @@ class DatabaseSeeder extends Seeder { /** * Seed the application's database. - * - * @return void */ - public function run() + public function run(): void { // \App\Models\User::factory(10)->create(); diff --git a/tests/fixtures/laravel/lang/en/auth.php b/tests/fixtures/laravel/lang/en/auth.php deleted file mode 100644 index 6598e2c..0000000 --- a/tests/fixtures/laravel/lang/en/auth.php +++ /dev/null @@ -1,20 +0,0 @@ - 'These credentials do not match our records.', - 'password' => 'The provided password is incorrect.', - 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', - -]; diff --git a/tests/fixtures/laravel/lang/en/pagination.php b/tests/fixtures/laravel/lang/en/pagination.php deleted file mode 100644 index d481411..0000000 --- a/tests/fixtures/laravel/lang/en/pagination.php +++ /dev/null @@ -1,19 +0,0 @@ - '« Previous', - 'next' => 'Next »', - -]; diff --git a/tests/fixtures/laravel/lang/en/passwords.php b/tests/fixtures/laravel/lang/en/passwords.php deleted file mode 100644 index 2345a56..0000000 --- a/tests/fixtures/laravel/lang/en/passwords.php +++ /dev/null @@ -1,22 +0,0 @@ - 'Your password has been reset!', - 'sent' => 'We have emailed your password reset link!', - 'throttled' => 'Please wait before retrying.', - 'token' => 'This password reset token is invalid.', - 'user' => "We can't find a user with that email address.", - -]; diff --git a/tests/fixtures/laravel/lang/en/validation.php b/tests/fixtures/laravel/lang/en/validation.php deleted file mode 100644 index 5ea01fa..0000000 --- a/tests/fixtures/laravel/lang/en/validation.php +++ /dev/null @@ -1,174 +0,0 @@ - 'The :attribute must be accepted.', - 'accepted_if' => 'The :attribute must be accepted when :other is :value.', - 'active_url' => 'The :attribute is not a valid URL.', - 'after' => 'The :attribute must be a date after :date.', - 'after_or_equal' => 'The :attribute must be a date after or equal to :date.', - 'alpha' => 'The :attribute must only contain letters.', - 'alpha_dash' => 'The :attribute must only contain letters, numbers, dashes and underscores.', - 'alpha_num' => 'The :attribute must only contain letters and numbers.', - 'array' => 'The :attribute must be an array.', - 'before' => 'The :attribute must be a date before :date.', - 'before_or_equal' => 'The :attribute must be a date before or equal to :date.', - 'between' => [ - 'array' => 'The :attribute must have between :min and :max items.', - 'file' => 'The :attribute must be between :min and :max kilobytes.', - 'numeric' => 'The :attribute must be between :min and :max.', - 'string' => 'The :attribute must be between :min and :max characters.', - ], - 'boolean' => 'The :attribute field must be true or false.', - 'confirmed' => 'The :attribute confirmation does not match.', - 'current_password' => 'The password is incorrect.', - 'date' => 'The :attribute is not a valid date.', - 'date_equals' => 'The :attribute must be a date equal to :date.', - 'date_format' => 'The :attribute does not match the format :format.', - 'declined' => 'The :attribute must be declined.', - 'declined_if' => 'The :attribute must be declined when :other is :value.', - 'different' => 'The :attribute and :other must be different.', - 'digits' => 'The :attribute must be :digits digits.', - 'digits_between' => 'The :attribute must be between :min and :max digits.', - 'dimensions' => 'The :attribute has invalid image dimensions.', - 'distinct' => 'The :attribute field has a duplicate value.', - 'doesnt_end_with' => 'The :attribute may not end with one of the following: :values.', - 'doesnt_start_with' => 'The :attribute may not start with one of the following: :values.', - 'email' => 'The :attribute must be a valid email address.', - 'ends_with' => 'The :attribute must end with one of the following: :values.', - 'enum' => 'The selected :attribute is invalid.', - 'exists' => 'The selected :attribute is invalid.', - 'file' => 'The :attribute must be a file.', - 'filled' => 'The :attribute field must have a value.', - 'gt' => [ - 'array' => 'The :attribute must have more than :value items.', - 'file' => 'The :attribute must be greater than :value kilobytes.', - 'numeric' => 'The :attribute must be greater than :value.', - 'string' => 'The :attribute must be greater than :value characters.', - ], - 'gte' => [ - 'array' => 'The :attribute must have :value items or more.', - 'file' => 'The :attribute must be greater than or equal to :value kilobytes.', - 'numeric' => 'The :attribute must be greater than or equal to :value.', - 'string' => 'The :attribute must be greater than or equal to :value characters.', - ], - 'image' => 'The :attribute must be an image.', - 'in' => 'The selected :attribute is invalid.', - 'in_array' => 'The :attribute field does not exist in :other.', - 'integer' => 'The :attribute must be an integer.', - 'ip' => 'The :attribute must be a valid IP address.', - 'ipv4' => 'The :attribute must be a valid IPv4 address.', - 'ipv6' => 'The :attribute must be a valid IPv6 address.', - 'json' => 'The :attribute must be a valid JSON string.', - 'lt' => [ - 'array' => 'The :attribute must have less than :value items.', - 'file' => 'The :attribute must be less than :value kilobytes.', - 'numeric' => 'The :attribute must be less than :value.', - 'string' => 'The :attribute must be less than :value characters.', - ], - 'lte' => [ - 'array' => 'The :attribute must not have more than :value items.', - 'file' => 'The :attribute must be less than or equal to :value kilobytes.', - 'numeric' => 'The :attribute must be less than or equal to :value.', - 'string' => 'The :attribute must be less than or equal to :value characters.', - ], - 'mac_address' => 'The :attribute must be a valid MAC address.', - 'max' => [ - 'array' => 'The :attribute must not have more than :max items.', - 'file' => 'The :attribute must not be greater than :max kilobytes.', - 'numeric' => 'The :attribute must not be greater than :max.', - 'string' => 'The :attribute must not be greater than :max characters.', - ], - 'max_digits' => 'The :attribute must not have more than :max digits.', - 'mimes' => 'The :attribute must be a file of type: :values.', - 'mimetypes' => 'The :attribute must be a file of type: :values.', - 'min' => [ - 'array' => 'The :attribute must have at least :min items.', - 'file' => 'The :attribute must be at least :min kilobytes.', - 'numeric' => 'The :attribute must be at least :min.', - 'string' => 'The :attribute must be at least :min characters.', - ], - 'min_digits' => 'The :attribute must have at least :min digits.', - 'multiple_of' => 'The :attribute must be a multiple of :value.', - 'not_in' => 'The selected :attribute is invalid.', - 'not_regex' => 'The :attribute format is invalid.', - 'numeric' => 'The :attribute must be a number.', - 'password' => [ - 'letters' => 'The :attribute must contain at least one letter.', - 'mixed' => 'The :attribute must contain at least one uppercase and one lowercase letter.', - 'numbers' => 'The :attribute must contain at least one number.', - 'symbols' => 'The :attribute must contain at least one symbol.', - 'uncompromised' => 'The given :attribute has appeared in a data leak. Please choose a different :attribute.', - ], - 'present' => 'The :attribute field must be present.', - 'prohibited' => 'The :attribute field is prohibited.', - 'prohibited_if' => 'The :attribute field is prohibited when :other is :value.', - 'prohibited_unless' => 'The :attribute field is prohibited unless :other is in :values.', - 'prohibits' => 'The :attribute field prohibits :other from being present.', - 'regex' => 'The :attribute format is invalid.', - 'required' => 'The :attribute field is required.', - 'required_array_keys' => 'The :attribute field must contain entries for: :values.', - 'required_if' => 'The :attribute field is required when :other is :value.', - 'required_if_accepted' => 'The :attribute field is required when :other is accepted.', - 'required_unless' => 'The :attribute field is required unless :other is in :values.', - 'required_with' => 'The :attribute field is required when :values is present.', - 'required_with_all' => 'The :attribute field is required when :values are present.', - 'required_without' => 'The :attribute field is required when :values is not present.', - 'required_without_all' => 'The :attribute field is required when none of :values are present.', - 'same' => 'The :attribute and :other must match.', - 'size' => [ - 'array' => 'The :attribute must contain :size items.', - 'file' => 'The :attribute must be :size kilobytes.', - 'numeric' => 'The :attribute must be :size.', - 'string' => 'The :attribute must be :size characters.', - ], - 'starts_with' => 'The :attribute must start with one of the following: :values.', - 'string' => 'The :attribute must be a string.', - 'timezone' => 'The :attribute must be a valid timezone.', - 'unique' => 'The :attribute has already been taken.', - 'uploaded' => 'The :attribute failed to upload.', - 'url' => 'The :attribute must be a valid URL.', - 'uuid' => 'The :attribute must be a valid UUID.', - - /* - |-------------------------------------------------------------------------- - | Custom Validation Language Lines - |-------------------------------------------------------------------------- - | - | Here you may specify custom validation messages for attributes using the - | convention "attribute.rule" to name the lines. This makes it quick to - | specify a specific custom language line for a given attribute rule. - | - */ - - 'custom' => [ - 'attribute-name' => [ - 'rule-name' => 'custom-message', - ], - ], - - /* - |-------------------------------------------------------------------------- - | Custom Validation Attributes - |-------------------------------------------------------------------------- - | - | The following language lines are used to swap our attribute placeholder - | with something more reader friendly such as "E-Mail Address" instead - | of "email". This simply helps us make our message more expressive. - | - */ - - 'attributes' => [], - -]; diff --git a/tests/fixtures/laravel/package.json b/tests/fixtures/laravel/package.json index 6d30231..e543e0d 100644 --- a/tests/fixtures/laravel/package.json +++ b/tests/fixtures/laravel/package.json @@ -1,14 +1,13 @@ { "private": true, + "type": "module", "scripts": { "dev": "vite", "build": "vite build" }, "devDependencies": { - "axios": "^0.27", - "laravel-vite-plugin": "^0.6.0", - "lodash": "^4.17.19", - "postcss": "^8.1.14", - "vite": "^3.0.0" + "axios": "^1.1.2", + "laravel-vite-plugin": "^0.7.5", + "vite": "^4.0.0" } } diff --git a/tests/fixtures/laravel/phpunit.xml b/tests/fixtures/laravel/phpunit.xml index 2ac86a1..e9f533d 100644 --- a/tests/fixtures/laravel/phpunit.xml +++ b/tests/fixtures/laravel/phpunit.xml @@ -12,11 +12,11 @@ ./tests/Feature - + ./app - + diff --git a/tests/fixtures/laravel/resources/js/bootstrap.js b/tests/fixtures/laravel/resources/js/bootstrap.js index d21a8c0..846d350 100644 --- a/tests/fixtures/laravel/resources/js/bootstrap.js +++ b/tests/fixtures/laravel/resources/js/bootstrap.js @@ -1,6 +1,3 @@ -import _ from 'lodash'; -window._ = _; - /** * We'll load the axios HTTP library which allows us to easily issue requests * to our Laravel back-end. This library automatically handles sending the @@ -26,7 +23,8 @@ window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; // window.Echo = new Echo({ // broadcaster: 'pusher', // key: import.meta.env.VITE_PUSHER_APP_KEY, -// wsHost: import.meta.env.VITE_PUSHER_HOST ?? `ws-${import.meta.env.VITE_PUSHER_APP_CLUSTER}.pusher.com`, +// cluster: import.meta.env.VITE_PUSHER_APP_CLUSTER ?? 'mt1', +// wsHost: import.meta.env.VITE_PUSHER_HOST ? import.meta.env.VITE_PUSHER_HOST : `ws-${import.meta.env.VITE_PUSHER_APP_CLUSTER}.pusher.com`, // wsPort: import.meta.env.VITE_PUSHER_PORT ?? 80, // wssPort: import.meta.env.VITE_PUSHER_PORT ?? 443, // forceTLS: (import.meta.env.VITE_PUSHER_SCHEME ?? 'https') === 'https', diff --git a/tests/fixtures/laravel/resources/views/welcome.blade.php b/tests/fixtures/laravel/resources/views/welcome.blade.php index de23392..638ec96 100644 --- a/tests/fixtures/laravel/resources/views/welcome.blade.php +++ b/tests/fixtures/laravel/resources/views/welcome.blade.php @@ -7,122 +7,130 @@ Laravel - + + - - -

+
@if (Route::has('login')) -