Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PHPStan and configuration #1947

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,8 @@ jobs:
- name: Install dependencies
run: composer install --prefer-dist --no-interaction --no-progress

- name: Run PhpStan
run: vendor/bin/phpstan analyse src tests

- name: Execute tests
run: vendor/bin/phpunit --verbose
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"dms/phpunit-arraysubset-asserts": "^0.2.1"
"dms/phpunit-arraysubset-asserts": "^0.2.1",
"phpstan/phpstan": "^1.10"
},
"license": "MIT",
"authors": [
Expand Down
64 changes: 63 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions phpstan.src.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
parameters:
paths:
- src
level: 0
ignoreErrors:
- "#\\(void\\) is used#"
- "#Access to an undefined property#"
- "#Call to an undefined method#"
- "#but return statement is missing.#"
- "#Caught class [a-zA-Z0-9\\\\_]+ not found.#"
- "#Class [a-zA-Z0-9\\\\_]+ not found.#"
- "#has invalid type#"
- "#should always throw an exception or terminate script execution#"
- "#Instantiated class [a-zA-Z0-9\\\\_]+ not found.#"
- "#Unsafe usage of new static#"
excludePaths:
- "src/Illuminate/Testing/ParallelRunner.php"
2 changes: 1 addition & 1 deletion src/Settings/JsonSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Laravel\Homestead\Settings;

class JsonSettings extends HomesteadSettings
final class JsonSettings extends HomesteadSettings
{
/**
* Create an instance from a file.
Expand Down
2 changes: 1 addition & 1 deletion src/Settings/YamlSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Symfony\Component\Yaml\Yaml;

class YamlSettings extends HomesteadSettings
final class YamlSettings extends HomesteadSettings
{
/**
* Create an instance from a file.
Expand Down