From fd321739d8e888cc149185e9fc6079ce4958e2fe Mon Sep 17 00:00:00 2001 From: dannc Date: Thu, 5 Oct 2023 16:10:06 +0700 Subject: [PATCH] internal: add phpstan to dev dependencies, create config --- composer.json | 1 + phpstan.neon | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 phpstan.neon diff --git a/composer.json b/composer.json index ee6ae68..e8a4c06 100644 --- a/composer.json +++ b/composer.json @@ -18,6 +18,7 @@ "require-dev": { "mockery/mockery": "1.6.6", "pestphp/pest": "2.18.2", + "phpstan/phpstan": "^1.10", "squizlabs/php_codesniffer": "3.7.2" }, "autoload": { diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..af7fb31 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,31 @@ +parameters: + level: 8 + paths: + - src + - tests + scanFiles: + # Pest handles loading custom helpers only when running tests + # @see https://pestphp.com/docs/helpers#usage + - tests/Pest.php + # Mockery doesn't autoload its helper functions + - vendor/mockery/mockery/library/helpers.php + ignoreErrors: + # Pest implicitly binds $this to the current test case + # @see https://pestphp.com/docs/underlying-test-case + - message: '#^Undefined variable: \$this$#' + paths: + - tests/* + # Pest custom expectations are dynamic and not conducive static analysis + # @see https://pestphp.com/docs/expectations#custom-expectations + - messages: + - '#Call to an undefined method Pest\\Expectation|Pest\\Support\\Extendable::#' + - '#Call to an undefined method Pest\\Mixins\\Expectation#' + - '#Call to an undefined method Pest\\PendingCalls\\TestCall|Pest\\Support\\HigherOrderTapProxy::#' + paths: + - tests/* + # Some mockery errors + - messages: + - '#Call to an undefined method Mockery\\ExpectationInterface|Mockery\\HigherOrderMessage::#' + - '#Parameter .+ Mockery\\LegacyMockInterface given.#' + paths: + - tests/*