Skip to content

Commit 06b7309

Browse files
committed
declare_strict_types
1 parent e058c6a commit 06b7309

20 files changed

+59
-17
lines changed

composer.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@
2121
"illuminate/contracts": "^10.0||^11.0"
2222
},
2323
"require-dev": {
24-
"laravel/pint": "^1.14",
25-
"nunomaduro/collision": "^8.1.1||^7.10.0",
26-
"larastan/larastan": "^2.9",
27-
"orchestra/testbench": "^9.0.0||^8.22.0",
28-
"pestphp/pest": "^2.34",
29-
"pestphp/pest-plugin-arch": "^2.7",
30-
"pestphp/pest-plugin-laravel": "^2.3",
31-
"phpstan/extension-installer": "^1.3",
32-
"phpstan/phpstan-deprecation-rules": "^1.1",
33-
"phpstan/phpstan-phpunit": "^1.3"
24+
"laravel/pint": "^1.0",
25+
"nunomaduro/collision": "^8.1",
26+
"larastan/larastan": "^3.0.0",
27+
"orchestra/testbench": "^9.0",
28+
"pestphp/pest": "^3.0",
29+
"pestphp/pest-plugin-arch": "^3.0",
30+
"pestphp/pest-plugin-laravel": "^3.0",
31+
"phpstan/extension-installer": "^1.4",
32+
"phpstan/phpstan-deprecation-rules": "^2.0",
33+
"phpstan/phpstan-phpunit": "^2.0"
3434
},
3535
"autoload": {
3636
"psr-4": {

config/workflow.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
return [
46

57
'queue' => env('WORKFLOW_QUEUE'),

phpstan.neon.dist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ parameters:
1010
tmpDir: build/phpstan
1111
checkOctaneCompatibility: true
1212
checkModelProperties: true
13+
noEnvCallsOutsideOfConfig: false
14+
ignoreErrors:
15+
- '#Trait Elegantly\\Workflow\\Concerns\\HasWorkflows is used zero times and is not analysed.#'

pint.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"preset": "laravel",
3+
"rules": {
4+
"declare_strict_types": true
5+
}
6+
}

src/Commands/RunWorkflowsCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Elegantly\Workflow\Commands;
46

57
use Elegantly\Workflow\Models\Workflow;

src/Concerns/HasWorkflows.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Elegantly\Workflow\Concerns;
46

5-
use Illuminate\Database\Eloquent\Model;
67
use Illuminate\Database\Eloquent\Relations\MorphMany;
78

89
trait HasWorkflows
910
{
1011
/**
11-
* @return MorphMany<Workflow, Model>
12+
* @return MorphMany<Workflow, $this>
1213
*/
1314
public function workflows(): MorphMany
1415
{

src/Models/Workflow.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Elegantly\Workflow\Models;
46

57
use Carbon\Carbon;
@@ -52,15 +54,15 @@ public function casts()
5254
}
5355

5456
/**
55-
* @return HasMany<WorkflowItem >
57+
* @return HasMany<WorkflowItem, $this>
5658
*/
5759
public function items(): HasMany
5860
{
5961
return $this->hasMany(WorkflowItem::class);
6062
}
6163

6264
/**
63-
* @return MorphTo<Model, Workflow>
65+
* @return MorphTo<Model, $this>
6466
*/
6567
public function model(): MorphTo
6668
{
@@ -157,7 +159,7 @@ public function getRemainingSteps(): SupportCollection
157159
$this->items
158160
->where('finished_at', '!=', null)
159161
->where('canceled_at', '!=', null)
160-
->pluck('name')
162+
->map(fn ($item) => $item->name)
161163
);
162164
}
163165

src/Models/WorkflowItem.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Elegantly\Workflow\Models;
46

57
use Carbon\Carbon;
@@ -37,7 +39,7 @@ public function casts(): array
3739
}
3840

3941
/**
40-
* @return BelongsTo<Workflow, WorkflowItem>
42+
* @return BelongsTo<Workflow, $this>
4143
*/
4244
public function workflow(): BelongsTo
4345
{

src/WorkflowDefinition.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Elegantly\Workflow;
46

57
use Elegantly\Workflow\Models\Workflow;

src/WorkflowServiceProvider.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Elegantly\Workflow;
46

57
use Elegantly\Workflow\Commands\RunWorkflowsCommand;

0 commit comments

Comments
 (0)