Skip to content

Commit 066a855

Browse files
authored
Switch to PHPStan for static analysis (#5)
1 parent cbd1923 commit 066a855

File tree

6 files changed

+50
-54
lines changed

6 files changed

+50
-54
lines changed

.github/workflows/phpstan.yml

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

.github/workflows/psalm.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

composer.json

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727
"nunomaduro/collision": "^7.0|^8.0",
2828
"orchestra/testbench": "^8.0|^9.0",
2929
"phpunit/phpunit": "^10.5|^11.0",
30-
"vimeo/psalm": "^5.0",
30+
"larastan/larastan": "^2.9||^3.0",
31+
"phpstan/phpstan-deprecation-rules": "^1.1||^2.0",
32+
"phpstan/phpstan-phpunit": "^1.3||^2.0",
3133
"guzzlehttp/guzzle": "^7.0.1"
3234
},
3335
"autoload": {
@@ -41,12 +43,16 @@
4143
}
4244
},
4345
"scripts": {
44-
"psalm": "vendor/bin/psalm",
46+
"analyse": "vendor/bin/phpstan analyse",
4547
"test": "vendor/bin/phpunit --no-coverage",
4648
"test-coverage": "vendor/bin/phpunit --coverage-html coverage"
4749
},
4850
"config": {
49-
"sort-packages": true
51+
"sort-packages": true,
52+
"allow-plugins": {
53+
"pestphp/pest-plugin": true,
54+
"phpstan/extension-installer": true
55+
}
5056
},
5157
"extra": {
5258
"laravel": {
@@ -55,6 +61,6 @@
5561
]
5662
}
5763
},
58-
"minimum-stability": "dev",
64+
"minimum-stability": "stable",
5965
"prefer-stable": true
6066
}

phpstan.neon.dist

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
includes:
2+
- vendor/larastan/larastan/extension.neon
3+
4+
parameters:
5+
level: 5
6+
paths:
7+
- src
8+
- tests
9+
tmpDir: build/phpstan
10+
checkOctaneCompatibility: true
11+
checkModelProperties: true

psalm.xml.dist

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/LaravelLanguageRecognizerServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function register()
2727
'language-recognizer'
2828
);
2929

30-
$this->app->singleton(LaravelLanguageRecognizer::class, function ($app) {
30+
$this->app->bind(LaravelLanguageRecognizer::class, function ($app) {
3131
return new LaravelLanguageRecognizer($app);
3232
});
3333
}

0 commit comments

Comments
 (0)