Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Commit 155f41f

Browse files
authored
Add PHPStan and configuration (#1947)
1 parent f406c0e commit 155f41f

File tree

6 files changed

+87
-4
lines changed

6 files changed

+87
-4
lines changed

.github/workflows/tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,8 @@ jobs:
3838
- name: Install dependencies
3939
run: composer install --prefer-dist --no-interaction --no-progress
4040

41+
- name: Run PhpStan
42+
run: vendor/bin/phpstan analyse src tests
43+
4144
- name: Execute tests
4245
run: vendor/bin/phpunit --verbose

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
},
1010
"require-dev": {
1111
"phpunit/phpunit": "^9.5",
12-
"dms/phpunit-arraysubset-asserts": "^0.2.1"
12+
"dms/phpunit-arraysubset-asserts": "^0.2.1",
13+
"phpstan/phpstan": "^1.10"
1314
},
1415
"license": "MIT",
1516
"authors": [

composer.lock

Lines changed: 63 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpstan.src.neon.dist

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
parameters:
2+
paths:
3+
- src
4+
level: 0
5+
ignoreErrors:
6+
- "#\\(void\\) is used#"
7+
- "#Access to an undefined property#"
8+
- "#Call to an undefined method#"
9+
- "#but return statement is missing.#"
10+
- "#Caught class [a-zA-Z0-9\\\\_]+ not found.#"
11+
- "#Class [a-zA-Z0-9\\\\_]+ not found.#"
12+
- "#has invalid type#"
13+
- "#should always throw an exception or terminate script execution#"
14+
- "#Instantiated class [a-zA-Z0-9\\\\_]+ not found.#"
15+
- "#Unsafe usage of new static#"
16+
excludePaths:
17+
- "src/Illuminate/Testing/ParallelRunner.php"

src/Settings/JsonSettings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Laravel\Homestead\Settings;
44

5-
class JsonSettings extends HomesteadSettings
5+
final class JsonSettings extends HomesteadSettings
66
{
77
/**
88
* Create an instance from a file.

src/Settings/YamlSettings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Symfony\Component\Yaml\Yaml;
66

7-
class YamlSettings extends HomesteadSettings
7+
final class YamlSettings extends HomesteadSettings
88
{
99
/**
1010
* Create an instance from a file.

0 commit comments

Comments
 (0)