Skip to content

Commit 03f0b88

Browse files
committed
refactor: run phpstan on level 1
1 parent b2530e7 commit 03f0b88

File tree

9 files changed

+1301
-9
lines changed

9 files changed

+1301
-9
lines changed

.github/workflows/phpstan.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Run PHPStan
2+
3+
on:
4+
push:
5+
paths:
6+
- '**.php'
7+
- 'phpstan.neon'
8+
- '.github/workflows/phpstan.yml'
9+
- 'composer.lock'
10+
11+
jobs:
12+
phpstan:
13+
name: phpstan
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
18+
- name: Setup PHP
19+
uses: shivammathur/setup-php@v2
20+
with:
21+
php-version: '8.1'
22+
coverage: none
23+
24+
- name: Install composer dependencies
25+
uses: ramsey/composer-install@v1
26+
27+
28+
- name: Run PHPStan
29+
run: ./vendor/bin/phpstan --error-format=github

app/Domain/Notes/Dtos/StoreNoteData.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function __construct(
1414

1515
public static function fromRequest(FormRequest $request): self
1616
{
17-
return new static(
17+
return new self(
1818
title: $request->input('title'),
1919
content: $request->input('content'),
2020
);

app/Domain/Notes/Dtos/UpdateNoteData.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function __construct(
1414

1515
public static function fromRequest(FormRequest $request): self
1616
{
17-
return new static(
17+
return new self(
1818
title: $request->input('title'),
1919
content: $request->input('content'),
2020
);

app/Domain/Notes/Exceptions/NoteExceptions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ class NoteExceptions extends Exception
88
{
99
public static function notesAmountLimit(int $limitNotes): self
1010
{
11-
return new static(__('validation.custom.notes.limit', ['amount' => $limitNotes]));
11+
return new self(__('validation.custom.notes.limit', ['amount' => $limitNotes]));
1212
}
1313
}

app/Domain/Subscriptions/Dtos/SubscriptionRulesData.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public function __construct(
1111

1212
public static function fromArray(array $array): self
1313
{
14-
return new static(
14+
return new self(
1515
notesMaximumAmount: $array['notes_maximum_amount'],
1616
);
1717
}

app/Domain/Subscriptions/Exceptions/SubscriptionExceptions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ class SubscriptionExceptions extends Exception
88
{
99
public static function userDoesNotHaveSubscription(): self
1010
{
11-
return new static(__('validation.custom.subscription.required'));
11+
return new self(__('validation.custom.subscription.required'));
1212
}
1313
}

composer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"laravel/sail": "^1.3",
2727
"mockery/mockery": "^1.4.2",
2828
"nunomaduro/collision": "^5.0",
29+
"nunomaduro/larastan": "1.0",
2930
"phpunit/phpunit": "^9.3.3",
3031
"roave/security-advisories": "dev-latest"
3132
},
@@ -54,6 +55,7 @@
5455
"minimum-stability": "dev",
5556
"prefer-stable": true,
5657
"scripts": {
58+
"phpstan": "vendor/bin/phpstan analyse",
5759
"post-autoload-dump": [
5860
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
5961
"@php artisan package:discover --ansi"

0 commit comments

Comments
 (0)