From ff41f2cdb273a85af8f2ae41cc90b21db8a97ff9 Mon Sep 17 00:00:00 2001 From: Sam Light Date: Wed, 10 Jun 2026 19:00:32 +0100 Subject: stricter php stan with ignores for pest testing --- composer.json | 3 ++- composer.lock | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++- phpstan.neon | 18 +++++++++++++++++- 3 files changed, 71 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index ac85123..0ff8a27 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,8 @@ "mockery/mockery": "^1.6", "phpstan/extension-installer": "^1.4", "phpstan/phpstan-mockery": "^2.0", - "mrpunyapal/peststan": "^0.2.10" + "mrpunyapal/peststan": "^0.2.10", + "phpstan/phpstan-strict-rules": "^2.0" }, "config": { "allow-plugins": { diff --git a/composer.lock b/composer.lock index c76f8e8..1d7e423 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "207c08be14a5ab20d538c75ead372f1d", + "content-hash": "cce94e260de9356ef53ac73bf39dc1f1", "packages": [ { "name": "psr/http-message", @@ -2420,6 +2420,57 @@ }, "time": "2024-10-14T03:18:12+00:00" }, + { + "name": "phpstan/phpstan-strict-rules", + "version": "2.0.11", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan-strict-rules.git", + "reference": "9b000a578b85b32945b358b172c7b20e91189024" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/9b000a578b85b32945b358b172c7b20e91189024", + "reference": "9b000a578b85b32945b358b172c7b20e91189024", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0", + "phpstan/phpstan": "^2.1.39" + }, + "require-dev": { + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/phpstan-deprecation-rules": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpunit/phpunit": "^9.6" + }, + "type": "phpstan-extension", + "extra": { + "phpstan": { + "includes": [ + "rules.neon" + ] + } + }, + "autoload": { + "psr-4": { + "PHPStan\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Extra strict and opinionated rules for PHPStan", + "keywords": [ + "static analysis" + ], + "support": { + "issues": "https://github.com/phpstan/phpstan-strict-rules/issues", + "source": "https://github.com/phpstan/phpstan-strict-rules/tree/2.0.11" + }, + "time": "2026-05-02T06:54:10+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "12.5.6", diff --git a/phpstan.neon b/phpstan.neon index 4712629..0f3527c 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,5 @@ parameters: - level: 9 + level: 10 paths: - src - tests @@ -14,3 +14,19 @@ parameters: path: tests identifier: argument.type reportUnmatched: false + - + message: '#Cannot call method ([a-zA-Z0-9_])+\(\) on mixed.#' + path: tests + identifier: method.nonObject + reportUnmatched: false + - + message: '#Cannot access property \$([a-zA-Z0-9_])+ on mixed.#' + path: tests + identifier: property.nonObject + reportUnmatched: false + - + path: tests + identifiers: + - property.dynamicName + - method.dynamicName + reportUnmatched: false -- cgit v1.2.3