diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 55c942d0..45242a81 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,18 +16,13 @@ jobs: strategy: fail-fast: false matrix: - php-version: [8.0, 8.1] - + php-version: ['8.1', '8.2'] os: [ubuntu-latest, windows-latest, macos-latest] - dependencies: [locked] - experimental: [false] name: PHP ${{ matrix.php-version }} - ${{ matrix.os }} - runs-on: ${{ matrix.os }} - continue-on-error: ${{ matrix.experimental }} steps: diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml index cea9b4a5..70c7f0bd 100644 --- a/.github/workflows/demo.yml +++ b/.github/workflows/demo.yml @@ -14,7 +14,7 @@ jobs: services: mysql: - image: mysql:5.7 + image: mysql:8.0 env: MYSQL_ALLOW_EMPTY_PASSWORD: yes MYSQL_DATABASE: laravel @@ -25,8 +25,8 @@ jobs: strategy: fail-fast: false matrix: - php-version: [8.0, 8.1] - laravel-version: [9] + php-version: ['8.1', '8.2'] + laravel-version: [10] os: [ubuntu-latest] runs-on: ${{ matrix.os }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 41685faa..c4007120 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -12,7 +12,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.0' + php-version: '8.1' tools: phplint, laravel/pint - name: Check syntax run: phplint . diff --git a/UPGRADE.md b/UPGRADE.md index e8926456..3b279d9c 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -1,5 +1,12 @@ # Upgrade Guide +## Upgrading from 2.x to 2.6 +Version 2.6 was a minor release to add support for Laravel 10. This adopts the latest conventions from Laravel, most notably the addition of type-hints in code. + +The only other change is the removal of `use_return_types` configuration, as this is now Blueprint's default behavior. + +Inline with Blueprint's [Support Policy](https://github.com/laravel-shift/blueprint#support-policy), this release also drops support for Laravel 9. If you are still running Laravel 9, you may constrain your Blueprint version to `2.5.0`. + ## Upgrading from 1.x to 2.x Version 2.x was a superficial major release to reflect Blueprint's new [Support Policy](https://github.com/laravel-shift/blueprint#support-policy). There were no changes to the underlying grammar. A few configuration options and methods were changed. Additional notes are below. You may view the full set of changes in [#496](https://github.com/laravel-shift/blueprint/pull/496). diff --git a/composer.json b/composer.json index f81b318e..a0b4a5d3 100644 --- a/composer.json +++ b/composer.json @@ -2,23 +2,20 @@ "name": "laravel-shift/blueprint", "type": "library", "description": "An expressive, human readable code generation tool.", - "keywords": [ - "framework", - "laravel" - ], + "keywords": ["framework", "laravel", "code generation"], "license": "MIT", "require": { "doctrine/dbal": "^3.3", - "illuminate/console": "^9.0|^10.0", - "illuminate/filesystem": "^9.0|^10.0", - "illuminate/support": "^9.0|^10.0", + "illuminate/console": "^10.0", + "illuminate/filesystem": "^10.0", + "illuminate/support": "^10.0", "laravel-shift/faker-registry": "^0.2.0", - "symfony/yaml": "^6.0" + "symfony/yaml": "^6.3" }, "require-dev": { "laravel/pint": "^1.2", "mockery/mockery": "^1.4.4", - "orchestra/testbench": "^7.0|^8.0", + "orchestra/testbench": "^8.0", "phpunit/phpunit": "^9.5.10" }, "suggest": { diff --git a/config/blueprint.php b/config/blueprint.php index 68d777ec..d4c54d34 100644 --- a/config/blueprint.php +++ b/config/blueprint.php @@ -87,19 +87,6 @@ */ 'fake_nullables' => true, - /* - |-------------------------------------------------------------------------- - | Method Return Type Declarations - |-------------------------------------------------------------------------- - | - | Enable or disable method return typehinting for blueprint generated - | methods. Enabling this will enforce code strictness which increases - | readability of code and will lower maintenance cost. This will only - | Work for projects running PHP v7.0 or higher. - | - */ - 'use_return_types' => false, - /* |-------------------------------------------------------------------------- | Use Guarded diff --git a/src/Blueprint.php b/src/Blueprint.php index 7ff13c75..3b008e96 100644 --- a/src/Blueprint.php +++ b/src/Blueprint.php @@ -30,11 +30,6 @@ public static function appPath() return str_replace('\\', '/', config('blueprint.app_path')); } - public static function useReturnTypeHints() - { - return boolval(config('blueprint.use_return_types')); - } - public function parse($content, $strip_dashes = true) { $content = str_replace(["\r\n", "\r"], "\n", $content); diff --git a/src/Commands/BuildCommand.php b/src/Commands/BuildCommand.php index dea685b7..8c063711 100644 --- a/src/Commands/BuildCommand.php +++ b/src/Commands/BuildCommand.php @@ -36,10 +36,6 @@ class BuildCommand extends Command /** @var Builder */ private $builder; - /** - * @param Filesystem $filesystem - * @param Builder $builder - */ public function __construct(Filesystem $filesystem, Builder $builder) { parent::__construct(); diff --git a/src/Commands/NewCommand.php b/src/Commands/NewCommand.php index 0c78f98b..696be9dd 100644 --- a/src/Commands/NewCommand.php +++ b/src/Commands/NewCommand.php @@ -27,9 +27,6 @@ class NewCommand extends Command /** @var Filesystem */ protected $filesystem; - /** - * @param Filesystem $filesystem - */ public function __construct(Filesystem $filesystem) { parent::__construct(); diff --git a/src/Commands/TraceCommand.php b/src/Commands/TraceCommand.php index 402430f3..f809fa8e 100644 --- a/src/Commands/TraceCommand.php +++ b/src/Commands/TraceCommand.php @@ -32,10 +32,6 @@ class TraceCommand extends Command /** @var Tracer */ private $tracer; - /** - * @param Filesystem $filesystem - * @param Tracer $tracer - */ public function __construct(Filesystem $filesystem, Tracer $tracer) { parent::__construct(); diff --git a/src/Generators/ControllerGenerator.php b/src/Generators/ControllerGenerator.php index ede2b69f..3fb927fd 100644 --- a/src/Generators/ControllerGenerator.php +++ b/src/Generators/ControllerGenerator.php @@ -2,12 +2,10 @@ namespace Blueprint\Generators; -use Blueprint\Blueprint; use Blueprint\Concerns\HandlesImports; use Blueprint\Concerns\HandlesTraits; use Blueprint\Contracts\Generator; use Blueprint\Models\Controller; -use Blueprint\Models\Model; use Blueprint\Models\Statements\DispatchStatement; use Blueprint\Models\Statements\EloquentStatement; use Blueprint\Models\Statements\FireStatement; @@ -72,10 +70,6 @@ protected function buildMethods(Controller $controller) $reference = $this->fullyQualifyModelReference($controller->namespace(), Str::camel($context)); $variable = '$' . Str::camel($context); - // TODO: verify controller prefix references a model - $search = ' * @return \\Illuminate\\Http\\Response'; - $method = str_replace($search, ' * @param \\' . $reference . ' ' . $variable . PHP_EOL . $search, $method); - $search = '(Request $request'; $method = str_replace($search, $search . ', ' . $context . ' ' . $variable, $method); $this->addImport($controller, $reference); @@ -116,7 +110,6 @@ protected function buildMethods(Controller $controller) $body .= self::INDENT . $statement->output() . PHP_EOL; } elseif ($statement instanceof ResourceStatement) { $fqcn = config('blueprint.namespace') . '\\Http\\Resources\\' . ($controller->namespace() ? $controller->namespace() . '\\' : '') . $statement->name(); - $method = str_replace('* @return \\Illuminate\\Http\\Response', '* @return \\' . $fqcn, $method); $this->addImport($controller, $fqcn); $body .= self::INDENT . $statement->output() . PHP_EOL; @@ -154,21 +147,18 @@ protected function buildMethods(Controller $controller) $method = str_replace('{{ body }}', trim($body), $method); } - if (Blueprint::useReturnTypeHints()) { - if (isset($fqcn) && $name !== 'destroy' && $controller->isApiResource()) { - $method = str_replace(')' . PHP_EOL, '): \\' . $fqcn . PHP_EOL, $method); - } else { - $returnType = match (true) { - $statement instanceof RenderStatement => 'Illuminate\View\View', - $statement instanceof RedirectStatement => 'Illuminate\Routing\Redirector', - default => 'Illuminate\Http\Response' - }; - - $method = Str::of($method) - ->replace('* @return \\Illuminate\\Http\\Response', '* @return \\' . $returnType) - ->replace(')' . PHP_EOL, '): \\' . $returnType . PHP_EOL) - ->toString(); - } + if ($statement instanceof RespondStatement && $statement->content()) { + $method = str_replace('): Response' . PHP_EOL, ')' . PHP_EOL, $method); + } else { + $returnType = match (true) { + $statement instanceof RenderStatement => 'Illuminate\View\View', + $statement instanceof RedirectStatement => 'Illuminate\Http\RedirectResponse', + $statement instanceof ResourceStatement => config('blueprint.namespace') . '\\Http\\Resources\\' . ($controller->namespace() ? $controller->namespace() . '\\' : '') . $statement->name(), + default => 'Illuminate\Http\Response' + }; + + $method = str_replace('): Response' . PHP_EOL, '): ' . Str::afterLast($returnType, '\\') . PHP_EOL, $method); + $this->addImport($controller, $returnType); } $methods .= PHP_EOL . $method; diff --git a/src/Generators/FactoryGenerator.php b/src/Generators/FactoryGenerator.php index 06b719d4..fceacd50 100644 --- a/src/Generators/FactoryGenerator.php +++ b/src/Generators/FactoryGenerator.php @@ -2,7 +2,6 @@ namespace Blueprint\Generators; -use Blueprint\Blueprint; use Blueprint\Concerns\HandlesImports; use Blueprint\Concerns\HandlesTraits; use Blueprint\Contracts\Generator; @@ -54,11 +53,6 @@ protected function populateStub(string $stub, Model $model) { $stub = str_replace('{{ model }}', $model->name(), $stub); $stub = str_replace('//', $this->buildDefinition($model), $stub); - - if (Blueprint::useReturnTypeHints()) { - $stub = str_replace('definition()', 'definition(): array', $stub); - } - $stub = str_replace('{{ namespace }}', 'Database\Factories' . ($model->namespace() ? '\\' . $model->namespace() : ''), $stub); $stub = str_replace('use {{ namespacedModel }};', $this->buildImports($model), $stub); diff --git a/src/Generators/MigrationGenerator.php b/src/Generators/MigrationGenerator.php index 6e87f080..c4f15987 100644 --- a/src/Generators/MigrationGenerator.php +++ b/src/Generators/MigrationGenerator.php @@ -2,7 +2,6 @@ namespace Blueprint\Generators; -use Blueprint\Blueprint; use Blueprint\Contracts\Generator; use Blueprint\Models\Model; use Blueprint\Tree; @@ -109,10 +108,6 @@ protected function populateStub(string $stub, Model $model) $stub = str_replace('{{ table }}', $model->tableName(), $stub); $stub = str_replace('{{ definition }}', $this->buildDefinition($model), $stub); - if (Blueprint::useReturnTypeHints()) { - $stub = str_replace(['up()', 'down()'], ['up(): void', 'down(): void'], $stub); - } - if ($this->hasForeignKeyConstraints) { $stub = $this->disableForeignKeyConstraints($stub); } @@ -137,10 +132,6 @@ protected function populatePolyStub(string $stub, string $parentTable) $stub = str_replace('{{ table }}', $this->getPolyTableName($parentTable), $stub); $stub = str_replace('{{ definition }}', $this->buildPolyTableDefinition($parentTable), $stub); - if (Blueprint::useReturnTypeHints()) { - $stub = str_replace(['up()', 'down()'], ['up(): void', 'down(): void'], $stub); - } - if ($this->hasForeignKeyConstraints) { $stub = $this->disableForeignKeyConstraints($stub); } diff --git a/src/Generators/ModelGenerator.php b/src/Generators/ModelGenerator.php index 8660aaa5..95294d33 100644 --- a/src/Generators/ModelGenerator.php +++ b/src/Generators/ModelGenerator.php @@ -2,7 +2,7 @@ namespace Blueprint\Generators; -use Blueprint\Blueprint; +use Blueprint\Concerns\HandlesImports; use Blueprint\Contracts\Generator; use Blueprint\Models\Column; use Blueprint\Models\Model; @@ -11,6 +11,8 @@ class ModelGenerator extends AbstractClassGenerator implements Generator { + use HandlesImports; + protected $types = ['models']; public function output(Tree $tree): array @@ -43,7 +45,9 @@ protected function populateStub(string $stub, Model $model) { if ($model->isPivot()) { $stub = str_replace('class {{ class }} extends Model', 'class {{ class }} extends Pivot', $stub); - $stub = str_replace('use Illuminate\\Database\\Eloquent\\Model;', 'use Illuminate\\Database\\Eloquent\\Relations\\Pivot;', $stub); + $this->addImport($model, 'Illuminate\\Database\\Eloquent\\Relations\\Pivot'); + } else { + $this->addImport($model, 'Illuminate\\Database\\Eloquent\\Model'); } $stub = str_replace('{{ namespace }}', $model->fullyQualifiedNamespace(), $stub); @@ -54,9 +58,11 @@ protected function populateStub(string $stub, Model $model) $body .= PHP_EOL . PHP_EOL; $body .= $this->buildRelationships($model); + $this->addImport($model, 'Illuminate\\Database\\Eloquent\\Factories\\HasFactory'); $stub = str_replace('use HasFactory;', 'use HasFactory;' . PHP_EOL . PHP_EOL . ' ' . trim($body), $stub); $stub = $this->addTraits($model, $stub); + $stub = str_replace('{{ imports }}', $this->buildImports($model), $stub); return $stub; } @@ -161,11 +167,6 @@ protected function buildRelationships(Model $model) { $methods = ''; $template = $this->filesystem->stub('model.method.stub'); - $commentTemplate = ''; - - if (config('blueprint.generate_phpdocs')) { - $commentTemplate = $this->filesystem->stub('model.method.comment.stub'); - } foreach ($model->relationships() as $type => $references) { foreach ($references as $reference) { @@ -250,19 +251,18 @@ protected function buildRelationships(Model $model) $method_name = Str::plural($is_model_fqn ? Str::afterLast($column_name, '\\') : $column_name); } - if (Blueprint::useReturnTypeHints()) { - $custom_template = str_replace( - '{{ method }}()', - '{{ method }}(): ' . Str::of('\Illuminate\Database\Eloquent\Relations\\')->append(Str::studly($type)), - $custom_template - ); - } + $relationship_type = 'Illuminate\\Database\\Eloquent\\Relations\\' . Str::studly($type === 'morphedByMany' ? 'morphToMany' : $type); + $this->addImport($model, $relationship_type); + $custom_template = str_replace( + '{{ method }}()', + '{{ method }}(): ' . Str::afterLast($relationship_type, '\\'), + $custom_template + ); + $method = str_replace('{{ method }}', Str::camel($method_name), $custom_template); $method = str_replace('null', $relationship, $method); - $phpDoc = str_replace('{{ namespacedReturnClass }}', '\Illuminate\Database\Eloquent\Relations\\' . Str::ucfirst($type), $commentTemplate); - - $methods .= $phpDoc . $method . PHP_EOL; + $methods .= $method . PHP_EOL; } } @@ -275,7 +275,7 @@ protected function addTraits(Model $model, $stub) return $stub; } - $stub = str_replace('use Illuminate\\Database\\Eloquent\\Model;', 'use Illuminate\\Database\\Eloquent\\Model;' . PHP_EOL . 'use Illuminate\\Database\\Eloquent\\SoftDeletes;', $stub); + $this->addImport($model, 'Illuminate\\Database\\Eloquent\\SoftDeletes'); $stub = Str::replaceFirst('use HasFactory', 'use HasFactory, SoftDeletes', $stub); return $stub; diff --git a/src/Generators/SeederGenerator.php b/src/Generators/SeederGenerator.php index d3bba85d..b09ef834 100644 --- a/src/Generators/SeederGenerator.php +++ b/src/Generators/SeederGenerator.php @@ -2,7 +2,6 @@ namespace Blueprint\Generators; -use Blueprint\Blueprint; use Blueprint\Concerns\HandlesImports; use Blueprint\Concerns\HandlesTraits; use Blueprint\Contracts\Generator; @@ -48,10 +47,6 @@ protected function populateStub(string $stub, BlueprintModel $model) $stub = str_replace('//', $this->build($model), $stub); $stub = str_replace('use Illuminate\Database\Seeder;', $this->buildImports($model), $stub); - if (Blueprint::useReturnTypeHints()) { - $stub = str_replace('public function run()', 'public function run(): void', $stub); - } - return $stub; } diff --git a/src/Generators/Statements/FormRequestGenerator.php b/src/Generators/Statements/FormRequestGenerator.php index e5a1c610..ee5938f3 100644 --- a/src/Generators/Statements/FormRequestGenerator.php +++ b/src/Generators/Statements/FormRequestGenerator.php @@ -60,10 +60,6 @@ protected function populateStub(string $stub, string $name, $context, ValidateSt $stub = str_replace('{{ class }}', $name, $stub); $stub = str_replace('{{ rules }}', $this->buildRules($context, $validateStatement), $stub); - if (Blueprint::useReturnTypeHints()) { - $stub = str_replace(['authorize()', 'rules()'], ['authorize(): bool', 'rules(): array'], $stub); - } - return $stub; } diff --git a/src/Generators/Statements/JobGenerator.php b/src/Generators/Statements/JobGenerator.php index 0abb6931..e596e201 100644 --- a/src/Generators/Statements/JobGenerator.php +++ b/src/Generators/Statements/JobGenerator.php @@ -50,10 +50,6 @@ protected function populateStub(string $stub, DispatchStatement $dispatchStateme $stub = str_replace('{{ class }}', $dispatchStatement->job(), $stub); $stub = str_replace('{{ properties }}', $this->populateConstructor('job', $dispatchStatement), $stub); - if (Blueprint::useReturnTypeHints()) { - $stub = str_replace('public function handle()', 'public function handle(): void', $stub); - } - return $stub; } } diff --git a/src/Generators/Statements/MailGenerator.php b/src/Generators/Statements/MailGenerator.php index b523ba05..b4214021 100644 --- a/src/Generators/Statements/MailGenerator.php +++ b/src/Generators/Statements/MailGenerator.php @@ -72,10 +72,6 @@ protected function populateStub(string $stub, SendStatement $sendStatement) $stub = str_replace('{{ view }}', $sendStatement->view(), $stub); $stub = str_replace('{{ properties }}', $this->populateConstructor('message', $sendStatement), $stub); - if (Blueprint::useReturnTypeHints()) { - $stub = str_replace('build()', sprintf('build(): %s', $sendStatement->mail()), $stub); - } - return $stub; } } diff --git a/src/Generators/Statements/NotificationGenerator.php b/src/Generators/Statements/NotificationGenerator.php index e3b1fb78..322f6124 100644 --- a/src/Generators/Statements/NotificationGenerator.php +++ b/src/Generators/Statements/NotificationGenerator.php @@ -54,22 +54,6 @@ protected function populateStub(string $stub, SendStatement $sendStatement) $stub = str_replace('{{ class }}', $sendStatement->mail(), $stub); $stub = str_replace('{{ properties }}', $this->populateConstructor('message', $sendStatement), $stub); - if (Blueprint::useReturnTypeHints()) { - $stub = str_replace( - [ - 'via($notifiable)', - 'toMail($notifiable)', - 'toArray($notifiable)', - ], - [ - 'via($notifiable): array', - sprintf('toMail($notifiable): %s', $sendStatement->mail()), - 'toArray($notifiable): array', - ], - $stub - ); - } - return $stub; } } diff --git a/src/Generators/Statements/ResourceGenerator.php b/src/Generators/Statements/ResourceGenerator.php index 6c10cf20..acc1d45b 100644 --- a/src/Generators/Statements/ResourceGenerator.php +++ b/src/Generators/Statements/ResourceGenerator.php @@ -28,7 +28,7 @@ public function output(Tree $tree): array * @var \Blueprint\Models\Controller $controller */ foreach ($tree->controllers() as $controller) { - foreach ($controller->methods() as $method => $statements) { + foreach ($controller->methods() as $statements) { foreach ($statements as $statement) { if (!$statement instanceof ResourceStatement) { continue; @@ -59,18 +59,17 @@ protected function populateStub(string $stub, Controller $controller, ResourceSt . '\\Http\\Resources' . ($controller->namespace() ? '\\' . $controller->namespace() : ''); + $imports = ['use Illuminate\\Http\\Request;']; + $imports[] = $resource->collection() ? 'use Illuminate\\Http\\Resources\\Json\\ResourceCollection;' : 'use Illuminate\\Http\\Resources\\Json\\JsonResource;'; + $stub = str_replace('{{ namespace }}', $namespace, $stub); - $stub = str_replace('{{ import }}', $resource->collection() ? 'Illuminate\\Http\\Resources\\Json\\ResourceCollection' : 'Illuminate\\Http\\Resources\\Json\\JsonResource', $stub); + $stub = str_replace('{{ imports }}', implode(PHP_EOL, $imports), $stub); $stub = str_replace('{{ parentClass }}', $resource->collection() ? 'ResourceCollection' : 'JsonResource', $stub); $stub = str_replace('{{ class }}', $resource->name(), $stub); $stub = str_replace('{{ parentClass }}', $resource->collection() ? 'ResourceCollection' : 'JsonResource', $stub); $stub = str_replace('{{ resource }}', $resource->collection() ? 'resource collection' : 'resource', $stub); $stub = str_replace('{{ body }}', $this->buildData($resource), $stub); - if (Blueprint::useReturnTypeHints()) { - $stub = str_replace('toArray($request)', 'toArray($request): array', $stub); - } - return $stub; } diff --git a/src/Generators/TestGenerator.php b/src/Generators/TestGenerator.php index 02f6d95b..1c23b2e4 100644 --- a/src/Generators/TestGenerator.php +++ b/src/Generators/TestGenerator.php @@ -482,11 +482,6 @@ protected function buildTestCases(Controller $controller) $test_case = str_replace('{{ method }}', $test_case_name, $test_case); $test_case = str_replace('{{ body }}', trim($body), $test_case); - if (Blueprint::useReturnTypeHints()) { - $test_case = str_replace("$test_case_name()", "$test_case_name(): void", $test_case); - $test_case = str_replace('uses_form_request_validation()', 'uses_form_request_validation(): void', $test_case); - } - $test_cases .= PHP_EOL . $test_case . PHP_EOL; } @@ -530,7 +525,7 @@ private function buildFormRequestTestCase(string $controller, string $action, st /** * @test */ - public function ${action}_uses_form_request_validation() + public function ${action}_uses_form_request_validation(): void { \$this->assertActionUsesFormRequest( \\${controller}::class, diff --git a/src/Models/Controller.php b/src/Models/Controller.php index 1fdcb2a9..79c472f1 100644 --- a/src/Models/Controller.php +++ b/src/Models/Controller.php @@ -100,17 +100,11 @@ public function prefix() return $this->name(); } - /** - * @param bool $apiResource - */ public function setApiResource(bool $apiResource) { $this->apiResource = $apiResource; } - /** - * @return bool - */ public function isApiResource(): bool { return $this->apiResource; diff --git a/src/Models/Model.php b/src/Models/Model.php index 5d5e6fa1..4d14cd6e 100644 --- a/src/Models/Model.php +++ b/src/Models/Model.php @@ -31,9 +31,6 @@ class Model implements BlueprintModel private $indexes = []; - /** - * @param $name - */ public function __construct($name) { $this->name = class_basename($name); diff --git a/src/Models/Statements/DispatchStatement.php b/src/Models/Statements/DispatchStatement.php index 8153a3db..9ade1e9e 100644 --- a/src/Models/Statements/DispatchStatement.php +++ b/src/Models/Statements/DispatchStatement.php @@ -25,9 +25,6 @@ public function job() return $this->job; } - /** - * @return array - */ public function data(): array { return $this->data; diff --git a/src/Models/Statements/FireStatement.php b/src/Models/Statements/FireStatement.php index 996f5ed5..c1fa0fd8 100644 --- a/src/Models/Statements/FireStatement.php +++ b/src/Models/Statements/FireStatement.php @@ -25,9 +25,6 @@ public function event() return $this->event; } - /** - * @return array - */ public function data(): array { return $this->data; diff --git a/src/Models/Statements/RedirectStatement.php b/src/Models/Statements/RedirectStatement.php index 7eeee25e..22fc4f64 100644 --- a/src/Models/Statements/RedirectStatement.php +++ b/src/Models/Statements/RedirectStatement.php @@ -27,9 +27,6 @@ public function route() return $this->route; } - /** - * @return array - */ public function data(): array { return $this->data; diff --git a/src/Models/Statements/RenderStatement.php b/src/Models/Statements/RenderStatement.php index 202d0794..8a5a2ddc 100644 --- a/src/Models/Statements/RenderStatement.php +++ b/src/Models/Statements/RenderStatement.php @@ -25,9 +25,6 @@ public function view() return $this->view; } - /** - * @return array - */ public function data(): array { return $this->data; diff --git a/src/Models/Statements/SendStatement.php b/src/Models/Statements/SendStatement.php index 7371f0cc..8ebd4765 100644 --- a/src/Models/Statements/SendStatement.php +++ b/src/Models/Statements/SendStatement.php @@ -61,9 +61,6 @@ public function type() return $this->type; } - /** - * @return array - */ public function data(): array { return $this->data; diff --git a/src/Models/Statements/ValidateStatement.php b/src/Models/Statements/ValidateStatement.php index 78f4ebeb..3ae736c1 100644 --- a/src/Models/Statements/ValidateStatement.php +++ b/src/Models/Statements/ValidateStatement.php @@ -14,9 +14,6 @@ public function __construct(array $data) $this->data = $data; } - /** - * @return array - */ public function data(): array { return $this->data; diff --git a/stubs/constructor.stub b/stubs/constructor.stub index 4b84f690..78dedb20 100644 --- a/stubs/constructor.stub +++ b/stubs/constructor.stub @@ -1,7 +1,5 @@ /** * Create a new {{ type }} instance. - * - * @return void */ public function __construct() { diff --git a/stubs/controller.method.stub b/stubs/controller.method.stub index f27a1f39..1de9f677 100644 --- a/stubs/controller.method.stub +++ b/stubs/controller.method.stub @@ -1,8 +1,4 @@ - /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\Response - */ - public function {{ method }}(Request $request) + public function {{ method }}(Request $request): Response { {{ body }} } diff --git a/stubs/factory.stub b/stubs/factory.stub index e3e1073a..3fef0de9 100644 --- a/stubs/factory.stub +++ b/stubs/factory.stub @@ -17,10 +17,8 @@ class {{ model }}Factory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ // diff --git a/stubs/job.stub b/stubs/job.stub index dfc7a687..9601c08b 100644 --- a/stubs/job.stub +++ b/stubs/job.stub @@ -16,10 +16,8 @@ class {{ class }} implements ShouldQueue /** * Execute the job. - * - * @return void */ - public function handle() + public function handle(): void { // } diff --git a/stubs/mail.stub b/stubs/mail.stub index 908f3134..8a774911 100644 --- a/stubs/mail.stub +++ b/stubs/mail.stub @@ -15,10 +15,8 @@ class {{ class }} extends Mailable /** * Build the message. - * - * @return $this */ - public function build() + public function build(): static { return $this->view('{{ view }}'); } diff --git a/stubs/migration.stub b/stubs/migration.stub index c37d08be..ceb46ad1 100644 --- a/stubs/migration.stub +++ b/stubs/migration.stub @@ -8,10 +8,8 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('{{ table }}', function (Blueprint $table) { {{ definition }} @@ -20,10 +18,8 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('{{ table }}'); } diff --git a/stubs/model.class.stub b/stubs/model.class.stub index 2956d090..f05680a7 100644 --- a/stubs/model.class.stub +++ b/stubs/model.class.stub @@ -2,8 +2,7 @@ namespace {{ namespace }}; -use Illuminate\Database\Eloquent\Factories\HasFactory; -use Illuminate\Database\Eloquent\Model; +{{ imports }} class {{ class }} extends Model { diff --git a/stubs/model.dates.stub b/stubs/model.dates.stub deleted file mode 100644 index 9efcd822..00000000 --- a/stubs/model.dates.stub +++ /dev/null @@ -1,6 +0,0 @@ - /** - * The attributes that should be mutated to dates. - * - * @var array - */ - protected $dates = []; diff --git a/stubs/notification.stub b/stubs/notification.stub index 4a75d8d6..e0644428 100644 --- a/stubs/notification.stub +++ b/stubs/notification.stub @@ -16,22 +16,16 @@ class {{ class }} extends Notification /** * Get the notification's delivery channels. - * - * @param mixed $notifiable - * @return array */ - public function via($notifiable) + public function via(mixed $notifiable): array { return ['mail']; } /** * Get the mail representation of the notification. - * - * @param mixed $notifiable - * @return \Illuminate\Notifications\Messages\MailMessage */ - public function toMail($notifiable) + public function toMail(mixed $notifiable): MailMessage { return (new MailMessage) ->line('The introduction to the notification.') @@ -41,11 +35,8 @@ class {{ class }} extends Notification /** * Get the array representation of the notification. - * - * @param mixed $notifiable - * @return array */ - public function toArray($notifiable) + public function toArray(mixed $notifiable): array { return [ // diff --git a/stubs/request.stub b/stubs/request.stub index 725f9e3d..f841dee1 100644 --- a/stubs/request.stub +++ b/stubs/request.stub @@ -8,20 +8,16 @@ class {{ class }} extends FormRequest { /** * Determine if the user is authorized to make this request. - * - * @return bool */ - public function authorize() + public function authorize(): bool { return true; } /** * Get the validation rules that apply to the request. - * - * @return array */ - public function rules() + public function rules(): array { return [ {{ rules }} diff --git a/stubs/resource.stub b/stubs/resource.stub index 3e9c2604..054bdd33 100644 --- a/stubs/resource.stub +++ b/stubs/resource.stub @@ -2,17 +2,14 @@ namespace {{ namespace }}; -use {{ import }}; +{{ imports }} class {{ class }} extends {{ parentClass }} { /** * Transform the {{ resource }} into an array. - * - * @param \Illuminate\Http\Request $request - * @return array */ - public function toArray($request) + public function toArray(Request $request): array { {{ body }} } diff --git a/stubs/seeder.stub b/stubs/seeder.stub index 5662969c..a77f2b40 100644 --- a/stubs/seeder.stub +++ b/stubs/seeder.stub @@ -8,10 +8,8 @@ class {{ class }} extends Seeder { /** * Run the database seeds. - * - * @return void */ - public function run() + public function run(): void { // } diff --git a/stubs/test.case.stub b/stubs/test.case.stub index 2c5afb1c..642c608d 100644 --- a/stubs/test.case.stub +++ b/stubs/test.case.stub @@ -1,7 +1,7 @@ /** * @test */ - public function {{ method }}() + public function {{ method }}(): void { {{ body }} } diff --git a/tests/Feature/Generators/ControllerGeneratorTest.php b/tests/Feature/Generators/ControllerGeneratorTest.php index 73da3278..5ca7cd14 100644 --- a/tests/Feature/Generators/ControllerGeneratorTest.php +++ b/tests/Feature/Generators/ControllerGeneratorTest.php @@ -49,7 +49,7 @@ public function output_writes_nothing_for_empty_tree() * * @dataProvider controllerTreeDataProvider */ - public function output_writes_migration_for_controller_tree($definition, $path, $controller) + public function output_generates_controllers_for_tree($definition, $path, $controller) { $this->filesystem->expects('stub') ->with('controller.class.stub') @@ -72,7 +72,7 @@ public function output_writes_migration_for_controller_tree($definition, $path, /** * @test */ - public function output_generates_controllers_with_models_with_custom_namespace_correctly() + public function output_generates_controllers_with_models_using_custom_namespace() { $definition = 'drafts/custom-models-namespace.yaml'; $path = 'app/Http/Controllers/TagController.php'; @@ -162,68 +162,6 @@ public function output_respects_configuration() $this->assertEquals(['created' => ['src/path/Other/Http/UserController.php']], $this->subject->output($tree)); } - /** - * @test - */ - public function output_using_return_types() - { - $this->app['config']->set('blueprint.use_return_types', true); - - $this->filesystem->expects('stub') - ->with('controller.class.stub') - ->andReturn($this->stub('controller.class.stub')); - - $this->filesystem->expects('stub') - ->with('controller.method.stub') - ->andReturn($this->stub('controller.method.stub')); - - $this->filesystem->expects('exists') - ->with('app/Http/Controllers') - ->andReturnFalse(); - - $this->filesystem->expects('makeDirectory') - ->with('app/Http/Controllers', 0755, true); - - $this->filesystem->expects('put') - ->with('app/Http/Controllers/TermController.php', $this->fixture('controllers/return-type-declarations.php')); - - $tokens = $this->blueprint->parse($this->fixture('drafts/return-type-declarations.yaml')); - $tree = $this->blueprint->analyze($tokens); - - $this->assertEquals(['created' => ['app/Http/Controllers/TermController.php']], $this->subject->output($tree)); - } - - /** - * @test - */ - public function output_using_return_types_for_api_resource_controller() - { - $this->app['config']->set('blueprint.use_return_types', true); - - $this->filesystem->expects('stub') - ->with('controller.class.stub') - ->andReturn($this->stub('controller.class.stub')); - - $this->filesystem->expects('stub') - ->with('controller.method.stub') - ->andReturn($this->stub('controller.method.stub')); - - $this->filesystem->expects('exists') - ->with('app/Http/Controllers') - ->andReturnFalse(); - - $this->filesystem->expects('makeDirectory') - ->with('app/Http/Controllers', 0755, true); - - $this->filesystem->expects('put') - ->with('app/Http/Controllers/PostController.php', $this->fixture('controllers/return-type-declarations-api-resource.php')); - - $tokens = $this->blueprint->parse($this->fixture('drafts/return-type-declarations-api-controller.yaml')); - $tree = $this->blueprint->analyze($tokens); - - $this->assertEquals(['created' => ['app/Http/Controllers/PostController.php']], $this->subject->output($tree)); - } - public function controllerTreeDataProvider() { return [ @@ -241,31 +179,4 @@ public function controllerTreeDataProvider() ['drafts/invokable-controller-shorthand.yaml', 'app/Http/Controllers/ReportController.php', 'controllers/invokable-controller-shorthand.php'], ]; } - - public function testOutputGeneratesControllersWithTypehints(): void - { - $definition = 'drafts/controller-returns-view-typehint.yaml'; - $path = 'app/Http/Controllers/UserController.php'; - $controller = 'controllers/controller-returns-view-typehint.php'; - - $this->app['config']->set('blueprint.use_return_types', true); - - $this->filesystem->expects('stub') - ->with('controller.class.stub') - ->andReturn($this->stub('controller.class.stub')); - $this->filesystem->expects('stub') - ->with('controller.method.stub') - ->andReturn($this->stub('controller.method.stub')); - - $this->filesystem->expects('exists') - ->with(dirname($path)) - ->andReturnTrue(); - $this->filesystem->expects('put') - ->with($path, $this->fixture($controller)); - - $tokens = $this->blueprint->parse($this->fixture($definition)); - $tree = $this->blueprint->analyze($tokens); - - self::assertSame(['created' => [$path]], $this->subject->output($tree)); - } } diff --git a/tests/Feature/Generators/FactoryGeneratorTest.php b/tests/Feature/Generators/FactoryGeneratorTest.php index bb289a3c..23f27dbd 100644 --- a/tests/Feature/Generators/FactoryGeneratorTest.php +++ b/tests/Feature/Generators/FactoryGeneratorTest.php @@ -93,30 +93,6 @@ public function output_ignores_nullables_if_fake_nullables_configuration_is_set_ $this->assertEquals(['created' => ['database/factories/PostFactory.php']], $this->subject->output($tree)); } - /** - * @test - */ - public function output_using_return_types() - { - $this->app['config']->set('blueprint.use_return_types', true); - - $this->filesystem->expects('stub') - ->with($this->factoryStub) - ->andReturn($this->stub($this->factoryStub)); - - $this->filesystem->expects('exists') - ->with('database/factories') - ->andReturnTrue(); - - $this->filesystem->expects('put') - ->with('database/factories/PostFactory.php', $this->fixture('factories/return-type-declarations.php')); - - $tokens = $this->blueprint->parse($this->fixture('drafts/readme-example.yaml')); - $tree = $this->blueprint->analyze($tokens); - - $this->assertEquals(['created' => ['database/factories/PostFactory.php']], $this->subject->output($tree)); - } - /** * @test */ diff --git a/tests/Feature/Generators/MigrationGeneratorTest.php b/tests/Feature/Generators/MigrationGeneratorTest.php index d5c0826b..2afb9e32 100644 --- a/tests/Feature/Generators/MigrationGeneratorTest.php +++ b/tests/Feature/Generators/MigrationGeneratorTest.php @@ -46,77 +46,6 @@ public function output_writes_nothing_for_empty_tree() $this->assertEquals([], $this->subject->output(new Tree(['models' => []]))); } - /** - * @test - * - * @dataProvider modelTreeDataProvider - */ - public function output_writes_migration_for_model_tree($definition, $path, $migration) - { - if ($migration === 'migrations/return-type-declarations.php') { - $this->app['config']->set('blueprint.use_return_types', true); - } - - $this->filesystem->expects('stub') - ->with('migration.stub') - ->andReturn($this->stub('migration.stub')); - - $now = Carbon::now(); - Carbon::setTestNow($now); - - $timestamp_path = str_replace('timestamp', $now->format('Y_m_d_His'), $path); - - $this->filesystem->expects('exists') - ->with($timestamp_path) - ->andReturn(false); - - $this->filesystem->expects('put') - ->with($timestamp_path, $this->fixture($migration)); - - $tokens = $this->blueprint->parse($this->fixture($definition), $definition !== 'drafts/indexes.yaml'); - $tree = $this->blueprint->analyze($tokens); - - $this->assertEquals(['created' => [$timestamp_path]], $this->subject->output($tree)); - } - - /** - * @test - * - * @dataProvider modelTreeDataProvider - */ - public function output_updates_migration_for_model_tree($definition, $path, $migration) - { - if ($migration === 'migrations/return-type-declarations.php') { - $this->app['config']->set('blueprint.use_return_types', true); - } - - $this->filesystem->expects('stub') - ->with('migration.stub') - ->andReturn($this->stub('migration.stub')); - - $yday = Carbon::yesterday(); - - $yesterday_path = str_replace('timestamp', $yday->format('Y_m_d_His'), $path); - - $this->filesystem->expects('files') - ->with('database/migrations/') - ->andReturn([ - new SplFileInfo($yesterday_path, '', ''), - ]); - - $this->filesystem->expects('exists') - ->with($yesterday_path) - ->andReturn(true); - - $this->filesystem->expects('put') - ->with($yesterday_path, $this->fixture($migration)); - - $tokens = $this->blueprint->parse($this->fixture($definition), $definition !== 'drafts/indexes.yaml'); - $tree = $this->blueprint->analyze($tokens); - - $this->assertEquals(['updated' => [$yesterday_path]], $this->subject->output($tree, true)); - } - /** * @test */ diff --git a/tests/Feature/Generators/ModelGeneratorTest.php b/tests/Feature/Generators/ModelGeneratorTest.php index 22a2430e..f32dcca8 100644 --- a/tests/Feature/Generators/ModelGeneratorTest.php +++ b/tests/Feature/Generators/ModelGeneratorTest.php @@ -48,9 +48,6 @@ public function output_generates_nothing_for_empty_tree() */ public function output_generates_models($definition, $path, $model) { - if ($model === 'models/return-type-declarations.php') { - $this->app['config']->set('blueprint.use_return_types', true); - } $this->filesystem->expects('stub') ->with('model.class.stub') ->andReturn($this->stub('model.class.stub')); @@ -79,10 +76,6 @@ public function output_generates_models($definition, $path, $model) ->with('model.method.stub') ->andReturn($this->stub('model.method.stub')); - $this->filesystem->shouldReceive('stub') - ->with('model.method.comment.stub') - ->andReturn($this->stub('model.method.comment.stub')); - $this->filesystem->expects('exists') ->with(dirname($path)) ->andReturnTrue(); @@ -423,10 +416,6 @@ public function output_generates_phpdoc_for_model($definition, $path, $model) ->with('model.method.stub') ->andReturn($this->stub('model.method.stub')); - $this->filesystem->shouldReceive('stub') - ->with('model.method.comment.stub') - ->andReturn($this->stub('model.method.comment.stub')); - $this->filesystem->expects('exists') ->with(dirname($path)) ->andReturnTrue(); @@ -650,7 +639,6 @@ public function modelTreeDataProvider() ['drafts/resource-statements.yaml', 'app/Models/User.php', 'models/resource-statements.php'], ['drafts/all-column-types.yaml', 'app/Models/AllType.php', 'models/all-column-types.php'], ['drafts/alias-relationships.yaml', 'app/Models/Salesman.php', 'models/alias-relationships.php'], - ['drafts/return-type-declarations.yaml', 'app/Models/Term.php', 'models/return-type-declarations.php'], ['drafts/uuid-shorthand-invalid-relationship.yaml', 'app/Models/AgeCohort.php', 'models/uuid-shorthand-invalid-relationship.php'], ['drafts/model-with-meta.yaml', 'app/Models/Post.php', 'models/model-with-meta.php'], ]; diff --git a/tests/Feature/Generators/SeederGeneratorTest.php b/tests/Feature/Generators/SeederGeneratorTest.php index 90d25822..246720ae 100644 --- a/tests/Feature/Generators/SeederGeneratorTest.php +++ b/tests/Feature/Generators/SeederGeneratorTest.php @@ -65,28 +65,6 @@ public function output_generates_seeders() $this->assertEquals(['created' => ['database/seeders/PostSeeder.php', 'database/seeders/CommentSeeder.php']], $this->subject->output($tree)); } - /** - * @test - */ - public function output_using_return_types() - { - $this->app['config']->set('blueprint.use_return_types', true); - - $this->filesystem->expects('stub') - ->with($this->seederStub) - ->andReturn($this->stub($this->seederStub)); - - $this->filesystem->expects('put') - ->with('database/seeders/PostSeeder.php', $this->fixture('seeders/PostSeeder-return-type-declarations.php')); - $this->filesystem->expects('put') - ->with('database/seeders/CommentSeeder.php', $this->fixture('seeders/CommentSeeder-return-type-declarations.php')); - - $tokens = $this->blueprint->parse($this->fixture('drafts/seeders.yaml')); - $tree = $this->blueprint->analyze($tokens); - - $this->assertEquals(['created' => ['database/seeders/PostSeeder.php', 'database/seeders/CommentSeeder.php']], $this->subject->output($tree)); - } - /** * @test */ diff --git a/tests/Feature/Generators/Statements/FormRequestGeneratorTest.php b/tests/Feature/Generators/Statements/FormRequestGeneratorTest.php index 1356857c..06499f99 100644 --- a/tests/Feature/Generators/Statements/FormRequestGeneratorTest.php +++ b/tests/Feature/Generators/Statements/FormRequestGeneratorTest.php @@ -219,36 +219,6 @@ public function it_respects_configuration() $this->assertEquals(['created' => ['src/path/Http/Requests/PostStoreRequest.php']], $this->subject->output($tree)); } - /** - * @test - */ - public function output_using_return_types() - { - $this->app['config']->set('blueprint.namespace', 'Some\\Other\\App'); - $this->app['config']->set('blueprint.app_path', 'src/path'); - $this->app['config']->set('blueprint.use_return_types', true); - - $this->filesystem->expects('stub') - ->with('request.stub') - ->andReturn($this->stub('request.stub')); - - $this->filesystem->expects('exists') - ->with('src/path/Http/Requests') - ->andReturns(false); - $this->filesystem->expects('exists') - ->with('src/path/Http/Requests/PostStoreRequest.php') - ->andReturnFalse(); - $this->filesystem->expects('makeDirectory') - ->with('src/path/Http/Requests', 0755, true); - $this->filesystem->expects('put') - ->with('src/path/Http/Requests/PostStoreRequest.php', $this->fixture('form-requests/return-type-declarations.php')); - - $tokens = $this->blueprint->parse($this->fixture('drafts/readme-example.yaml')); - $tree = $this->blueprint->analyze($tokens); - - $this->assertEquals(['created' => ['src/path/Http/Requests/PostStoreRequest.php']], $this->subject->output($tree)); - } - /** * @test */ diff --git a/tests/Feature/Generators/Statements/JobGeneratorTest.php b/tests/Feature/Generators/Statements/JobGeneratorTest.php index cc3af2ee..73a2f541 100644 --- a/tests/Feature/Generators/Statements/JobGeneratorTest.php +++ b/tests/Feature/Generators/Statements/JobGeneratorTest.php @@ -124,7 +124,6 @@ public function it_respects_configuration() { $this->app['config']->set('blueprint.namespace', 'Some\\App'); $this->app['config']->set('blueprint.app_path', 'src/path'); - $this->app['config']->set('blueprint.use_return_types', true); $this->filesystem->expects('stub') ->with('job.stub') diff --git a/tests/Feature/Generators/Statements/MailGeneratorTest.php b/tests/Feature/Generators/Statements/MailGeneratorTest.php index 218b21e1..86d9646e 100644 --- a/tests/Feature/Generators/Statements/MailGeneratorTest.php +++ b/tests/Feature/Generators/Statements/MailGeneratorTest.php @@ -199,53 +199,6 @@ public function it_respects_configuration() ], $this->subject->output($tree)); } - /** - * @test - */ - public function output_using_return_types() - { - $this->app['config']->set('blueprint.namespace', 'Some\\Other\\App'); - $this->app['config']->set('blueprint.app_path', 'src/path'); - $this->app['config']->set('blueprint.use_return_types', true); - - $this->filesystem->expects('stub') - ->with('mail.stub') - ->andReturn($this->stub('mail.stub')); - $this->filesystem->expects('stub') - ->with('mail.view.stub') - ->andReturn($this->stub('mail.view.stub')); - $this->filesystem->expects('stub') - ->with('constructor.stub') - ->andReturn($this->stub('constructor.stub')); - $this->filesystem->expects('exists') - ->with('src/path/Mail') - ->andReturnFalse(); - $this->filesystem->expects('exists') - ->with('src/path/Mail/ReviewPost.php') - ->andReturnFalse(); - $this->filesystem->expects('makeDirectory') - ->with('src/path/Mail', 0755, true); - $this->filesystem->expects('put') - ->with('src/path/Mail/ReviewPost.php', $this->fixture('mailables/return-type-declarations.php')); - $this->filesystem->expects('exists') - ->with('resources/views/emails/review-post.blade.php') - ->andReturnFalse(); - $this->filesystem->expects('makeDirectory') - ->with('resources/views/emails', 0755, true); - $this->filesystem->expects('put') - ->with('resources/views/emails/review-post.blade.php', $this->fixture('mailables/review-post-view.blade.php')); - - $tokens = $this->blueprint->parse($this->fixture('drafts/readme-example.yaml')); - $tree = $this->blueprint->analyze($tokens); - - $this->assertEquals([ - 'created' => [ - 'src/path/Mail/ReviewPost.php', - 'resources/views/emails/review-post.blade.php', - ], - ], $this->subject->output($tree)); - } - /** * @test */ diff --git a/tests/Feature/Generators/Statements/NotificationGeneratorTest.php b/tests/Feature/Generators/Statements/NotificationGeneratorTest.php index 6f211a78..7f3d6ca4 100644 --- a/tests/Feature/Generators/Statements/NotificationGeneratorTest.php +++ b/tests/Feature/Generators/Statements/NotificationGeneratorTest.php @@ -157,38 +157,6 @@ public function it_respects_configuration() $this->assertEquals(['created' => ['src/path/Notification/ReviewNotification.php']], $this->subject->output($tree)); } - /** - * @test - */ - public function output_using_return_types() - { - $this->app['config']->set('blueprint.namespace', 'Some\\Other\\App'); - $this->app['config']->set('blueprint.app_path', 'src/path'); - $this->app['config']->set('blueprint.use_return_types', true); - - $this->filesystem->expects('stub') - ->with('notification.stub') - ->andReturn($this->stub('notification.stub')); - $this->filesystem->expects('stub') - ->with('constructor.stub') - ->andReturn($this->stub('constructor.stub')); - $this->filesystem->expects('exists') - ->with('src/path/Notification') - ->andReturnFalse(); - $this->filesystem->expects('exists') - ->with('src/path/Notification/ReviewNotification.php') - ->andReturnFalse(); - $this->filesystem->expects('makeDirectory') - ->with('src/path/Notification', 0755, true); - $this->filesystem->expects('put') - ->with('src/path/Notification/ReviewNotification.php', $this->fixture('notifications/return-type-declarations.php')); - - $tokens = $this->blueprint->parse($this->fixture('drafts/readme-example-notification-facade.yaml')); - $tree = $this->blueprint->analyze($tokens); - - $this->assertEquals(['created' => ['src/path/Notification/ReviewNotification.php']], $this->subject->output($tree)); - } - public function notificationDraftProvider() { return [ diff --git a/tests/Feature/Generators/TestGeneratorTest.php b/tests/Feature/Generators/TestGeneratorTest.php index 93ec9d77..29557be5 100644 --- a/tests/Feature/Generators/TestGeneratorTest.php +++ b/tests/Feature/Generators/TestGeneratorTest.php @@ -187,42 +187,6 @@ public function output_generates_tests_with_models_with_custom_namespace_correct $this->assertEquals(['created' => [$path]], $this->subject->output($tree)); } - /** - * @test - */ - public function output_using_return_types() - { - $definition = 'drafts/readme-example.yaml'; - $path = 'tests/Feature/Http/Controllers/PostControllerTest.php'; - $test = 'tests/return-type-declarations.php'; - - $this->app['config']->set('blueprint.use_return_types', true); - - $this->filesystem->expects('stub') - ->with('test.class.stub') - ->andReturn($this->stub('test.class.stub')); - - $this->filesystem->expects('stub') - ->with('test.case.stub') - ->andReturn($this->stub('test.case.stub')); - - $dirname = dirname($path); - $this->filesystem->expects('exists') - ->with($dirname) - ->andReturnFalse(); - - $this->filesystem->expects('makeDirectory') - ->with($dirname, 0755, true); - - $this->filesystem->expects('put') - ->with($path, $this->fixture($test)); - - $tokens = $this->blueprint->parse($this->fixture($definition)); - $tree = $this->blueprint->analyze($tokens); - - $this->assertEquals(['created' => [$path]], $this->subject->output($tree)); - } - public function controllerTreeDataProvider() { return [ diff --git a/tests/fixtures/controllers/api-resource-pagination.php b/tests/fixtures/controllers/api-resource-pagination.php index d7a86c6b..e1739688 100644 --- a/tests/fixtures/controllers/api-resource-pagination.php +++ b/tests/fixtures/controllers/api-resource-pagination.php @@ -8,59 +8,37 @@ use App\Http\Resources\PostResource; use App\Models\Post; use Illuminate\Http\Request; +use Illuminate\Http\Response; class PostController extends Controller { - /** - * @param \Illuminate\Http\Request $request - * @return \App\Http\Resources\PostCollection - */ - public function index(Request $request) + public function index(Request $request): PostCollection { $posts = Post::paginate(); return new PostCollection($posts); } - /** - * @param \App\Http\Requests\PostStoreRequest $request - * @return \App\Http\Resources\PostResource - */ - public function store(PostStoreRequest $request) + public function store(PostStoreRequest $request): PostResource { $post = Post::create($request->validated()); return new PostResource($post); } - /** - * @param \Illuminate\Http\Request $request - * @param \App\Models\Post $post - * @return \App\Http\Resources\PostResource - */ - public function show(Request $request, Post $post) + public function show(Request $request, Post $post): PostResource { return new PostResource($post); } - /** - * @param \App\Http\Requests\PostUpdateRequest $request - * @param \App\Models\Post $post - * @return \App\Http\Resources\PostResource - */ - public function update(PostUpdateRequest $request, Post $post) + public function update(PostUpdateRequest $request, Post $post): PostResource { $post->update($request->validated()); return new PostResource($post); } - /** - * @param \Illuminate\Http\Request $request - * @param \App\Models\Post $post - * @return \Illuminate\Http\Response - */ - public function destroy(Request $request, Post $post) + public function destroy(Request $request, Post $post): Response { $post->delete(); diff --git a/tests/fixtures/controllers/api-routes-example.php b/tests/fixtures/controllers/api-routes-example.php index a48a9d95..9fc0def9 100644 --- a/tests/fixtures/controllers/api-routes-example.php +++ b/tests/fixtures/controllers/api-routes-example.php @@ -9,59 +9,37 @@ use App\Http\Resources\Api\CertificateResource; use App\Models\Certificate; use Illuminate\Http\Request; +use Illuminate\Http\Response; class CertificateController extends Controller { - /** - * @param \Illuminate\Http\Request $request - * @return \App\Http\Resources\Api\CertificateCollection - */ - public function index(Request $request) + public function index(Request $request): CertificateCollection { $certificates = Certificate::all(); return new CertificateCollection($certificates); } - /** - * @param \App\Http\Requests\Api\CertificateStoreRequest $request - * @return \App\Http\Resources\Api\CertificateResource - */ - public function store(CertificateStoreRequest $request) + public function store(CertificateStoreRequest $request): CertificateResource { $certificate = Certificate::create($request->validated()); return new CertificateResource($certificate); } - /** - * @param \Illuminate\Http\Request $request - * @param \App\Models\Certificate $certificate - * @return \App\Http\Resources\Api\CertificateResource - */ - public function show(Request $request, Certificate $certificate) + public function show(Request $request, Certificate $certificate): CertificateResource { return new CertificateResource($certificate); } - /** - * @param \App\Http\Requests\Api\CertificateUpdateRequest $request - * @param \App\Models\Certificate $certificate - * @return \App\Http\Resources\Api\CertificateResource - */ - public function update(CertificateUpdateRequest $request, Certificate $certificate) + public function update(CertificateUpdateRequest $request, Certificate $certificate): CertificateResource { $certificate->update($request->validated()); return new CertificateResource($certificate); } - /** - * @param \Illuminate\Http\Request $request - * @param \App\Models\Certificate $certificate - * @return \Illuminate\Http\Response - */ - public function destroy(Request $request, Certificate $certificate) + public function destroy(Request $request, Certificate $certificate): Response { $certificate->delete(); diff --git a/tests/fixtures/controllers/certificate-controller.php b/tests/fixtures/controllers/certificate-controller.php index d7f8573c..f7425739 100644 --- a/tests/fixtures/controllers/certificate-controller.php +++ b/tests/fixtures/controllers/certificate-controller.php @@ -8,59 +8,37 @@ use App\Http\Resources\CertificateResource; use App\Models\Certificate; use Illuminate\Http\Request; +use Illuminate\Http\Response; class CertificateController extends Controller { - /** - * @param \Illuminate\Http\Request $request - * @return \App\Http\Resources\CertificateCollection - */ - public function index(Request $request) + public function index(Request $request): CertificateCollection { $certificates = Certificate::all(); return new CertificateCollection($certificates); } - /** - * @param \App\Http\Requests\CertificateStoreRequest $request - * @return \App\Http\Resources\CertificateResource - */ - public function store(CertificateStoreRequest $request) + public function store(CertificateStoreRequest $request): CertificateResource { $certificate = Certificate::create($request->validated()); return new CertificateResource($certificate); } - /** - * @param \Illuminate\Http\Request $request - * @param \App\Models\Certificate $certificate - * @return \App\Http\Resources\CertificateResource - */ - public function show(Request $request, Certificate $certificate) + public function show(Request $request, Certificate $certificate): CertificateResource { return new CertificateResource($certificate); } - /** - * @param \App\Http\Requests\CertificateUpdateRequest $request - * @param \App\Models\Certificate $certificate - * @return \App\Http\Resources\CertificateResource - */ - public function update(CertificateUpdateRequest $request, Certificate $certificate) + public function update(CertificateUpdateRequest $request, Certificate $certificate): CertificateResource { $certificate->update($request->validated()); return new CertificateResource($certificate); } - /** - * @param \Illuminate\Http\Request $request - * @param \App\Models\Certificate $certificate - * @return \Illuminate\Http\Response - */ - public function destroy(Request $request, Certificate $certificate) + public function destroy(Request $request, Certificate $certificate): Response { $certificate->delete(); diff --git a/tests/fixtures/controllers/certificate-type-controller.php b/tests/fixtures/controllers/certificate-type-controller.php index 11db9e19..9acf21f2 100644 --- a/tests/fixtures/controllers/certificate-type-controller.php +++ b/tests/fixtures/controllers/certificate-type-controller.php @@ -8,59 +8,37 @@ use App\Http\Resources\CertificateTypeResource; use App\Models\CertificateType; use Illuminate\Http\Request; +use Illuminate\Http\Response; class CertificateTypeController extends Controller { - /** - * @param \Illuminate\Http\Request $request - * @return \App\Http\Resources\CertificateTypeCollection - */ - public function index(Request $request) + public function index(Request $request): CertificateTypeCollection { $certificateTypes = CertificateType::all(); return new CertificateTypeCollection($certificateTypes); } - /** - * @param \App\Http\Requests\CertificateTypeStoreRequest $request - * @return \App\Http\Resources\CertificateTypeResource - */ - public function store(CertificateTypeStoreRequest $request) + public function store(CertificateTypeStoreRequest $request): CertificateTypeResource { $certificateType = CertificateType::create($request->validated()); return new CertificateTypeResource($certificateType); } - /** - * @param \Illuminate\Http\Request $request - * @param \App\Models\CertificateType $certificateType - * @return \App\Http\Resources\CertificateTypeResource - */ - public function show(Request $request, CertificateType $certificateType) + public function show(Request $request, CertificateType $certificateType): CertificateTypeResource { return new CertificateTypeResource($certificateType); } - /** - * @param \App\Http\Requests\CertificateTypeUpdateRequest $request - * @param \App\Models\CertificateType $certificateType - * @return \App\Http\Resources\CertificateTypeResource - */ - public function update(CertificateTypeUpdateRequest $request, CertificateType $certificateType) + public function update(CertificateTypeUpdateRequest $request, CertificateType $certificateType): CertificateTypeResource { $certificateType->update($request->validated()); return new CertificateTypeResource($certificateType); } - /** - * @param \Illuminate\Http\Request $request - * @param \App\Models\CertificateType $certificateType - * @return \Illuminate\Http\Response - */ - public function destroy(Request $request, CertificateType $certificateType) + public function destroy(Request $request, CertificateType $certificateType): Response { $certificateType->delete(); diff --git a/tests/fixtures/controllers/controller-configured.php b/tests/fixtures/controllers/controller-configured.php index 582c32b3..614237b4 100644 --- a/tests/fixtures/controllers/controller-configured.php +++ b/tests/fixtures/controllers/controller-configured.php @@ -3,28 +3,22 @@ namespace Some\App\Other\Http; use App\Http\Controllers\Controller; +use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; +use Illuminate\View\View; use Some\App\Http\Requests\UserStoreRequest; use Some\App\User; class UserController extends Controller { - /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\Response - */ - public function index(Request $request) + public function index(Request $request): View { $users = User::all(); return view('user.index', compact('users')); } - /** - * @param \Some\App\Http\Requests\UserStoreRequest $request - * @return \Illuminate\Http\Response - */ - public function store(UserStoreRequest $request) + public function store(UserStoreRequest $request): RedirectResponse { $user = User::create($request->validated()); diff --git a/tests/fixtures/controllers/controller-returns-view-typehint.php b/tests/fixtures/controllers/controller-returns-view-typehint.php deleted file mode 100644 index b64d70d9..00000000 --- a/tests/fixtures/controllers/controller-returns-view-typehint.php +++ /dev/null @@ -1,90 +0,0 @@ -validated()); - - $request->session()->flash('user.id', $user->id); - - return redirect()->route('user.index'); - } - - /** - * @param \Illuminate\Http\Request $request - * @param \App\Models\User $user - * @return \Illuminate\View\View - */ - public function show(Request $request, User $user): \Illuminate\View\View - { - return view('user.show', compact('user')); - } - - /** - * @param \Illuminate\Http\Request $request - * @param \App\Models\User $user - * @return \Illuminate\View\View - */ - public function edit(Request $request, User $user): \Illuminate\View\View - { - return view('user.edit', compact('user')); - } - - /** - * @param \App\Http\Requests\UserUpdateRequest $request - * @param \App\Models\User $user - * @return \Illuminate\Routing\Redirector - */ - public function update(UserUpdateRequest $request, User $user): \Illuminate\Routing\Redirector - { - $user->update($request->validated()); - - $request->session()->flash('user.id', $user->id); - - return redirect()->route('user.index'); - } - - /** - * @param \Illuminate\Http\Request $request - * @param \App\Models\User $user - * @return \Illuminate\Routing\Redirector - */ - public function destroy(Request $request, User $user): \Illuminate\Routing\Redirector - { - $user->delete(); - - return redirect()->route('user.index'); - } -} diff --git a/tests/fixtures/controllers/crazy-eloquent.php b/tests/fixtures/controllers/crazy-eloquent.php index 27e6525a..f1accfb7 100644 --- a/tests/fixtures/controllers/crazy-eloquent.php +++ b/tests/fixtures/controllers/crazy-eloquent.php @@ -3,39 +3,27 @@ namespace App\Http\Controllers; use App\Models\Post; +use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; +use Illuminate\View\View; class PostController extends Controller { - /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\Response - */ - public function index(Request $request) + public function index(Request $request): View { $posts = Post::where('title', $title)->where('content', $content)->orderBy('published_at')->limit(5)->get(); return view('post.index', compact('posts')); } - /** - * @param \Illuminate\Http\Request $request - * @param \App\Models\Post $post - * @return \Illuminate\Http\Response - */ - public function edit(Request $request, Post $post) + public function edit(Request $request, Post $post): View { $post = Post::find($id); return view('post.edit', compact('post')); } - /** - * @param \Illuminate\Http\Request $request - * @param \App\Models\Post $post - * @return \Illuminate\Http\Response - */ - public function update(Request $request, Post $post) + public function update(Request $request, Post $post): RedirectResponse { $post = Post::find($id); diff --git a/tests/fixtures/controllers/custom-models-namespace.php b/tests/fixtures/controllers/custom-models-namespace.php index eb97c6c1..b02c34f2 100644 --- a/tests/fixtures/controllers/custom-models-namespace.php +++ b/tests/fixtures/controllers/custom-models-namespace.php @@ -8,59 +8,37 @@ use App\Http\Resources\TagResource; use App\Models\Tag; use Illuminate\Http\Request; +use Illuminate\Http\Response; class TagController extends Controller { - /** - * @param \Illuminate\Http\Request $request - * @return \App\Http\Resources\TagCollection - */ - public function index(Request $request) + public function index(Request $request): TagCollection { $tags = Tag::all(); return new TagCollection($tags); } - /** - * @param \App\Http\Requests\TagStoreRequest $request - * @return \App\Http\Resources\TagResource - */ - public function store(TagStoreRequest $request) + public function store(TagStoreRequest $request): TagResource { $tag = Tag::create($request->validated()); return new TagResource($tag); } - /** - * @param \Illuminate\Http\Request $request - * @param \App\Models\Tag $tag - * @return \App\Http\Resources\TagResource - */ - public function show(Request $request, Tag $tag) + public function show(Request $request, Tag $tag): TagResource { return new TagResource($tag); } - /** - * @param \App\Http\Requests\TagUpdateRequest $request - * @param \App\Models\Tag $tag - * @return \App\Http\Resources\TagResource - */ - public function update(TagUpdateRequest $request, Tag $tag) + public function update(TagUpdateRequest $request, Tag $tag): TagResource { $tag->update($request->validated()); return new TagResource($tag); } - /** - * @param \Illuminate\Http\Request $request - * @param \App\Models\Tag $tag - * @return \Illuminate\Http\Response - */ - public function destroy(Request $request, Tag $tag) + public function destroy(Request $request, Tag $tag): Response { $tag->delete(); diff --git a/tests/fixtures/controllers/invokable-controller-shorthand.php b/tests/fixtures/controllers/invokable-controller-shorthand.php index d5ba6ad1..8724733d 100644 --- a/tests/fixtures/controllers/invokable-controller-shorthand.php +++ b/tests/fixtures/controllers/invokable-controller-shorthand.php @@ -3,14 +3,11 @@ namespace App\Http\Controllers; use Illuminate\Http\Request; +use Illuminate\View\View; class ReportController extends Controller { - /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\Response - */ - public function __invoke(Request $request) + public function __invoke(Request $request): View { return view('report'); } diff --git a/tests/fixtures/controllers/invokable-controller.php b/tests/fixtures/controllers/invokable-controller.php index 91125faf..7d6cb0a0 100644 --- a/tests/fixtures/controllers/invokable-controller.php +++ b/tests/fixtures/controllers/invokable-controller.php @@ -4,14 +4,11 @@ use App\Events\ReportGenerated; use Illuminate\Http\Request; +use Illuminate\View\View; class ReportController extends Controller { - /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\Response - */ - public function __invoke(Request $request) + public function __invoke(Request $request): View { event(new ReportGenerated()); diff --git a/tests/fixtures/controllers/nested-components.php b/tests/fixtures/controllers/nested-components.php index d66b9fde..3b2c9a84 100644 --- a/tests/fixtures/controllers/nested-components.php +++ b/tests/fixtures/controllers/nested-components.php @@ -8,27 +8,21 @@ use App\Jobs\BuildAccount; use App\Models\Admin\User; use App\Notification\InviteNotification; +use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Support\Facades\Notification; +use Illuminate\View\View; class UserController extends Controller { - /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\Response - */ - public function index(Request $request) + public function index(Request $request): View { $users = User::all(); return view('admin.user.index', compact('users')); } - /** - * @param \App\Http\Requests\Admin\UserStoreRequest $request - * @return \Illuminate\Http\Response - */ - public function store(UserStoreRequest $request) + public function store(UserStoreRequest $request): RedirectResponse { $user = User::create($request->validated()); diff --git a/tests/fixtures/controllers/readme-example-notification-facade.php b/tests/fixtures/controllers/readme-example-notification-facade.php index 35fafaf5..65363cc6 100644 --- a/tests/fixtures/controllers/readme-example-notification-facade.php +++ b/tests/fixtures/controllers/readme-example-notification-facade.php @@ -7,27 +7,21 @@ use App\Jobs\SyncMedia; use App\Models\Post; use App\Notification\ReviewNotification; +use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Support\Facades\Notification; +use Illuminate\View\View; class PostController extends Controller { - /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\Response - */ - public function index(Request $request) + public function index(Request $request): View { $posts = Post::all(); return view('post.index', compact('posts')); } - /** - * @param \App\Http\Requests\PostStoreRequest $request - * @return \Illuminate\Http\Response - */ - public function store(PostStoreRequest $request) + public function store(PostStoreRequest $request): RedirectResponse { $post = Post::create($request->validated()); diff --git a/tests/fixtures/controllers/readme-example-notification-model.php b/tests/fixtures/controllers/readme-example-notification-model.php index 1b4d7498..839bde09 100644 --- a/tests/fixtures/controllers/readme-example-notification-model.php +++ b/tests/fixtures/controllers/readme-example-notification-model.php @@ -6,26 +6,20 @@ use App\Http\Requests\PostStoreRequest; use App\Jobs\SyncMedia; use App\Models\Post; +use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; +use Illuminate\View\View; class PostController extends Controller { - /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\Response - */ - public function index(Request $request) + public function index(Request $request): View { $posts = Post::all(); return view('post.index', compact('posts')); } - /** - * @param \App\Http\Requests\PostStoreRequest $request - * @return \Illuminate\Http\Response - */ - public function store(PostStoreRequest $request) + public function store(PostStoreRequest $request): RedirectResponse { $post = Post::create($request->validated()); diff --git a/tests/fixtures/controllers/readme-example.php b/tests/fixtures/controllers/readme-example.php index 77d52891..f551a762 100644 --- a/tests/fixtures/controllers/readme-example.php +++ b/tests/fixtures/controllers/readme-example.php @@ -7,27 +7,21 @@ use App\Jobs\SyncMedia; use App\Mail\ReviewPost; use App\Models\Post; +use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Support\Facades\Mail; +use Illuminate\View\View; class PostController extends Controller { - /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\Response - */ - public function index(Request $request) + public function index(Request $request): View { $posts = Post::all(); return view('post.index', compact('posts')); } - /** - * @param \App\Http\Requests\PostStoreRequest $request - * @return \Illuminate\Http\Response - */ - public function store(PostStoreRequest $request) + public function store(PostStoreRequest $request): RedirectResponse { $post = Post::create($request->validated()); diff --git a/tests/fixtures/controllers/resource-statements.php b/tests/fixtures/controllers/resource-statements.php index 5b328d61..b47ea7b9 100644 --- a/tests/fixtures/controllers/resource-statements.php +++ b/tests/fixtures/controllers/resource-statements.php @@ -9,41 +9,24 @@ class UserController extends Controller { - /** - * @param \Illuminate\Http\Request $request - * @return \App\Http\Resources\UserCollection - */ - public function index(Request $request) + public function index(Request $request): UserCollection { $users = User::paginate(); return new UserCollection($users); } - /** - * @param \Illuminate\Http\Request $request - * @return \App\Http\Resources\UserResource - */ - public function store(Request $request) + public function store(Request $request): UserResource { return new UserResource($user); } - /** - * @param \Illuminate\Http\Request $request - * @param \App\Models\User $user - * @return \App\Http\Resources\UserResource - */ - public function show(Request $request, User $user) + public function show(Request $request, User $user): UserResource { return new UserResource($user); } - /** - * @param \Illuminate\Http\Request $request - * @return \App\Http\Resources\UserCollection - */ - public function all(Request $request) + public function all(Request $request): UserCollection { return new UserCollection($users); } diff --git a/tests/fixtures/controllers/respond-statements.php b/tests/fixtures/controllers/respond-statements.php index 4847a9c5..79c2509b 100644 --- a/tests/fixtures/controllers/respond-statements.php +++ b/tests/fixtures/controllers/respond-statements.php @@ -6,13 +6,10 @@ use App\Http\Requests\Api\PostStoreRequest; use App\Models\Post; use Illuminate\Http\Request; +use Illuminate\Http\Response; class PostController extends Controller { - /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\Response - */ public function index(Request $request) { $posts = Post::all(); @@ -20,20 +17,12 @@ public function index(Request $request) return $posts; } - /** - * @param \App\Http\Requests\Api\PostStoreRequest $request - * @return \Illuminate\Http\Response - */ - public function store(PostStoreRequest $request) + public function store(PostStoreRequest $request): Response { return response()->noContent(); } - /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\Response - */ - public function error(Request $request) + public function error(Request $request): Response { return response()->noContent(400); } diff --git a/tests/fixtures/controllers/return-type-declarations-api-resource.php b/tests/fixtures/controllers/return-type-declarations-api-resource.php deleted file mode 100644 index b2dca451..00000000 --- a/tests/fixtures/controllers/return-type-declarations-api-resource.php +++ /dev/null @@ -1,69 +0,0 @@ -validated()); - - return new PostResource($post); - } - - /** - * @param \Illuminate\Http\Request $request - * @param \App\Models\Post $post - * @return \App\Http\Resources\PostResource - */ - public function show(Request $request, Post $post): \App\Http\Resources\PostResource - { - return new PostResource($post); - } - - /** - * @param \App\Http\Requests\PostUpdateRequest $request - * @param \App\Models\Post $post - * @return \App\Http\Resources\PostResource - */ - public function update(PostUpdateRequest $request, Post $post): \App\Http\Resources\PostResource - { - $post->update($request->validated()); - - return new PostResource($post); - } - - /** - * @param \Illuminate\Http\Request $request - * @param \App\Models\Post $post - * @return \Illuminate\Http\Response - */ - public function destroy(Request $request, Post $post): \Illuminate\Http\Response - { - $post->delete(); - - return response()->noContent(); - } -} diff --git a/tests/fixtures/controllers/return-type-declarations.php b/tests/fixtures/controllers/return-type-declarations.php deleted file mode 100644 index 9ad6ef8a..00000000 --- a/tests/fixtures/controllers/return-type-declarations.php +++ /dev/null @@ -1,90 +0,0 @@ -validated()); - - $request->session()->flash('term.id', $term->id); - - return redirect()->route('term.index'); - } - - /** - * @param \Illuminate\Http\Request $request - * @param \App\Models\Term $term - * @return \Illuminate\View\View - */ - public function show(Request $request, Term $term): \Illuminate\View\View - { - return view('term.show', compact('term')); - } - - /** - * @param \Illuminate\Http\Request $request - * @param \App\Models\Term $term - * @return \Illuminate\View\View - */ - public function edit(Request $request, Term $term): \Illuminate\View\View - { - return view('term.edit', compact('term')); - } - - /** - * @param \App\Http\Requests\TermUpdateRequest $request - * @param \App\Models\Term $term - * @return \Illuminate\Routing\Redirector - */ - public function update(TermUpdateRequest $request, Term $term): \Illuminate\Routing\Redirector - { - $term->update($request->validated()); - - $request->session()->flash('term.id', $term->id); - - return redirect()->route('term.index'); - } - - /** - * @param \Illuminate\Http\Request $request - * @param \App\Models\Term $term - * @return \Illuminate\Routing\Redirector - */ - public function destroy(Request $request, Term $term): \Illuminate\Routing\Redirector - { - $term->delete(); - - return redirect()->route('term.index'); - } -} diff --git a/tests/fixtures/controllers/save-without-validation.php b/tests/fixtures/controllers/save-without-validation.php index 91240c96..ccce1b2d 100644 --- a/tests/fixtures/controllers/save-without-validation.php +++ b/tests/fixtures/controllers/save-without-validation.php @@ -3,15 +3,12 @@ namespace App\Http\Controllers; use App\Models\Post; +use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; class PostController extends Controller { - /** - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\Response - */ - public function store(Request $request) + public function store(Request $request): RedirectResponse { $post = Post::create($request->all()); diff --git a/tests/fixtures/drafts/controller-returns-view-typehint.yaml b/tests/fixtures/drafts/controller-returns-view-typehint.yaml deleted file mode 100644 index 1087b8e9..00000000 --- a/tests/fixtures/drafts/controller-returns-view-typehint.yaml +++ /dev/null @@ -1,12 +0,0 @@ -models: - User: - name: string - email: string unique - email_verified_at: datetime nullable - password: string - remember_token: rememberToken - softDeletes - -controllers: - User: - resource diff --git a/tests/fixtures/drafts/return-type-declarations-api-controller.yaml b/tests/fixtures/drafts/return-type-declarations-api-controller.yaml deleted file mode 100644 index c8c2cb12..00000000 --- a/tests/fixtures/drafts/return-type-declarations-api-controller.yaml +++ /dev/null @@ -1,11 +0,0 @@ -models: - Post: - title: string - body: text -controllers: - Post: - resource: api - index: - query: all - resource: 'paginate:posts' -seeders: Post diff --git a/tests/fixtures/drafts/return-type-declarations.yaml b/tests/fixtures/drafts/return-type-declarations.yaml deleted file mode 100644 index 3996e6ca..00000000 --- a/tests/fixtures/drafts/return-type-declarations.yaml +++ /dev/null @@ -1,17 +0,0 @@ -models: - Term: - uuid: string unique - name: json - description: json nullable - meta: json nullable - user_id: id nullable foreign onDelete:null onUpdate:cascade - team_id: id foreign onDelete:cascade onUpdate:cascade - published: boolean default:1 - type: string nullable default:booking - softDeletes - relationships: - belongsToMany: Organizer, Event - -controllers: - Term: - resource \ No newline at end of file diff --git a/tests/fixtures/events/event-configured.php b/tests/fixtures/events/event-configured.php index b107b966..b95198a1 100644 --- a/tests/fixtures/events/event-configured.php +++ b/tests/fixtures/events/event-configured.php @@ -12,8 +12,6 @@ class NewPost /** * Create a new event instance. - * - * @return void */ public function __construct($post) { diff --git a/tests/fixtures/events/user-created.php b/tests/fixtures/events/user-created.php index 2c1bb3ba..b8db78b6 100644 --- a/tests/fixtures/events/user-created.php +++ b/tests/fixtures/events/user-created.php @@ -12,8 +12,6 @@ class UserCreated /** * Create a new event instance. - * - * @return void */ public function __construct($user) { diff --git a/tests/fixtures/events/user-deleted.php b/tests/fixtures/events/user-deleted.php index cee72f7f..35a0d6de 100644 --- a/tests/fixtures/events/user-deleted.php +++ b/tests/fixtures/events/user-deleted.php @@ -10,8 +10,6 @@ class UserDeleted /** * Create a new event instance. - * - * @return void */ public function __construct() { diff --git a/tests/fixtures/factories/all-column-types.php b/tests/fixtures/factories/all-column-types.php index 9c85b110..03957a56 100644 --- a/tests/fixtures/factories/all-column-types.php +++ b/tests/fixtures/factories/all-column-types.php @@ -17,10 +17,8 @@ class AllTypeFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'bigInteger' => $this->faker->numberBetween(-100000, 100000), diff --git a/tests/fixtures/factories/factory-smallint-and-tinyint.php b/tests/fixtures/factories/factory-smallint-and-tinyint.php index 536f192f..2175e334 100644 --- a/tests/fixtures/factories/factory-smallint-and-tinyint.php +++ b/tests/fixtures/factories/factory-smallint-and-tinyint.php @@ -17,10 +17,8 @@ class ModelFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'market_type' => $this->faker->numberBetween(-8, 8), diff --git a/tests/fixtures/factories/fake-nullables.php b/tests/fixtures/factories/fake-nullables.php index 52de5167..c74ff798 100644 --- a/tests/fixtures/factories/fake-nullables.php +++ b/tests/fixtures/factories/fake-nullables.php @@ -18,10 +18,8 @@ class PostFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'title' => $this->faker->sentence(4), diff --git a/tests/fixtures/factories/foreign-key-shorthand.php b/tests/fixtures/factories/foreign-key-shorthand.php index 4bac1d18..2002eeb3 100644 --- a/tests/fixtures/factories/foreign-key-shorthand.php +++ b/tests/fixtures/factories/foreign-key-shorthand.php @@ -20,10 +20,8 @@ class CommentFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'post_id' => Post::factory(), diff --git a/tests/fixtures/factories/model-key-constraints.php b/tests/fixtures/factories/model-key-constraints.php index de624e3d..b1923670 100644 --- a/tests/fixtures/factories/model-key-constraints.php +++ b/tests/fixtures/factories/model-key-constraints.php @@ -19,10 +19,8 @@ class OrderFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'user_id' => User::factory(), diff --git a/tests/fixtures/factories/model-modifiers.php b/tests/fixtures/factories/model-modifiers.php index e73aa827..59ea9e47 100644 --- a/tests/fixtures/factories/model-modifiers.php +++ b/tests/fixtures/factories/model-modifiers.php @@ -17,10 +17,8 @@ class ModifierFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'title' => $this->faker->sentence(4), diff --git a/tests/fixtures/factories/nested-components.php b/tests/fixtures/factories/nested-components.php index 8254e8ee..03f5e69b 100644 --- a/tests/fixtures/factories/nested-components.php +++ b/tests/fixtures/factories/nested-components.php @@ -17,10 +17,8 @@ class UserFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'name' => $this->faker->name, diff --git a/tests/fixtures/factories/nested-models.php b/tests/fixtures/factories/nested-models.php index f269c8ec..c04bc0b6 100644 --- a/tests/fixtures/factories/nested-models.php +++ b/tests/fixtures/factories/nested-models.php @@ -20,10 +20,8 @@ class ScreeningQuestionFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'report_id' => Report::factory(), diff --git a/tests/fixtures/factories/phone.php b/tests/fixtures/factories/phone.php index 3b5ad3a7..49954f0f 100644 --- a/tests/fixtures/factories/phone.php +++ b/tests/fixtures/factories/phone.php @@ -18,10 +18,8 @@ class PhoneFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'label' => $this->faker->word, diff --git a/tests/fixtures/factories/post-configured.php b/tests/fixtures/factories/post-configured.php index fb305a49..36c62aa0 100644 --- a/tests/fixtures/factories/post-configured.php +++ b/tests/fixtures/factories/post-configured.php @@ -18,10 +18,8 @@ class PostFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'title' => $this->faker->sentence(4), diff --git a/tests/fixtures/factories/post.php b/tests/fixtures/factories/post.php index 9330455c..c5e24cfc 100644 --- a/tests/fixtures/factories/post.php +++ b/tests/fixtures/factories/post.php @@ -18,10 +18,8 @@ class PostFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'title' => $this->faker->sentence(4), diff --git a/tests/fixtures/factories/resource-statements.php b/tests/fixtures/factories/resource-statements.php index b7b2318a..c5e3341e 100644 --- a/tests/fixtures/factories/resource-statements.php +++ b/tests/fixtures/factories/resource-statements.php @@ -17,10 +17,8 @@ class UserFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'name' => $this->faker->name, diff --git a/tests/fixtures/factories/return-type-declarations.php b/tests/fixtures/factories/return-type-declarations.php deleted file mode 100644 index ad30c351..00000000 --- a/tests/fixtures/factories/return-type-declarations.php +++ /dev/null @@ -1,33 +0,0 @@ - $this->faker->sentence(4), - 'content' => $this->faker->paragraphs(3, true), - 'published_at' => $this->faker->dateTime(), - 'author_id' => User::factory(), - ]; - } -} diff --git a/tests/fixtures/factories/shorthands.php b/tests/fixtures/factories/shorthands.php index c60a3386..f3e46431 100644 --- a/tests/fixtures/factories/shorthands.php +++ b/tests/fixtures/factories/shorthands.php @@ -17,10 +17,8 @@ class NameFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ // diff --git a/tests/fixtures/factories/team.php b/tests/fixtures/factories/team.php index 7576e157..b2505fee 100644 --- a/tests/fixtures/factories/team.php +++ b/tests/fixtures/factories/team.php @@ -18,10 +18,8 @@ class TeamFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'name' => $this->faker->name, diff --git a/tests/fixtures/factories/unconventional-foreign-key.php b/tests/fixtures/factories/unconventional-foreign-key.php index b74ad703..c514835b 100644 --- a/tests/fixtures/factories/unconventional-foreign-key.php +++ b/tests/fixtures/factories/unconventional-foreign-key.php @@ -18,10 +18,8 @@ class StateFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'name' => $this->faker->name, diff --git a/tests/fixtures/factories/unconventional.php b/tests/fixtures/factories/unconventional.php index 98561f46..c6ab039c 100644 --- a/tests/fixtures/factories/unconventional.php +++ b/tests/fixtures/factories/unconventional.php @@ -19,10 +19,8 @@ class TeamFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'name' => $this->faker->name, diff --git a/tests/fixtures/form-requests/certificate-store.php b/tests/fixtures/form-requests/certificate-store.php index 5b3d7191..4d715134 100644 --- a/tests/fixtures/form-requests/certificate-store.php +++ b/tests/fixtures/form-requests/certificate-store.php @@ -8,20 +8,16 @@ class CertificateStoreRequest extends FormRequest { /** * Determine if the user is authorized to make this request. - * - * @return bool */ - public function authorize() + public function authorize(): bool { return true; } /** * Get the validation rules that apply to the request. - * - * @return array */ - public function rules() + public function rules(): array { return [ 'name' => ['required', 'string'], diff --git a/tests/fixtures/form-requests/certificate-update.php b/tests/fixtures/form-requests/certificate-update.php index ea7364f1..149c55fe 100644 --- a/tests/fixtures/form-requests/certificate-update.php +++ b/tests/fixtures/form-requests/certificate-update.php @@ -8,20 +8,16 @@ class CertificateUpdateRequest extends FormRequest { /** * Determine if the user is authorized to make this request. - * - * @return bool */ - public function authorize() + public function authorize(): bool { return true; } /** * Get the validation rules that apply to the request. - * - * @return array */ - public function rules() + public function rules(): array { return [ 'name' => ['required', 'string'], diff --git a/tests/fixtures/form-requests/form-request-configured.php b/tests/fixtures/form-requests/form-request-configured.php index 9bf452e1..bf0cda92 100644 --- a/tests/fixtures/form-requests/form-request-configured.php +++ b/tests/fixtures/form-requests/form-request-configured.php @@ -8,20 +8,16 @@ class PostStoreRequest extends FormRequest { /** * Determine if the user is authorized to make this request. - * - * @return bool */ - public function authorize() + public function authorize(): bool { return true; } /** * Get the validation rules that apply to the request. - * - * @return array */ - public function rules() + public function rules(): array { return [ 'title' => ['required', 'string', 'max:400'], diff --git a/tests/fixtures/form-requests/form-requests-softdeletes.php b/tests/fixtures/form-requests/form-requests-softdeletes.php index fbd1ebb9..0d0b3f52 100644 --- a/tests/fixtures/form-requests/form-requests-softdeletes.php +++ b/tests/fixtures/form-requests/form-requests-softdeletes.php @@ -8,20 +8,16 @@ class ProjectStoreRequest extends FormRequest { /** * Determine if the user is authorized to make this request. - * - * @return bool */ - public function authorize() + public function authorize(): bool { return true; } /** * Get the validation rules that apply to the request. - * - * @return array */ - public function rules() + public function rules(): array { return [ 'title' => ['required', 'string'], diff --git a/tests/fixtures/form-requests/form-requests-softdeletestz.php b/tests/fixtures/form-requests/form-requests-softdeletestz.php index 6291d9a1..7ec26997 100644 --- a/tests/fixtures/form-requests/form-requests-softdeletestz.php +++ b/tests/fixtures/form-requests/form-requests-softdeletestz.php @@ -8,20 +8,16 @@ class RepoUpdateRequest extends FormRequest { /** * Determine if the user is authorized to make this request. - * - * @return bool */ - public function authorize() + public function authorize(): bool { return true; } /** * Get the validation rules that apply to the request. - * - * @return array */ - public function rules() + public function rules(): array { return [ 'title' => ['required', 'string'], diff --git a/tests/fixtures/form-requests/nested-components.php b/tests/fixtures/form-requests/nested-components.php index 6932e358..3521f3d3 100644 --- a/tests/fixtures/form-requests/nested-components.php +++ b/tests/fixtures/form-requests/nested-components.php @@ -8,20 +8,16 @@ class UserStoreRequest extends FormRequest { /** * Determine if the user is authorized to make this request. - * - * @return bool */ - public function authorize() + public function authorize(): bool { return true; } /** * Get the validation rules that apply to the request. - * - * @return array */ - public function rules() + public function rules(): array { return [ 'name' => ['required', 'string'], diff --git a/tests/fixtures/form-requests/other-store.php b/tests/fixtures/form-requests/other-store.php index 8bb4c35a..fe999629 100644 --- a/tests/fixtures/form-requests/other-store.php +++ b/tests/fixtures/form-requests/other-store.php @@ -8,20 +8,16 @@ class OtherStoreRequest extends FormRequest { /** * Determine if the user is authorized to make this request. - * - * @return bool */ - public function authorize() + public function authorize(): bool { return true; } /** * Get the validation rules that apply to the request. - * - * @return array */ - public function rules() + public function rules(): array { return [ 'field' => ['required'], diff --git a/tests/fixtures/form-requests/post-index.php b/tests/fixtures/form-requests/post-index.php index 4cad4c7f..46f2fb4d 100644 --- a/tests/fixtures/form-requests/post-index.php +++ b/tests/fixtures/form-requests/post-index.php @@ -8,20 +8,16 @@ class PostIndexRequest extends FormRequest { /** * Determine if the user is authorized to make this request. - * - * @return bool */ - public function authorize() + public function authorize(): bool { return true; } /** * Get the validation rules that apply to the request. - * - * @return array */ - public function rules() + public function rules(): array { return [ 'title' => ['required', 'string', 'max:400'], diff --git a/tests/fixtures/form-requests/post-store.php b/tests/fixtures/form-requests/post-store.php index 51ae7d02..802a89af 100644 --- a/tests/fixtures/form-requests/post-store.php +++ b/tests/fixtures/form-requests/post-store.php @@ -8,20 +8,16 @@ class PostStoreRequest extends FormRequest { /** * Determine if the user is authorized to make this request. - * - * @return bool */ - public function authorize() + public function authorize(): bool { return true; } /** * Get the validation rules that apply to the request. - * - * @return array */ - public function rules() + public function rules(): array { return [ 'title' => ['required', 'string', 'max:400'], diff --git a/tests/fixtures/form-requests/reference-cache.php b/tests/fixtures/form-requests/reference-cache.php index 7252bd1b..38e85245 100644 --- a/tests/fixtures/form-requests/reference-cache.php +++ b/tests/fixtures/form-requests/reference-cache.php @@ -8,20 +8,16 @@ class UserStoreRequest extends FormRequest { /** * Determine if the user is authorized to make this request. - * - * @return bool */ - public function authorize() + public function authorize(): bool { return true; } /** * Get the validation rules that apply to the request. - * - * @return array */ - public function rules() + public function rules(): array { return [ 'email' => ['required', 'email'], diff --git a/tests/fixtures/form-requests/return-type-declarations.php b/tests/fixtures/form-requests/return-type-declarations.php deleted file mode 100644 index fdfcc0b2..00000000 --- a/tests/fixtures/form-requests/return-type-declarations.php +++ /dev/null @@ -1,32 +0,0 @@ - ['required', 'string', 'max:400'], - 'content' => ['required', 'string'], - 'author_id' => ['required', 'integer', 'exists:users,id'], - ]; - } -} diff --git a/tests/fixtures/jobs/create-user.php b/tests/fixtures/jobs/create-user.php index 80b57bba..fdc214ae 100644 --- a/tests/fixtures/jobs/create-user.php +++ b/tests/fixtures/jobs/create-user.php @@ -16,8 +16,6 @@ class CreateUser implements ShouldQueue /** * Create a new job instance. - * - * @return void */ public function __construct($user) { @@ -26,10 +24,8 @@ public function __construct($user) /** * Execute the job. - * - * @return void */ - public function handle() + public function handle(): void { // } diff --git a/tests/fixtures/jobs/delete-user.php b/tests/fixtures/jobs/delete-user.php index 5b3d4884..130bd613 100644 --- a/tests/fixtures/jobs/delete-user.php +++ b/tests/fixtures/jobs/delete-user.php @@ -14,8 +14,6 @@ class DeleteRole implements ShouldQueue /** * Create a new job instance. - * - * @return void */ public function __construct() { @@ -24,10 +22,8 @@ public function __construct() /** * Execute the job. - * - * @return void */ - public function handle() + public function handle(): void { // } diff --git a/tests/fixtures/jobs/job-configured.php b/tests/fixtures/jobs/job-configured.php index 0d7b82d9..af1bda5e 100644 --- a/tests/fixtures/jobs/job-configured.php +++ b/tests/fixtures/jobs/job-configured.php @@ -16,8 +16,6 @@ class SyncMedia implements ShouldQueue /** * Create a new job instance. - * - * @return void */ public function __construct($post) { @@ -26,8 +24,6 @@ public function __construct($post) /** * Execute the job. - * - * @return void */ public function handle(): void { diff --git a/tests/fixtures/mailables/added-admin.php b/tests/fixtures/mailables/added-admin.php index 4198f414..20f79740 100644 --- a/tests/fixtures/mailables/added-admin.php +++ b/tests/fixtures/mailables/added-admin.php @@ -15,8 +15,6 @@ class AddedAdmin extends Mailable /** * Create a new message instance. - * - * @return void */ public function __construct($user) { @@ -25,10 +23,8 @@ public function __construct($user) /** * Build the message. - * - * @return $this */ - public function build() + public function build(): static { return $this->view('emails.admin.added'); } diff --git a/tests/fixtures/mailables/mail-configured.php b/tests/fixtures/mailables/mail-configured.php index 7e19977e..6c53440b 100644 --- a/tests/fixtures/mailables/mail-configured.php +++ b/tests/fixtures/mailables/mail-configured.php @@ -15,8 +15,6 @@ class ReviewPost extends Mailable /** * Create a new message instance. - * - * @return void */ public function __construct($post) { @@ -25,10 +23,8 @@ public function __construct($post) /** * Build the message. - * - * @return $this */ - public function build() + public function build(): static { return $this->view('emails.review-post'); } diff --git a/tests/fixtures/mailables/published-post.php b/tests/fixtures/mailables/published-post.php index bbec7929..5a3adcf9 100644 --- a/tests/fixtures/mailables/published-post.php +++ b/tests/fixtures/mailables/published-post.php @@ -13,8 +13,6 @@ class PublishedPost extends Mailable /** * Create a new message instance. - * - * @return void */ public function __construct() { @@ -23,10 +21,8 @@ public function __construct() /** * Build the message. - * - * @return $this */ - public function build() + public function build(): static { return $this->view('emails.published-post'); } diff --git a/tests/fixtures/mailables/return-type-declarations.php b/tests/fixtures/mailables/return-type-declarations.php index ec396883..0c3c9a52 100644 --- a/tests/fixtures/mailables/return-type-declarations.php +++ b/tests/fixtures/mailables/return-type-declarations.php @@ -15,8 +15,6 @@ class ReviewPost extends Mailable /** * Create a new message instance. - * - * @return void */ public function __construct($post) { @@ -25,10 +23,8 @@ public function __construct($post) /** * Build the message. - * - * @return $this */ - public function build(): ReviewPost + public function build(): static { return $this->view('emails.review-post'); } diff --git a/tests/fixtures/mailables/review-post.php b/tests/fixtures/mailables/review-post.php index 6e03cdd0..08804844 100644 --- a/tests/fixtures/mailables/review-post.php +++ b/tests/fixtures/mailables/review-post.php @@ -15,8 +15,6 @@ class ReviewPost extends Mailable /** * Create a new message instance. - * - * @return void */ public function __construct($post) { @@ -25,10 +23,8 @@ public function __construct($post) /** * Build the message. - * - * @return $this */ - public function build() + public function build(): static { return $this->view('emails.review-post'); } diff --git a/tests/fixtures/migrations/belongs-to-many-duplicated-company.php b/tests/fixtures/migrations/belongs-to-many-duplicated-company.php index 2a13a9eb..975fd2c3 100644 --- a/tests/fixtures/migrations/belongs-to-many-duplicated-company.php +++ b/tests/fixtures/migrations/belongs-to-many-duplicated-company.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('companies', function (Blueprint $table) { $table->id(); @@ -22,10 +20,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('companies'); } diff --git a/tests/fixtures/migrations/belongs-to-many-duplicated-people.php b/tests/fixtures/migrations/belongs-to-many-duplicated-people.php index 66a69995..1cba3bdd 100644 --- a/tests/fixtures/migrations/belongs-to-many-duplicated-people.php +++ b/tests/fixtures/migrations/belongs-to-many-duplicated-people.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('people', function (Blueprint $table) { $table->id(); @@ -22,10 +20,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('people'); } diff --git a/tests/fixtures/migrations/belongs-to-many-duplicated-pivot.php b/tests/fixtures/migrations/belongs-to-many-duplicated-pivot.php index 5e8a95b4..f594ebba 100644 --- a/tests/fixtures/migrations/belongs-to-many-duplicated-pivot.php +++ b/tests/fixtures/migrations/belongs-to-many-duplicated-pivot.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('company_person', function (Blueprint $table) { $table->foreignId('company_id'); @@ -21,10 +19,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('company_person'); } diff --git a/tests/fixtures/migrations/belongs-to-many-key-constraints.php b/tests/fixtures/migrations/belongs-to-many-key-constraints.php index 718b3ae7..ce629dc8 100644 --- a/tests/fixtures/migrations/belongs-to-many-key-constraints.php +++ b/tests/fixtures/migrations/belongs-to-many-key-constraints.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::disableForeignKeyConstraints(); @@ -27,10 +25,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('journeys'); } diff --git a/tests/fixtures/migrations/belongs-to-many-pivot-key-constraints.php b/tests/fixtures/migrations/belongs-to-many-pivot-key-constraints.php index 5b398eaa..60b545f0 100644 --- a/tests/fixtures/migrations/belongs-to-many-pivot-key-constraints.php +++ b/tests/fixtures/migrations/belongs-to-many-pivot-key-constraints.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::disableForeignKeyConstraints(); @@ -25,10 +23,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('diary_journey'); } diff --git a/tests/fixtures/migrations/belongs-to-many-pivot.php b/tests/fixtures/migrations/belongs-to-many-pivot.php index a3ceb785..9f2edda4 100644 --- a/tests/fixtures/migrations/belongs-to-many-pivot.php +++ b/tests/fixtures/migrations/belongs-to-many-pivot.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('diary_journey', function (Blueprint $table) { $table->foreignId('diary_id'); @@ -21,10 +19,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('diary_journey'); } diff --git a/tests/fixtures/migrations/belongs-to-many.php b/tests/fixtures/migrations/belongs-to-many.php index bbb69b8d..91b9f287 100644 --- a/tests/fixtures/migrations/belongs-to-many.php +++ b/tests/fixtures/migrations/belongs-to-many.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('journeys', function (Blueprint $table) { $table->id(); @@ -23,10 +21,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('journeys'); } diff --git a/tests/fixtures/migrations/boolean-column-default.php b/tests/fixtures/migrations/boolean-column-default.php index 7e77d03c..e3b20fcd 100644 --- a/tests/fixtures/migrations/boolean-column-default.php +++ b/tests/fixtures/migrations/boolean-column-default.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('posts', 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('posts'); } diff --git a/tests/fixtures/migrations/columns-with-comments.php b/tests/fixtures/migrations/columns-with-comments.php index d4a499b1..a3d63398 100644 --- a/tests/fixtures/migrations/columns-with-comments.php +++ b/tests/fixtures/migrations/columns-with-comments.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('professions', function (Blueprint $table) { $table->id(); @@ -23,10 +21,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('professions'); } diff --git a/tests/fixtures/migrations/comments.php b/tests/fixtures/migrations/comments.php index ebedd986..54386c75 100644 --- a/tests/fixtures/migrations/comments.php +++ b/tests/fixtures/migrations/comments.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('comments', function (Blueprint $table) { $table->id(); @@ -22,10 +20,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('comments'); } diff --git a/tests/fixtures/migrations/custom-indexes.php b/tests/fixtures/migrations/custom-indexes.php index 9e7a7bb2..ab3aac95 100644 --- a/tests/fixtures/migrations/custom-indexes.php +++ b/tests/fixtures/migrations/custom-indexes.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::disableForeignKeyConstraints(); @@ -26,10 +24,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('cooltables'); } diff --git a/tests/fixtures/migrations/custom-pivot-table-name-test.php b/tests/fixtures/migrations/custom-pivot-table-name-test.php index 11535908..5d5c084d 100644 --- a/tests/fixtures/migrations/custom-pivot-table-name-test.php +++ b/tests/fixtures/migrations/custom-pivot-table-name-test.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('test', function (Blueprint $table) { $table->foreignId('account_id'); @@ -21,10 +19,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('test'); } diff --git a/tests/fixtures/migrations/custom-pivot-table-name-user.php b/tests/fixtures/migrations/custom-pivot-table-name-user.php index e04f973b..d596602a 100644 --- a/tests/fixtures/migrations/custom-pivot-table-name-user.php +++ b/tests/fixtures/migrations/custom-pivot-table-name-user.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(); @@ -23,10 +21,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('users'); } diff --git a/tests/fixtures/migrations/custom_pivot_team_user_table.php b/tests/fixtures/migrations/custom_pivot_team_user_table.php index 47deb3c7..ac7067b3 100644 --- a/tests/fixtures/migrations/custom_pivot_team_user_table.php +++ b/tests/fixtures/migrations/custom_pivot_team_user_table.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('team_user', function (Blueprint $table) { $table->id(); @@ -23,10 +21,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('team_user'); } diff --git a/tests/fixtures/migrations/custom_pivot_teams_table.php b/tests/fixtures/migrations/custom_pivot_teams_table.php index c91473e6..66fde6a7 100644 --- a/tests/fixtures/migrations/custom_pivot_teams_table.php +++ b/tests/fixtures/migrations/custom_pivot_teams_table.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('teams', function (Blueprint $table) { $table->id(); @@ -22,10 +20,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('teams'); } diff --git a/tests/fixtures/migrations/custom_pivot_users_table.php b/tests/fixtures/migrations/custom_pivot_users_table.php index d41c019d..7af13721 100644 --- a/tests/fixtures/migrations/custom_pivot_users_table.php +++ b/tests/fixtures/migrations/custom_pivot_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(); @@ -22,10 +20,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('users'); } diff --git a/tests/fixtures/migrations/disable-auto-columns.php b/tests/fixtures/migrations/disable-auto-columns.php index 17a6b10c..6a3f850e 100644 --- a/tests/fixtures/migrations/disable-auto-columns.php +++ b/tests/fixtures/migrations/disable-auto-columns.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('states', function (Blueprint $table) { $table->string('name'); @@ -22,10 +20,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('states'); } diff --git a/tests/fixtures/migrations/enum-options.php b/tests/fixtures/migrations/enum-options.php index 09fbf76f..ab28c282 100644 --- a/tests/fixtures/migrations/enum-options.php +++ b/tests/fixtures/migrations/enum-options.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('messages', function (Blueprint $table) { $table->id(); @@ -23,10 +21,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('messages'); } diff --git a/tests/fixtures/migrations/foreign-key-on-delete.php b/tests/fixtures/migrations/foreign-key-on-delete.php index 2ad22a5f..f8d6c17b 100644 --- a/tests/fixtures/migrations/foreign-key-on-delete.php +++ b/tests/fixtures/migrations/foreign-key-on-delete.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::disableForeignKeyConstraints(); @@ -30,10 +28,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('comments'); } diff --git a/tests/fixtures/migrations/foreign-key-shorthand.php b/tests/fixtures/migrations/foreign-key-shorthand.php index dff1145d..8c49390a 100644 --- a/tests/fixtures/migrations/foreign-key-shorthand.php +++ b/tests/fixtures/migrations/foreign-key-shorthand.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::disableForeignKeyConstraints(); @@ -28,10 +26,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('comments'); } diff --git a/tests/fixtures/migrations/foreign-with-class.php b/tests/fixtures/migrations/foreign-with-class.php index dfb8c85d..6d424e03 100644 --- a/tests/fixtures/migrations/foreign-with-class.php +++ b/tests/fixtures/migrations/foreign-with-class.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::disableForeignKeyConstraints(); @@ -27,10 +25,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('events'); } diff --git a/tests/fixtures/migrations/full-text.php b/tests/fixtures/migrations/full-text.php index 65ec976c..d3bae55e 100644 --- a/tests/fixtures/migrations/full-text.php +++ b/tests/fixtures/migrations/full-text.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('posts', function (Blueprint $table) { $table->id(); @@ -23,10 +21,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('posts'); } diff --git a/tests/fixtures/migrations/identity-columns-big-increments.php b/tests/fixtures/migrations/identity-columns-big-increments.php index 45f5ef49..0c0f6c33 100644 --- a/tests/fixtures/migrations/identity-columns-big-increments.php +++ b/tests/fixtures/migrations/identity-columns-big-increments.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('relationships', function (Blueprint $table) { $table->bigIncrements('id'); @@ -22,10 +20,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('relationships'); } diff --git a/tests/fixtures/migrations/identity-columns.php b/tests/fixtures/migrations/identity-columns.php index 609ce9c6..3302c307 100644 --- a/tests/fixtures/migrations/identity-columns.php +++ b/tests/fixtures/migrations/identity-columns.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('relationships', function (Blueprint $table) { $table->id(); @@ -22,10 +20,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('relationships'); } diff --git a/tests/fixtures/migrations/indexes.php b/tests/fixtures/migrations/indexes.php index b088a004..953d93dc 100644 --- a/tests/fixtures/migrations/indexes.php +++ b/tests/fixtures/migrations/indexes.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('posts', function (Blueprint $table) { $table->unsignedInteger('id'); @@ -33,10 +31,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('posts'); } diff --git a/tests/fixtures/migrations/model-key-constraints.php b/tests/fixtures/migrations/model-key-constraints.php index fb424fa6..60834d68 100644 --- a/tests/fixtures/migrations/model-key-constraints.php +++ b/tests/fixtures/migrations/model-key-constraints.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::disableForeignKeyConstraints(); @@ -30,10 +28,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('orders'); } diff --git a/tests/fixtures/migrations/model-modifiers.php b/tests/fixtures/migrations/model-modifiers.php index 5fa1d3c2..ad9fabac 100644 --- a/tests/fixtures/migrations/model-modifiers.php +++ b/tests/fixtures/migrations/model-modifiers.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('modifiers', function (Blueprint $table) { $table->increments('id'); @@ -29,10 +27,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('modifiers'); } diff --git a/tests/fixtures/migrations/model-numeric-defaults.php b/tests/fixtures/migrations/model-numeric-defaults.php index cf1d8675..1190f8ef 100644 --- a/tests/fixtures/migrations/model-numeric-defaults.php +++ b/tests/fixtures/migrations/model-numeric-defaults.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('numerics', function (Blueprint $table) { $table->increments('id'); @@ -31,10 +29,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('numerics'); } diff --git a/tests/fixtures/migrations/model-with-meta.php b/tests/fixtures/migrations/model-with-meta.php index 380b28dc..421baff6 100644 --- a/tests/fixtures/migrations/model-with-meta.php +++ b/tests/fixtures/migrations/model-with-meta.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('post', function (Blueprint $table) { $table->id(); @@ -23,10 +21,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('post'); } diff --git a/tests/fixtures/migrations/morphed-by-many-intermediate.php b/tests/fixtures/migrations/morphed-by-many-intermediate.php index 448726b2..e2fab8c9 100644 --- a/tests/fixtures/migrations/morphed-by-many-intermediate.php +++ b/tests/fixtures/migrations/morphed-by-many-intermediate.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('tagables', function (Blueprint $table) { $table->foreignId('tag_id'); @@ -22,10 +20,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('tagables'); } diff --git a/tests/fixtures/migrations/morphed-by-many.php b/tests/fixtures/migrations/morphed-by-many.php index e9a30327..38167d89 100644 --- a/tests/fixtures/migrations/morphed-by-many.php +++ b/tests/fixtures/migrations/morphed-by-many.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('tags', function (Blueprint $table) { $table->id(); @@ -22,10 +20,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('tags'); } diff --git a/tests/fixtures/migrations/nullable-chaining.php b/tests/fixtures/migrations/nullable-chaining.php index 6625e8e1..d64e2fc9 100644 --- a/tests/fixtures/migrations/nullable-chaining.php +++ b/tests/fixtures/migrations/nullable-chaining.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::disableForeignKeyConstraints(); @@ -27,10 +25,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('carts'); } diff --git a/tests/fixtures/migrations/nullable-columns-with-foreign.php b/tests/fixtures/migrations/nullable-columns-with-foreign.php index 233cd0a1..4125dd1c 100644 --- a/tests/fixtures/migrations/nullable-columns-with-foreign.php +++ b/tests/fixtures/migrations/nullable-columns-with-foreign.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::disableForeignKeyConstraints(); @@ -28,10 +26,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('comments'); } diff --git a/tests/fixtures/migrations/optimize.php b/tests/fixtures/migrations/optimize.php index a1c1cfac..1b36bb12 100644 --- a/tests/fixtures/migrations/optimize.php +++ b/tests/fixtures/migrations/optimize.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('optimizes', function (Blueprint $table) { $table->id(); @@ -32,10 +30,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('optimizes'); } diff --git a/tests/fixtures/migrations/pascal-case-model-names-broker-broker-type.php b/tests/fixtures/migrations/pascal-case-model-names-broker-broker-type.php index 1b5dc6b6..6f82a8ac 100644 --- a/tests/fixtures/migrations/pascal-case-model-names-broker-broker-type.php +++ b/tests/fixtures/migrations/pascal-case-model-names-broker-broker-type.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('broker_broker_type', function (Blueprint $table) { $table->foreignId('broker_id'); @@ -21,10 +19,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('broker_broker_type'); } diff --git a/tests/fixtures/migrations/pascal-case-model-names-broker-type.php b/tests/fixtures/migrations/pascal-case-model-names-broker-type.php index 44fedd86..62a63a05 100644 --- a/tests/fixtures/migrations/pascal-case-model-names-broker-type.php +++ b/tests/fixtures/migrations/pascal-case-model-names-broker-type.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('broker_types', function (Blueprint $table) { $table->id(); @@ -22,10 +20,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('broker_types'); } diff --git a/tests/fixtures/migrations/pascal-case-model-names-broker.php b/tests/fixtures/migrations/pascal-case-model-names-broker.php index 92cd1621..3bc5045e 100644 --- a/tests/fixtures/migrations/pascal-case-model-names-broker.php +++ b/tests/fixtures/migrations/pascal-case-model-names-broker.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('brokers', function (Blueprint $table) { $table->id(); @@ -22,10 +20,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('brokers'); } diff --git a/tests/fixtures/migrations/polymorphic_relationships_images_table.php b/tests/fixtures/migrations/polymorphic_relationships_images_table.php index 117512d9..b809c94f 100644 --- a/tests/fixtures/migrations/polymorphic_relationships_images_table.php +++ b/tests/fixtures/migrations/polymorphic_relationships_images_table.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('images', function (Blueprint $table) { $table->id(); @@ -24,10 +22,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('images'); } diff --git a/tests/fixtures/migrations/polymorphic_relationships_images_table_multiple_morphto.php b/tests/fixtures/migrations/polymorphic_relationships_images_table_multiple_morphto.php index aa3f5576..1571882d 100644 --- a/tests/fixtures/migrations/polymorphic_relationships_images_table_multiple_morphto.php +++ b/tests/fixtures/migrations/polymorphic_relationships_images_table_multiple_morphto.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('images', 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('images'); } diff --git a/tests/fixtures/migrations/polymorphic_relationships_posts_table.php b/tests/fixtures/migrations/polymorphic_relationships_posts_table.php index ddec2523..17ef2870 100644 --- a/tests/fixtures/migrations/polymorphic_relationships_posts_table.php +++ b/tests/fixtures/migrations/polymorphic_relationships_posts_table.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('posts', function (Blueprint $table) { $table->id(); @@ -22,10 +20,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('posts'); } diff --git a/tests/fixtures/migrations/polymorphic_relationships_users_table.php b/tests/fixtures/migrations/polymorphic_relationships_users_table.php index a397988c..980be308 100644 --- a/tests/fixtures/migrations/polymorphic_relationships_users_table.php +++ b/tests/fixtures/migrations/polymorphic_relationships_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(); @@ -22,10 +20,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('users'); } diff --git a/tests/fixtures/migrations/posts.php b/tests/fixtures/migrations/posts.php index d66343cd..e08090ed 100644 --- a/tests/fixtures/migrations/posts.php +++ b/tests/fixtures/migrations/posts.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('posts', function (Blueprint $table) { $table->id(); @@ -22,10 +20,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('posts'); } diff --git a/tests/fixtures/migrations/readme-example.php b/tests/fixtures/migrations/readme-example.php index b0d80ecb..92ceba79 100644 --- a/tests/fixtures/migrations/readme-example.php +++ b/tests/fixtures/migrations/readme-example.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('posts', function (Blueprint $table) { $table->id(); @@ -25,10 +23,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('posts'); } diff --git a/tests/fixtures/migrations/relationships-constraints.php b/tests/fixtures/migrations/relationships-constraints.php index 881bc17c..749a5f65 100644 --- a/tests/fixtures/migrations/relationships-constraints.php +++ b/tests/fixtures/migrations/relationships-constraints.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::disableForeignKeyConstraints(); @@ -27,10 +25,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('comments'); } diff --git a/tests/fixtures/migrations/relationships.php b/tests/fixtures/migrations/relationships.php index c6990a0e..0079985a 100644 --- a/tests/fixtures/migrations/relationships.php +++ b/tests/fixtures/migrations/relationships.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('comments', function (Blueprint $table) { $table->id(); @@ -23,10 +21,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('comments'); } diff --git a/tests/fixtures/migrations/resource-statements.php b/tests/fixtures/migrations/resource-statements.php index 35de6399..f1d8c732 100644 --- a/tests/fixtures/migrations/resource-statements.php +++ b/tests/fixtures/migrations/resource-statements.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(); @@ -25,10 +23,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('users'); } diff --git a/tests/fixtures/migrations/return-type-declarations.php b/tests/fixtures/migrations/return-type-declarations.php deleted file mode 100644 index e3dfd21b..00000000 --- a/tests/fixtures/migrations/return-type-declarations.php +++ /dev/null @@ -1,35 +0,0 @@ -id(); - $table->string('title', 400); - $table->longText('content'); - $table->timestamp('published_at')->nullable(); - $table->unsignedBigInteger('author_id'); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down(): void - { - Schema::dropIfExists('posts'); - } -}; diff --git a/tests/fixtures/migrations/soft-deletes-respect-order.php b/tests/fixtures/migrations/soft-deletes-respect-order.php index 4148a71f..aba13056 100644 --- a/tests/fixtures/migrations/soft-deletes-respect-order.php +++ b/tests/fixtures/migrations/soft-deletes-respect-order.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('comments', function (Blueprint $table) { $table->id(); @@ -24,10 +22,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('comments'); } diff --git a/tests/fixtures/migrations/soft-deletes.php b/tests/fixtures/migrations/soft-deletes.php index 11c6284d..c4881824 100644 --- a/tests/fixtures/migrations/soft-deletes.php +++ b/tests/fixtures/migrations/soft-deletes.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('comments', function (Blueprint $table) { $table->id(); @@ -23,10 +21,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('comments'); } diff --git a/tests/fixtures/migrations/unconventional-foreign-key.php b/tests/fixtures/migrations/unconventional-foreign-key.php index fd175227..c6a44390 100644 --- a/tests/fixtures/migrations/unconventional-foreign-key.php +++ b/tests/fixtures/migrations/unconventional-foreign-key.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::disableForeignKeyConstraints(); @@ -33,10 +31,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('states'); } diff --git a/tests/fixtures/migrations/unconventional.php b/tests/fixtures/migrations/unconventional.php index 99dd847c..a9131c87 100644 --- a/tests/fixtures/migrations/unconventional.php +++ b/tests/fixtures/migrations/unconventional.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('teams', function (Blueprint $table) { $table->id(); @@ -25,10 +23,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('teams'); } diff --git a/tests/fixtures/migrations/uuid-shorthand-constraint.php b/tests/fixtures/migrations/uuid-shorthand-constraint.php index 0ac38718..8b237660 100644 --- a/tests/fixtures/migrations/uuid-shorthand-constraint.php +++ b/tests/fixtures/migrations/uuid-shorthand-constraint.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::disableForeignKeyConstraints(); @@ -26,10 +24,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('people'); } diff --git a/tests/fixtures/migrations/uuid-shorthand-invalid-relationship.php b/tests/fixtures/migrations/uuid-shorthand-invalid-relationship.php index 66401e68..f4add0b3 100644 --- a/tests/fixtures/migrations/uuid-shorthand-invalid-relationship.php +++ b/tests/fixtures/migrations/uuid-shorthand-invalid-relationship.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('age_cohorts', 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('age_cohorts'); } diff --git a/tests/fixtures/migrations/uuid-shorthand.php b/tests/fixtures/migrations/uuid-shorthand.php index 892f174d..02c8bc41 100644 --- a/tests/fixtures/migrations/uuid-shorthand.php +++ b/tests/fixtures/migrations/uuid-shorthand.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('people', function (Blueprint $table) { $table->uuid('id')->primary(); @@ -22,10 +20,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('people'); } diff --git a/tests/fixtures/migrations/uuid-without-relationship.php b/tests/fixtures/migrations/uuid-without-relationship.php index 6e4fcb47..8841ff09 100644 --- a/tests/fixtures/migrations/uuid-without-relationship.php +++ b/tests/fixtures/migrations/uuid-without-relationship.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('vats', function (Blueprint $table) { $table->id(); @@ -22,10 +20,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('vats'); } diff --git a/tests/fixtures/migrations/with-path-prefix-table-name-city-region.php b/tests/fixtures/migrations/with-path-prefix-table-name-city-region.php index b50f4c6b..72d7a78c 100644 --- a/tests/fixtures/migrations/with-path-prefix-table-name-city-region.php +++ b/tests/fixtures/migrations/with-path-prefix-table-name-city-region.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('city_region', function (Blueprint $table) { $table->foreignId('city_id'); @@ -21,10 +19,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('city_region'); } diff --git a/tests/fixtures/migrations/with-path-prefix-table-name-region.php b/tests/fixtures/migrations/with-path-prefix-table-name-region.php index e35a5d21..471837d9 100644 --- a/tests/fixtures/migrations/with-path-prefix-table-name-region.php +++ b/tests/fixtures/migrations/with-path-prefix-table-name-region.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('regions', function (Blueprint $table) { $table->id(); @@ -23,10 +21,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('regions'); } diff --git a/tests/fixtures/migrations/with-timezones.php b/tests/fixtures/migrations/with-timezones.php index d6c1ec9a..d15f4117 100644 --- a/tests/fixtures/migrations/with-timezones.php +++ b/tests/fixtures/migrations/with-timezones.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('comments', function (Blueprint $table) { $table->id(); @@ -22,10 +20,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('comments'); } diff --git a/tests/fixtures/models/alias-relationships.php b/tests/fixtures/models/alias-relationships.php index 39b9bfa8..afb2e7df 100644 --- a/tests/fixtures/models/alias-relationships.php +++ b/tests/fixtures/models/alias-relationships.php @@ -4,6 +4,9 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Database\Eloquent\Relations\HasOne; class Salesman extends Model { @@ -27,17 +30,17 @@ class Salesman extends Model 'id' => 'integer', ]; - public function lead() + public function lead(): HasOne { return $this->hasOne(User::class); } - public function methodNames() + public function methodNames(): HasMany { return $this->hasMany(ClassName::class); } - public function methodName() + public function methodName(): BelongsTo { return $this->belongsTo(ClassName::class); } diff --git a/tests/fixtures/models/certificate-pascal-case-example.php b/tests/fixtures/models/certificate-pascal-case-example.php index 5abecfab..b9fb3f02 100644 --- a/tests/fixtures/models/certificate-pascal-case-example.php +++ b/tests/fixtures/models/certificate-pascal-case-example.php @@ -4,6 +4,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; class Certificate extends Model { @@ -34,7 +35,7 @@ class Certificate extends Model 'expiry_date' => 'date', ]; - public function certificateType() + public function certificateType(): BelongsTo { return $this->belongsTo(CertificateType::class); } diff --git a/tests/fixtures/models/certificate-type-pascal-case-example.php b/tests/fixtures/models/certificate-type-pascal-case-example.php index 65f0a1a5..160c2dc4 100644 --- a/tests/fixtures/models/certificate-type-pascal-case-example.php +++ b/tests/fixtures/models/certificate-type-pascal-case-example.php @@ -4,6 +4,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\HasMany; class CertificateType extends Model { @@ -27,7 +28,7 @@ class CertificateType extends Model 'id' => 'integer', ]; - public function certificates() + public function certificates(): HasMany { return $this->hasMany(Certificate::class); } diff --git a/tests/fixtures/models/custom-pivot-membership.php b/tests/fixtures/models/custom-pivot-membership.php index fd48cdc6..fdedc1ee 100644 --- a/tests/fixtures/models/custom-pivot-membership.php +++ b/tests/fixtures/models/custom-pivot-membership.php @@ -3,6 +3,7 @@ namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; +use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\Pivot; class Membership extends Pivot @@ -44,12 +45,12 @@ class Membership extends Pivot 'team_id' => 'integer', ]; - public function user() + public function user(): BelongsTo { return $this->belongsTo(User::class); } - public function team() + public function team(): BelongsTo { return $this->belongsTo(Team::class); } diff --git a/tests/fixtures/models/custom-pivot-table-name.php b/tests/fixtures/models/custom-pivot-table-name.php index 71c54099..e9f3b300 100644 --- a/tests/fixtures/models/custom-pivot-table-name.php +++ b/tests/fixtures/models/custom-pivot-table-name.php @@ -4,6 +4,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsToMany; class User extends Model { @@ -36,7 +37,7 @@ class User extends Model 'id' => 'integer', ]; - public function accounts() + public function accounts(): BelongsToMany { return $this->belongsToMany(Account::class, 'test'); } diff --git a/tests/fixtures/models/custom-pivot-team.php b/tests/fixtures/models/custom-pivot-team.php index 335f9169..5a0a3637 100644 --- a/tests/fixtures/models/custom-pivot-team.php +++ b/tests/fixtures/models/custom-pivot-team.php @@ -4,6 +4,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsToMany; class Team extends Model { @@ -27,7 +28,7 @@ class Team extends Model 'id' => 'integer', ]; - public function users() + public function users(): BelongsToMany { return $this->belongsToMany(User::class) ->using(Membership::class) diff --git a/tests/fixtures/models/custom-pivot-user.php b/tests/fixtures/models/custom-pivot-user.php index 03329562..6ee92a79 100644 --- a/tests/fixtures/models/custom-pivot-user.php +++ b/tests/fixtures/models/custom-pivot-user.php @@ -4,6 +4,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsToMany; class User extends Model { @@ -27,7 +28,7 @@ class User extends Model 'id' => 'integer', ]; - public function teams() + public function teams(): BelongsToMany { return $this->belongsToMany(Team::class) ->using(Membership::class) diff --git a/tests/fixtures/models/foreign-key-shorthand-phpdoc.php b/tests/fixtures/models/foreign-key-shorthand-phpdoc.php index 2329f9ef..93efd58b 100644 --- a/tests/fixtures/models/foreign-key-shorthand-phpdoc.php +++ b/tests/fixtures/models/foreign-key-shorthand-phpdoc.php @@ -4,6 +4,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; /** * @property int $id @@ -40,26 +41,17 @@ class Comment extends Model 'ccid' => 'integer', ]; - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function post() + public function post(): BelongsTo { return $this->belongsTo(Post::class); } - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function author() + public function author(): BelongsTo { return $this->belongsTo(User::class); } - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function country() + public function country(): BelongsTo { return $this->belongsTo(Country::class, 'ccid', 'code'); } diff --git a/tests/fixtures/models/image-polymorphic-relationship.php b/tests/fixtures/models/image-polymorphic-relationship.php index e7ddfb3c..7b2fe489 100644 --- a/tests/fixtures/models/image-polymorphic-relationship.php +++ b/tests/fixtures/models/image-polymorphic-relationship.php @@ -4,6 +4,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\MorphTo; class Image extends Model { @@ -27,7 +28,7 @@ class Image extends Model 'id' => 'integer', ]; - public function imageable() + public function imageable(): MorphTo { return $this->morphTo(); } diff --git a/tests/fixtures/models/model-configured.php b/tests/fixtures/models/model-configured.php index 2251d058..4acbe5be 100644 --- a/tests/fixtures/models/model-configured.php +++ b/tests/fixtures/models/model-configured.php @@ -4,6 +4,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; class Comment extends Model { @@ -30,12 +31,12 @@ class Comment extends Model 'author_id' => 'integer', ]; - public function post() + public function post(): BelongsTo { return $this->belongsTo(Post::class); } - public function author() + public function author(): BelongsTo { return $this->belongsTo(User::class); } diff --git a/tests/fixtures/models/model-relationships-morphone-morphmany-with-fqn.php b/tests/fixtures/models/model-relationships-morphone-morphmany-with-fqn.php index 513ccffc..679957f5 100644 --- a/tests/fixtures/models/model-relationships-morphone-morphmany-with-fqn.php +++ b/tests/fixtures/models/model-relationships-morphone-morphmany-with-fqn.php @@ -4,6 +4,9 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\MorphMany; +use Illuminate\Database\Eloquent\Relations\MorphOne; class Flag extends Model { @@ -28,22 +31,22 @@ class Flag extends Model 'user_id' => 'integer', ]; - public function stars() + public function stars(): MorphOne { return $this->morphOne(\Other\Package\Order::class, 'starable'); } - public function durations() + public function durations(): MorphMany { return $this->morphMany(\Other\Package\Duration::class, 'durationable'); } - public function lines() + public function lines(): MorphMany { return $this->morphMany(\App\MyCustom\Folder\Transaction::class, 'lineable'); } - public function user() + public function user(): BelongsTo { return $this->belongsTo(User::class); } diff --git a/tests/fixtures/models/model-relationships-with-full-namespace.php b/tests/fixtures/models/model-relationships-with-full-namespace.php index de6a633a..b1ecab15 100644 --- a/tests/fixtures/models/model-relationships-with-full-namespace.php +++ b/tests/fixtures/models/model-relationships-with-full-namespace.php @@ -4,6 +4,10 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\BelongsToMany; +use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Database\Eloquent\Relations\HasOne; class Recurrency extends Model { @@ -29,32 +33,32 @@ class Recurrency extends Model 'user_id' => 'integer', ]; - public function teams() + public function teams(): BelongsToMany { return $this->belongsToMany(\Some\Package\Team::class); } - public function orders() + public function orders(): HasMany { return $this->hasMany(\Other\Package\Order::class); } - public function duration() + public function duration(): HasOne { return $this->hasOne(\Other\Package\Duration::class); } - public function transaction() + public function transaction(): HasOne { return $this->hasOne(\App\MyCustom\Folder\Transaction::class); } - public function user() + public function user(): BelongsTo { return $this->belongsTo(User::class); } - public function product() + public function product(): BelongsTo { return $this->belongsTo(Product::class); } diff --git a/tests/fixtures/models/model-relationships.php b/tests/fixtures/models/model-relationships.php index f735e10f..be8da169 100644 --- a/tests/fixtures/models/model-relationships.php +++ b/tests/fixtures/models/model-relationships.php @@ -4,6 +4,10 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\BelongsToMany; +use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Database\Eloquent\Relations\HasOne; class Subscription extends Model { @@ -29,32 +33,32 @@ class Subscription extends Model 'user_id' => 'integer', ]; - public function teams() + public function teams(): BelongsToMany { return $this->belongsToMany(Team::class); } - public function orders() + public function orders(): HasMany { return $this->hasMany(Order::class); } - public function duration() + public function duration(): HasOne { return $this->hasOne(Duration::class); } - public function transaction() + public function transaction(): HasOne { return $this->hasOne(Transaction::class); } - public function user() + public function user(): BelongsTo { return $this->belongsTo(User::class); } - public function product() + public function product(): BelongsTo { return $this->belongsTo(Product::class); } diff --git a/tests/fixtures/models/nested-models.php b/tests/fixtures/models/nested-models.php index 1a127d51..e89c3edb 100644 --- a/tests/fixtures/models/nested-models.php +++ b/tests/fixtures/models/nested-models.php @@ -4,6 +4,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; class ScreeningQuestion extends Model { @@ -32,17 +33,17 @@ class ScreeningQuestion extends Model 'question_type_id' => 'integer', ]; - public function report() + public function report(): BelongsTo { return $this->belongsTo(Report::class); } - public function appointmentType() + public function appointmentType(): BelongsTo { return $this->belongsTo(\App\Models\Appointment\AppointmentType::class); } - public function questionType() + public function questionType(): BelongsTo { return $this->belongsTo(\App\Models\QuestionType::class); } diff --git a/tests/fixtures/models/post-many-to-many-polymorphic-relationship.php b/tests/fixtures/models/post-many-to-many-polymorphic-relationship.php index 19b0a703..d92764d0 100644 --- a/tests/fixtures/models/post-many-to-many-polymorphic-relationship.php +++ b/tests/fixtures/models/post-many-to-many-polymorphic-relationship.php @@ -4,6 +4,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\MorphToMany; class Post extends Model { @@ -27,7 +28,7 @@ class Post extends Model 'id' => 'integer', ]; - public function tags() + public function tags(): MorphToMany { return $this->morphToMany(Tag::class, 'tagable'); } diff --git a/tests/fixtures/models/post-polymorphic-relationship.php b/tests/fixtures/models/post-polymorphic-relationship.php index 91dd569d..4282fbba 100644 --- a/tests/fixtures/models/post-polymorphic-relationship.php +++ b/tests/fixtures/models/post-polymorphic-relationship.php @@ -4,6 +4,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\MorphMany; class Post extends Model { @@ -27,7 +28,7 @@ class Post extends Model 'id' => 'integer', ]; - public function images() + public function images(): MorphMany { return $this->morphMany(Image::class, 'imageable'); } diff --git a/tests/fixtures/models/readme-example-phpdoc.php b/tests/fixtures/models/readme-example-phpdoc.php index 97306401..2a3f5a1c 100644 --- a/tests/fixtures/models/readme-example-phpdoc.php +++ b/tests/fixtures/models/readme-example-phpdoc.php @@ -4,6 +4,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; /** * @property int $id @@ -41,10 +42,7 @@ class Post extends Model 'author_id' => 'integer', ]; - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function author() + public function author(): BelongsTo { return $this->belongsTo(User::class); } diff --git a/tests/fixtures/models/readme-example.php b/tests/fixtures/models/readme-example.php index 5694cb0d..cd4b41d5 100644 --- a/tests/fixtures/models/readme-example.php +++ b/tests/fixtures/models/readme-example.php @@ -4,6 +4,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; class Post extends Model { @@ -32,7 +33,7 @@ class Post extends Model 'author_id' => 'integer', ]; - public function author() + public function author(): BelongsTo { return $this->belongsTo(User::class); } diff --git a/tests/fixtures/models/relationships-phpdoc.php b/tests/fixtures/models/relationships-phpdoc.php index b97c58e8..2f33e60f 100644 --- a/tests/fixtures/models/relationships-phpdoc.php +++ b/tests/fixtures/models/relationships-phpdoc.php @@ -4,6 +4,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; /** * @property int $id @@ -37,18 +38,12 @@ class Comment extends Model 'author_id' => 'integer', ]; - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function post() + public function post(): BelongsTo { return $this->belongsTo(Post::class); } - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function author() + public function author(): BelongsTo { return $this->belongsTo(User::class); } diff --git a/tests/fixtures/models/relationships.php b/tests/fixtures/models/relationships.php index dab1517c..34121abc 100644 --- a/tests/fixtures/models/relationships.php +++ b/tests/fixtures/models/relationships.php @@ -4,6 +4,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; class Comment extends Model { @@ -30,12 +31,12 @@ class Comment extends Model 'author_id' => 'integer', ]; - public function post() + public function post(): BelongsTo { return $this->belongsTo(Post::class); } - public function author() + public function author(): BelongsTo { return $this->belongsTo(User::class); } diff --git a/tests/fixtures/models/return-type-declarations.php b/tests/fixtures/models/return-type-declarations.php deleted file mode 100644 index ef849b7d..00000000 --- a/tests/fixtures/models/return-type-declarations.php +++ /dev/null @@ -1,63 +0,0 @@ - 'integer', - 'name' => 'array', - 'description' => 'array', - 'meta' => 'array', - 'user_id' => 'integer', - 'team_id' => 'integer', - 'published' => 'boolean', - ]; - - public function organizers(): \Illuminate\Database\Eloquent\Relations\BelongsToMany - { - return $this->belongsToMany(Organizer::class); - } - - public function events(): \Illuminate\Database\Eloquent\Relations\BelongsToMany - { - return $this->belongsToMany(Event::class); - } - - public function user(): \Illuminate\Database\Eloquent\Relations\BelongsTo - { - return $this->belongsTo(User::class); - } - - public function team(): \Illuminate\Database\Eloquent\Relations\BelongsTo - { - return $this->belongsTo(Team::class); - } -} diff --git a/tests/fixtures/models/soft-deletes-phpdoc.php b/tests/fixtures/models/soft-deletes-phpdoc.php index 97802ab3..f8826489 100644 --- a/tests/fixtures/models/soft-deletes-phpdoc.php +++ b/tests/fixtures/models/soft-deletes-phpdoc.php @@ -4,6 +4,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\SoftDeletes; /** @@ -36,10 +37,7 @@ class Comment extends Model 'post_id' => 'integer', ]; - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function post() + public function post(): BelongsTo { return $this->belongsTo(Post::class); } diff --git a/tests/fixtures/models/soft-deletes.php b/tests/fixtures/models/soft-deletes.php index 178f3a3f..00b8c9fd 100644 --- a/tests/fixtures/models/soft-deletes.php +++ b/tests/fixtures/models/soft-deletes.php @@ -4,6 +4,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\SoftDeletes; class Comment extends Model @@ -29,7 +30,7 @@ class Comment extends Model 'post_id' => 'integer', ]; - public function post() + public function post(): BelongsTo { return $this->belongsTo(Post::class); } diff --git a/tests/fixtures/models/tag-many-to-many-polymorphic-relationship.php b/tests/fixtures/models/tag-many-to-many-polymorphic-relationship.php index 0ab8dfec..af8a1045 100644 --- a/tests/fixtures/models/tag-many-to-many-polymorphic-relationship.php +++ b/tests/fixtures/models/tag-many-to-many-polymorphic-relationship.php @@ -4,6 +4,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\MorphToMany; class Tag extends Model { @@ -27,12 +28,12 @@ class Tag extends Model 'id' => 'integer', ]; - public function posts() + public function posts(): MorphToMany { return $this->morphedByMany(Post::class, 'tagable'); } - public function videos() + public function videos(): MorphToMany { return $this->morphedByMany(Video::class, 'tagable'); } diff --git a/tests/fixtures/models/unconventional.php b/tests/fixtures/models/unconventional.php index b3ad6b87..085237ff 100644 --- a/tests/fixtures/models/unconventional.php +++ b/tests/fixtures/models/unconventional.php @@ -4,6 +4,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; class Team extends Model { @@ -33,12 +34,12 @@ class Team extends Model 'options' => 'array', ]; - public function owner() + public function owner(): BelongsTo { return $this->belongsTo(Owner::class); } - public function manager() + public function manager(): BelongsTo { return $this->belongsTo(User::class); } diff --git a/tests/fixtures/models/user-polymorphic-relationship.php b/tests/fixtures/models/user-polymorphic-relationship.php index b97efd82..ed6b8a1d 100644 --- a/tests/fixtures/models/user-polymorphic-relationship.php +++ b/tests/fixtures/models/user-polymorphic-relationship.php @@ -4,6 +4,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\MorphMany; class User extends Model { @@ -27,7 +28,7 @@ class User extends Model 'id' => 'integer', ]; - public function images() + public function images(): MorphMany { return $this->morphMany(Image::class, 'imageable'); } diff --git a/tests/fixtures/models/video-many-to-many-polymorphic-relationship.php b/tests/fixtures/models/video-many-to-many-polymorphic-relationship.php index eb4fe8cb..b9db43f3 100644 --- a/tests/fixtures/models/video-many-to-many-polymorphic-relationship.php +++ b/tests/fixtures/models/video-many-to-many-polymorphic-relationship.php @@ -4,6 +4,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\MorphToMany; class Video extends Model { @@ -27,7 +28,7 @@ class Video extends Model 'id' => 'integer', ]; - public function tags() + public function tags(): MorphToMany { return $this->morphToMany(Tag::class, 'tagable'); } diff --git a/tests/fixtures/notifications/notification-configured.php b/tests/fixtures/notifications/notification-configured.php index b7007788..4da36b19 100644 --- a/tests/fixtures/notifications/notification-configured.php +++ b/tests/fixtures/notifications/notification-configured.php @@ -16,8 +16,6 @@ class ReviewNotification extends Notification /** * Create a new message instance. - * - * @return void */ public function __construct($post) { @@ -26,22 +24,16 @@ public function __construct($post) /** * Get the notification's delivery channels. - * - * @param mixed $notifiable - * @return array */ - public function via($notifiable) + public function via(mixed $notifiable): array { return ['mail']; } /** * Get the mail representation of the notification. - * - * @param mixed $notifiable - * @return \Illuminate\Notifications\Messages\MailMessage */ - public function toMail($notifiable) + public function toMail(mixed $notifiable): MailMessage { return (new MailMessage) ->line('The introduction to the notification.') @@ -51,11 +43,8 @@ public function toMail($notifiable) /** * Get the array representation of the notification. - * - * @param mixed $notifiable - * @return array */ - public function toArray($notifiable) + public function toArray(mixed $notifiable): array { return [ // diff --git a/tests/fixtures/notifications/published-post.php b/tests/fixtures/notifications/published-post.php index c76c665a..3a4bd35e 100644 --- a/tests/fixtures/notifications/published-post.php +++ b/tests/fixtures/notifications/published-post.php @@ -14,8 +14,6 @@ class PublishedPostNotification extends Notification /** * Create a new message instance. - * - * @return void */ public function __construct() { @@ -24,22 +22,16 @@ public function __construct() /** * Get the notification's delivery channels. - * - * @param mixed $notifiable - * @return array */ - public function via($notifiable) + public function via(mixed $notifiable): array { return ['mail']; } /** * Get the mail representation of the notification. - * - * @param mixed $notifiable - * @return \Illuminate\Notifications\Messages\MailMessage */ - public function toMail($notifiable) + public function toMail(mixed $notifiable): MailMessage { return (new MailMessage) ->line('The introduction to the notification.') @@ -49,11 +41,8 @@ public function toMail($notifiable) /** * Get the array representation of the notification. - * - * @param mixed $notifiable - * @return array */ - public function toArray($notifiable) + public function toArray(mixed $notifiable): array { return [ // diff --git a/tests/fixtures/notifications/return-type-declarations.php b/tests/fixtures/notifications/return-type-declarations.php deleted file mode 100644 index 4fe1ce1c..00000000 --- a/tests/fixtures/notifications/return-type-declarations.php +++ /dev/null @@ -1,64 +0,0 @@ -post = $post; - } - - /** - * Get the notification's delivery channels. - * - * @param mixed $notifiable - * @return array - */ - public function via($notifiable): array - { - return ['mail']; - } - - /** - * Get the mail representation of the notification. - * - * @param mixed $notifiable - * @return \Illuminate\Notifications\Messages\MailMessage - */ - public function toMail($notifiable): ReviewNotification - { - return (new MailMessage) - ->line('The introduction to the notification.') - ->action('Notification Action', 'https://laravel.com') - ->line('Thank you for using our application!'); - } - - /** - * Get the array representation of the notification. - * - * @param mixed $notifiable - * @return array - */ - public function toArray($notifiable): array - { - return [ - // - ]; - } -} diff --git a/tests/fixtures/notifications/review-post.php b/tests/fixtures/notifications/review-post.php index 6f5cc126..39a4439e 100644 --- a/tests/fixtures/notifications/review-post.php +++ b/tests/fixtures/notifications/review-post.php @@ -16,8 +16,6 @@ class ReviewPostNotification extends Notification /** * Create a new message instance. - * - * @return void */ public function __construct($post) { @@ -26,22 +24,16 @@ public function __construct($post) /** * Get the notification's delivery channels. - * - * @param mixed $notifiable - * @return array */ - public function via($notifiable) + public function via(mixed $notifiable): array { return ['mail']; } /** * Get the mail representation of the notification. - * - * @param mixed $notifiable - * @return \Illuminate\Notifications\Messages\MailMessage */ - public function toMail($notifiable) + public function toMail(mixed $notifiable): MailMessage { return (new MailMessage) ->line('The introduction to the notification.') @@ -51,11 +43,8 @@ public function toMail($notifiable) /** * Get the array representation of the notification. - * - * @param mixed $notifiable - * @return array */ - public function toArray($notifiable) + public function toArray(mixed $notifiable): array { return [ // diff --git a/tests/fixtures/resources/api-post-resource.php b/tests/fixtures/resources/api-post-resource.php index 5b092754..26476583 100644 --- a/tests/fixtures/resources/api-post-resource.php +++ b/tests/fixtures/resources/api-post-resource.php @@ -2,17 +2,15 @@ namespace App\Http\Resources; +use Illuminate\Http\Request; use Illuminate\Http\Resources\Json\JsonResource; class PostResource extends JsonResource { /** * Transform the resource into an array. - * - * @param \Illuminate\Http\Request $request - * @return array */ - public function toArray($request) + public function toArray(Request $request): array { return [ 'id' => $this->id, diff --git a/tests/fixtures/resources/api-resource-pagination.php b/tests/fixtures/resources/api-resource-pagination.php index 18301fc4..0d0054dc 100644 --- a/tests/fixtures/resources/api-resource-pagination.php +++ b/tests/fixtures/resources/api-resource-pagination.php @@ -2,17 +2,15 @@ namespace App\Http\Resources; +use Illuminate\Http\Request; use Illuminate\Http\Resources\Json\ResourceCollection; class PostCollection extends ResourceCollection { /** * Transform the resource collection into an array. - * - * @param \Illuminate\Http\Request $request - * @return array */ - public function toArray($request) + public function toArray(Request $request): array { return [ 'data' => $this->collection, diff --git a/tests/fixtures/resources/certificate-collection.php b/tests/fixtures/resources/certificate-collection.php index dc102284..6b200b28 100644 --- a/tests/fixtures/resources/certificate-collection.php +++ b/tests/fixtures/resources/certificate-collection.php @@ -2,17 +2,15 @@ namespace App\Http\Resources\Api; +use Illuminate\Http\Request; use Illuminate\Http\Resources\Json\ResourceCollection; class CertificateCollection extends ResourceCollection { /** * Transform the resource collection into an array. - * - * @param \Illuminate\Http\Request $request - * @return array */ - public function toArray($request) + public function toArray(Request $request): array { return [ 'data' => $this->collection, diff --git a/tests/fixtures/resources/certificate-with-nested-resource.php b/tests/fixtures/resources/certificate-with-nested-resource.php index 883a96fa..12490338 100644 --- a/tests/fixtures/resources/certificate-with-nested-resource.php +++ b/tests/fixtures/resources/certificate-with-nested-resource.php @@ -2,17 +2,15 @@ namespace App\Http\Resources\Api; +use Illuminate\Http\Request; use Illuminate\Http\Resources\Json\JsonResource; class CertificateResource extends JsonResource { /** * Transform the resource into an array. - * - * @param \Illuminate\Http\Request $request - * @return array */ - public function toArray($request) + public function toArray(Request $request): array { return [ 'id' => $this->id, diff --git a/tests/fixtures/resources/certificate.php b/tests/fixtures/resources/certificate.php index 2277af5e..55a01edd 100644 --- a/tests/fixtures/resources/certificate.php +++ b/tests/fixtures/resources/certificate.php @@ -2,17 +2,15 @@ namespace App\Http\Resources\Api; +use Illuminate\Http\Request; use Illuminate\Http\Resources\Json\JsonResource; class CertificateResource extends JsonResource { /** * Transform the resource into an array. - * - * @param \Illuminate\Http\Request $request - * @return array */ - public function toArray($request) + public function toArray(Request $request): array { return [ 'id' => $this->id, diff --git a/tests/fixtures/resources/user-collection.php b/tests/fixtures/resources/user-collection.php index 28075930..d4259cca 100644 --- a/tests/fixtures/resources/user-collection.php +++ b/tests/fixtures/resources/user-collection.php @@ -2,17 +2,15 @@ namespace App\Http\Resources; +use Illuminate\Http\Request; use Illuminate\Http\Resources\Json\ResourceCollection; class UserCollection extends ResourceCollection { /** * Transform the resource collection into an array. - * - * @param \Illuminate\Http\Request $request - * @return array */ - public function toArray($request) + public function toArray(Request $request): array { return [ 'data' => $this->collection, diff --git a/tests/fixtures/resources/user-return-type-declarations.php b/tests/fixtures/resources/user-return-type-declarations.php deleted file mode 100644 index eb6eabaf..00000000 --- a/tests/fixtures/resources/user-return-type-declarations.php +++ /dev/null @@ -1,23 +0,0 @@ - $this->id, - 'name' => $this->name, - 'email' => $this->email, - ]; - } -} diff --git a/tests/fixtures/resources/user.php b/tests/fixtures/resources/user.php index 28199cc9..e9a77cc8 100644 --- a/tests/fixtures/resources/user.php +++ b/tests/fixtures/resources/user.php @@ -2,17 +2,15 @@ namespace App\Http\Resources; +use Illuminate\Http\Request; use Illuminate\Http\Resources\Json\JsonResource; class UserResource extends JsonResource { /** * Transform the resource into an array. - * - * @param \Illuminate\Http\Request $request - * @return array */ - public function toArray($request) + public function toArray(Request $request): array { return [ 'id' => $this->id, diff --git a/tests/fixtures/seeders/CommentSeeder-return-type-declarations.php b/tests/fixtures/seeders/CommentSeeder-return-type-declarations.php deleted file mode 100644 index 42773884..00000000 --- a/tests/fixtures/seeders/CommentSeeder-return-type-declarations.php +++ /dev/null @@ -1,19 +0,0 @@ -count(5)->create(); - } -} diff --git a/tests/fixtures/seeders/CommentSeeder.php b/tests/fixtures/seeders/CommentSeeder.php index fe880280..868d2f1a 100644 --- a/tests/fixtures/seeders/CommentSeeder.php +++ b/tests/fixtures/seeders/CommentSeeder.php @@ -9,10 +9,8 @@ class CommentSeeder extends Seeder { /** * Run the database seeds. - * - * @return void */ - public function run() + public function run(): void { Comment::factory()->count(5)->create(); } diff --git a/tests/fixtures/seeders/PostSeeder-return-type-declarations.php b/tests/fixtures/seeders/PostSeeder-return-type-declarations.php deleted file mode 100644 index bb56244f..00000000 --- a/tests/fixtures/seeders/PostSeeder-return-type-declarations.php +++ /dev/null @@ -1,19 +0,0 @@ -count(5)->create(); - } -} diff --git a/tests/fixtures/seeders/PostSeeder.php b/tests/fixtures/seeders/PostSeeder.php index 0915d01a..b699d1b6 100644 --- a/tests/fixtures/seeders/PostSeeder.php +++ b/tests/fixtures/seeders/PostSeeder.php @@ -9,10 +9,8 @@ class PostSeeder extends Seeder { /** * Run the database seeds. - * - * @return void */ - public function run() + public function run(): void { Post::factory()->count(5)->create(); } diff --git a/tests/fixtures/tests/api-shorthand-validation.php b/tests/fixtures/tests/api-shorthand-validation.php index 038e112b..73bddcd6 100644 --- a/tests/fixtures/tests/api-shorthand-validation.php +++ b/tests/fixtures/tests/api-shorthand-validation.php @@ -20,7 +20,7 @@ class CertificateControllerTest extends TestCase /** * @test */ - public function index_behaves_as_expected() + public function index_behaves_as_expected(): void { $certificates = Certificate::factory()->count(3)->create(); @@ -34,7 +34,7 @@ public function index_behaves_as_expected() /** * @test */ - public function store_uses_form_request_validation() + public function store_uses_form_request_validation(): void { $this->assertActionUsesFormRequest( \App\Http\Controllers\CertificateController::class, @@ -46,7 +46,7 @@ public function store_uses_form_request_validation() /** * @test */ - public function store_saves() + public function store_saves(): void { $name = $this->faker->name; $certificate_type = CertificateType::factory()->create(); @@ -80,7 +80,7 @@ public function store_saves() /** * @test */ - public function show_behaves_as_expected() + public function show_behaves_as_expected(): void { $certificate = Certificate::factory()->create(); @@ -94,7 +94,7 @@ public function show_behaves_as_expected() /** * @test */ - public function update_uses_form_request_validation() + public function update_uses_form_request_validation(): void { $this->assertActionUsesFormRequest( \App\Http\Controllers\CertificateController::class, @@ -106,7 +106,7 @@ public function update_uses_form_request_validation() /** * @test */ - public function update_behaves_as_expected() + public function update_behaves_as_expected(): void { $certificate = Certificate::factory()->create(); $name = $this->faker->name; @@ -139,7 +139,7 @@ public function update_behaves_as_expected() /** * @test */ - public function destroy_deletes_and_responds_with() + public function destroy_deletes_and_responds_with(): void { $certificate = Certificate::factory()->create(); diff --git a/tests/fixtures/tests/call-to-a-member-function-columns-on-null-Api-PaymentControllerTest.php b/tests/fixtures/tests/call-to-a-member-function-columns-on-null-Api-PaymentControllerTest.php index 1507c3aa..0a1c8304 100644 --- a/tests/fixtures/tests/call-to-a-member-function-columns-on-null-Api-PaymentControllerTest.php +++ b/tests/fixtures/tests/call-to-a-member-function-columns-on-null-Api-PaymentControllerTest.php @@ -23,7 +23,7 @@ class PaymentControllerTest extends TestCase /** * @test */ - public function store_uses_form_request_validation() + public function store_uses_form_request_validation(): void { $this->assertActionUsesFormRequest( \App\Http\Controllers\Api\PaymentController::class, @@ -35,7 +35,7 @@ public function store_uses_form_request_validation() /** * @test */ - public function store_saves_and_responds_with() + public function store_saves_and_responds_with(): void { $status = $this->faker->word; $amount = $this->faker->randomFloat(/** decimal_attributes **/); diff --git a/tests/fixtures/tests/call-to-a-member-function-columns-on-null-PaymentControllerTest.php b/tests/fixtures/tests/call-to-a-member-function-columns-on-null-PaymentControllerTest.php index a78b0571..4291adac 100644 --- a/tests/fixtures/tests/call-to-a-member-function-columns-on-null-PaymentControllerTest.php +++ b/tests/fixtures/tests/call-to-a-member-function-columns-on-null-PaymentControllerTest.php @@ -23,7 +23,7 @@ class PaymentControllerTest extends TestCase /** * @test */ - public function create_displays_view() + public function create_displays_view(): void { $response = $this->get(route('payment.create')); @@ -35,7 +35,7 @@ public function create_displays_view() /** * @test */ - public function store_uses_form_request_validation() + public function store_uses_form_request_validation(): void { $this->assertActionUsesFormRequest( \App\Http\Controllers\PaymentController::class, @@ -47,7 +47,7 @@ public function store_uses_form_request_validation() /** * @test */ - public function store_saves_and_redirects() + public function store_saves_and_redirects(): void { $status = $this->faker->word; $amount = $this->faker->randomFloat(/** decimal_attributes **/); diff --git a/tests/fixtures/tests/call-to-a-member-function-columns-on-null-SubscriptionControllerTest.php b/tests/fixtures/tests/call-to-a-member-function-columns-on-null-SubscriptionControllerTest.php index 4e9cb741..a8b09ce9 100644 --- a/tests/fixtures/tests/call-to-a-member-function-columns-on-null-SubscriptionControllerTest.php +++ b/tests/fixtures/tests/call-to-a-member-function-columns-on-null-SubscriptionControllerTest.php @@ -16,7 +16,7 @@ class SubscriptionControllerTest extends TestCase /** * @test */ - public function index_displays_view() + public function index_displays_view(): void { $subscriptions = Subscription::factory()->count(3)->create(); @@ -31,7 +31,7 @@ public function index_displays_view() /** * @test */ - public function show_displays_view() + public function show_displays_view(): void { $subscription = Subscription::factory()->create(); diff --git a/tests/fixtures/tests/certificate-pascal-case-example.php b/tests/fixtures/tests/certificate-pascal-case-example.php index 038e112b..73bddcd6 100644 --- a/tests/fixtures/tests/certificate-pascal-case-example.php +++ b/tests/fixtures/tests/certificate-pascal-case-example.php @@ -20,7 +20,7 @@ class CertificateControllerTest extends TestCase /** * @test */ - public function index_behaves_as_expected() + public function index_behaves_as_expected(): void { $certificates = Certificate::factory()->count(3)->create(); @@ -34,7 +34,7 @@ public function index_behaves_as_expected() /** * @test */ - public function store_uses_form_request_validation() + public function store_uses_form_request_validation(): void { $this->assertActionUsesFormRequest( \App\Http\Controllers\CertificateController::class, @@ -46,7 +46,7 @@ public function store_uses_form_request_validation() /** * @test */ - public function store_saves() + public function store_saves(): void { $name = $this->faker->name; $certificate_type = CertificateType::factory()->create(); @@ -80,7 +80,7 @@ public function store_saves() /** * @test */ - public function show_behaves_as_expected() + public function show_behaves_as_expected(): void { $certificate = Certificate::factory()->create(); @@ -94,7 +94,7 @@ public function show_behaves_as_expected() /** * @test */ - public function update_uses_form_request_validation() + public function update_uses_form_request_validation(): void { $this->assertActionUsesFormRequest( \App\Http\Controllers\CertificateController::class, @@ -106,7 +106,7 @@ public function update_uses_form_request_validation() /** * @test */ - public function update_behaves_as_expected() + public function update_behaves_as_expected(): void { $certificate = Certificate::factory()->create(); $name = $this->faker->name; @@ -139,7 +139,7 @@ public function update_behaves_as_expected() /** * @test */ - public function destroy_deletes_and_responds_with() + public function destroy_deletes_and_responds_with(): void { $certificate = Certificate::factory()->create(); diff --git a/tests/fixtures/tests/certificate-type-pascal-case-example.php b/tests/fixtures/tests/certificate-type-pascal-case-example.php index c688deb8..9ceb6d3b 100644 --- a/tests/fixtures/tests/certificate-type-pascal-case-example.php +++ b/tests/fixtures/tests/certificate-type-pascal-case-example.php @@ -18,7 +18,7 @@ class CertificateTypeControllerTest extends TestCase /** * @test */ - public function index_behaves_as_expected() + public function index_behaves_as_expected(): void { $certificateTypes = CertificateType::factory()->count(3)->create(); @@ -32,7 +32,7 @@ public function index_behaves_as_expected() /** * @test */ - public function store_uses_form_request_validation() + public function store_uses_form_request_validation(): void { $this->assertActionUsesFormRequest( \App\Http\Controllers\CertificateTypeController::class, @@ -44,7 +44,7 @@ public function store_uses_form_request_validation() /** * @test */ - public function store_saves() + public function store_saves(): void { $name = $this->faker->name; @@ -66,7 +66,7 @@ public function store_saves() /** * @test */ - public function show_behaves_as_expected() + public function show_behaves_as_expected(): void { $certificateType = CertificateType::factory()->create(); @@ -80,7 +80,7 @@ public function show_behaves_as_expected() /** * @test */ - public function update_uses_form_request_validation() + public function update_uses_form_request_validation(): void { $this->assertActionUsesFormRequest( \App\Http\Controllers\CertificateTypeController::class, @@ -92,7 +92,7 @@ public function update_uses_form_request_validation() /** * @test */ - public function update_behaves_as_expected() + public function update_behaves_as_expected(): void { $certificateType = CertificateType::factory()->create(); $name = $this->faker->name; @@ -113,7 +113,7 @@ public function update_behaves_as_expected() /** * @test */ - public function destroy_deletes_and_responds_with() + public function destroy_deletes_and_responds_with(): void { $certificateType = CertificateType::factory()->create(); diff --git a/tests/fixtures/tests/controllers-only-no-context.php b/tests/fixtures/tests/controllers-only-no-context.php index 48bb863d..2df1d2d1 100644 --- a/tests/fixtures/tests/controllers-only-no-context.php +++ b/tests/fixtures/tests/controllers-only-no-context.php @@ -20,7 +20,7 @@ class ReportControllerTest extends TestCase /** * @test */ - public function __invoke_displays_view() + public function __invoke_displays_view(): void { Queue::fake(); Event::fake(); diff --git a/tests/fixtures/tests/crud-show-only.php b/tests/fixtures/tests/crud-show-only.php index 2dcacab1..77f3fbd3 100644 --- a/tests/fixtures/tests/crud-show-only.php +++ b/tests/fixtures/tests/crud-show-only.php @@ -13,7 +13,7 @@ class PostControllerTest extends TestCase /** * @test */ - public function show_displays_view() + public function show_displays_view(): void { $post = Post::factory()->create(); diff --git a/tests/fixtures/tests/full-crud-example.php b/tests/fixtures/tests/full-crud-example.php index 3a007f02..4875d848 100644 --- a/tests/fixtures/tests/full-crud-example.php +++ b/tests/fixtures/tests/full-crud-example.php @@ -18,7 +18,7 @@ class PostControllerTest extends TestCase /** * @test */ - public function index_displays_view() + public function index_displays_view(): void { $posts = Post::factory()->count(3)->create(); @@ -33,7 +33,7 @@ public function index_displays_view() /** * @test */ - public function create_displays_view() + public function create_displays_view(): void { $response = $this->get(route('post.create')); @@ -46,7 +46,7 @@ public function create_displays_view() /** * @test */ - public function store_uses_form_request_validation() + public function store_uses_form_request_validation(): void { $this->assertActionUsesFormRequest( \App\Http\Controllers\PostController::class, @@ -58,7 +58,7 @@ public function store_uses_form_request_validation() /** * @test */ - public function store_saves_and_redirects() + public function store_saves_and_redirects(): void { $title = $this->faker->sentence(4); $content = $this->faker->paragraphs(3, true); @@ -82,7 +82,7 @@ public function store_saves_and_redirects() /** * @test */ - public function show_displays_view() + public function show_displays_view(): void { $post = Post::factory()->create(); @@ -97,7 +97,7 @@ public function show_displays_view() /** * @test */ - public function edit_displays_view() + public function edit_displays_view(): void { $post = Post::factory()->create(); @@ -112,7 +112,7 @@ public function edit_displays_view() /** * @test */ - public function update_uses_form_request_validation() + public function update_uses_form_request_validation(): void { $this->assertActionUsesFormRequest( \App\Http\Controllers\PostController::class, @@ -124,7 +124,7 @@ public function update_uses_form_request_validation() /** * @test */ - public function update_saves_and_redirects() + public function update_saves_and_redirects(): void { $post = Post::factory()->create(); $title = $this->faker->sentence(4); @@ -149,7 +149,7 @@ public function update_saves_and_redirects() /** * @test */ - public function destroy_deletes() + public function destroy_deletes(): void { $post = Post::factory()->create(); diff --git a/tests/fixtures/tests/models-with-custom-namespace.php b/tests/fixtures/tests/models-with-custom-namespace.php index 8a633270..c01423c0 100644 --- a/tests/fixtures/tests/models-with-custom-namespace.php +++ b/tests/fixtures/tests/models-with-custom-namespace.php @@ -18,7 +18,7 @@ class CategoryControllerTest extends TestCase /** * @test */ - public function index_behaves_as_expected() + public function index_behaves_as_expected(): void { $categories = Category::factory()->count(3)->create(); @@ -32,7 +32,7 @@ public function index_behaves_as_expected() /** * @test */ - public function store_uses_form_request_validation() + public function store_uses_form_request_validation(): void { $this->assertActionUsesFormRequest( \App\Http\Controllers\CategoryController::class, @@ -44,7 +44,7 @@ public function store_uses_form_request_validation() /** * @test */ - public function store_saves() + public function store_saves(): void { $name = $this->faker->name; $image = $this->faker->word; @@ -72,7 +72,7 @@ public function store_saves() /** * @test */ - public function show_behaves_as_expected() + public function show_behaves_as_expected(): void { $category = Category::factory()->create(); @@ -86,7 +86,7 @@ public function show_behaves_as_expected() /** * @test */ - public function update_uses_form_request_validation() + public function update_uses_form_request_validation(): void { $this->assertActionUsesFormRequest( \App\Http\Controllers\CategoryController::class, @@ -98,7 +98,7 @@ public function update_uses_form_request_validation() /** * @test */ - public function update_behaves_as_expected() + public function update_behaves_as_expected(): void { $category = Category::factory()->create(); $name = $this->faker->name; @@ -125,7 +125,7 @@ public function update_behaves_as_expected() /** * @test */ - public function destroy_deletes_and_responds_with() + public function destroy_deletes_and_responds_with(): void { $category = Category::factory()->create(); diff --git a/tests/fixtures/tests/readme-example-notification.php b/tests/fixtures/tests/readme-example-notification.php index 4f000127..a7ef8839 100644 --- a/tests/fixtures/tests/readme-example-notification.php +++ b/tests/fixtures/tests/readme-example-notification.php @@ -24,7 +24,7 @@ class PostControllerTest extends TestCase /** * @test */ - public function index_displays_view() + public function index_displays_view(): void { $posts = Post::factory()->count(3)->create(); @@ -39,7 +39,7 @@ public function index_displays_view() /** * @test */ - public function store_uses_form_request_validation() + public function store_uses_form_request_validation(): void { $this->assertActionUsesFormRequest( \App\Http\Controllers\PostController::class, @@ -51,7 +51,7 @@ public function store_uses_form_request_validation() /** * @test */ - public function store_saves_and_redirects() + public function store_saves_and_redirects(): void { $title = $this->faker->sentence(4); $content = $this->faker->paragraphs(3, true); diff --git a/tests/fixtures/tests/readme-example.php b/tests/fixtures/tests/readme-example.php index df2d37b4..e8ed4157 100644 --- a/tests/fixtures/tests/readme-example.php +++ b/tests/fixtures/tests/readme-example.php @@ -25,7 +25,7 @@ class PostControllerTest extends TestCase /** * @test */ - public function index_displays_view() + public function index_displays_view(): void { $posts = Post::factory()->count(3)->create(); @@ -40,7 +40,7 @@ public function index_displays_view() /** * @test */ - public function store_uses_form_request_validation() + public function store_uses_form_request_validation(): void { $this->assertActionUsesFormRequest( \App\Http\Controllers\PostController::class, @@ -52,7 +52,7 @@ public function store_uses_form_request_validation() /** * @test */ - public function store_saves_and_redirects() + public function store_saves_and_redirects(): void { $title = $this->faker->sentence(4); $content = $this->faker->paragraphs(3, true); diff --git a/tests/fixtures/tests/reference-cache.php b/tests/fixtures/tests/reference-cache.php index 6fb7b26a..243163ad 100644 --- a/tests/fixtures/tests/reference-cache.php +++ b/tests/fixtures/tests/reference-cache.php @@ -18,7 +18,7 @@ class UserControllerTest extends TestCase /** * @test */ - public function store_uses_form_request_validation() + public function store_uses_form_request_validation(): void { $this->assertActionUsesFormRequest( \App\Http\Controllers\UserController::class, @@ -30,7 +30,7 @@ public function store_uses_form_request_validation() /** * @test */ - public function store_saves_and_redirects() + public function store_saves_and_redirects(): void { $email = $this->faker->safeEmail; $password = $this->faker->password; diff --git a/tests/fixtures/tests/respond-statements.php b/tests/fixtures/tests/respond-statements.php index d6b0a64c..6ac9238e 100644 --- a/tests/fixtures/tests/respond-statements.php +++ b/tests/fixtures/tests/respond-statements.php @@ -18,7 +18,7 @@ class PostControllerTest extends TestCase /** * @test */ - public function index_responds_with() + public function index_responds_with(): void { $posts = Post::factory()->count(3)->create(); @@ -32,7 +32,7 @@ public function index_responds_with() /** * @test */ - public function store_uses_form_request_validation() + public function store_uses_form_request_validation(): void { $this->assertActionUsesFormRequest( \App\Http\Controllers\Api\PostController::class, @@ -44,7 +44,7 @@ public function store_uses_form_request_validation() /** * @test */ - public function store_responds_with() + public function store_responds_with(): void { $title = $this->faker->sentence(4); @@ -59,7 +59,7 @@ public function store_responds_with() /** * @test */ - public function error_responds_with() + public function error_responds_with(): void { $response = $this->get(route('post.error')); diff --git a/tests/fixtures/tests/return-type-declarations.php b/tests/fixtures/tests/return-type-declarations.php deleted file mode 100644 index e8ed4157..00000000 --- a/tests/fixtures/tests/return-type-declarations.php +++ /dev/null @@ -1,92 +0,0 @@ -count(3)->create(); - - $response = $this->get(route('post.index')); - - $response->assertOk(); - $response->assertViewIs('post.index'); - $response->assertViewHas('posts'); - } - - - /** - * @test - */ - public function store_uses_form_request_validation(): void - { - $this->assertActionUsesFormRequest( - \App\Http\Controllers\PostController::class, - 'store', - \App\Http\Requests\PostStoreRequest::class - ); - } - - /** - * @test - */ - public function store_saves_and_redirects(): void - { - $title = $this->faker->sentence(4); - $content = $this->faker->paragraphs(3, true); - $author = User::factory()->create(); - - Mail::fake(); - Queue::fake(); - Event::fake(); - - $response = $this->post(route('post.store'), [ - 'title' => $title, - 'content' => $content, - 'author_id' => $author->id, - ]); - - $posts = Post::query() - ->where('title', $title) - ->where('content', $content) - ->where('author_id', $author->id) - ->get(); - $this->assertCount(1, $posts); - $post = $posts->first(); - - $response->assertRedirect(route('post.index')); - $response->assertSessionHas('post.title', $post->title); - - Mail::assertSent(ReviewPost::class, function ($mail) use ($post) { - return $mail->hasTo($post->author->email) && $mail->post->is($post); - }); - Queue::assertPushed(SyncMedia::class, function ($job) use ($post) { - return $job->post->is($post); - }); - Event::assertDispatched(NewPost::class, function ($event) use ($post) { - return $event->post->is($post); - }); - } -}