From 30457228d5e51d2fca0e2b77c321c0e942737668 Mon Sep 17 00:00:00 2001 From: Oliver Klee Date: Mon, 29 Apr 2024 23:13:07 +0200 Subject: [PATCH] [TASK] allow `assertInstanceOf` checks for PHPStan (#1256) These assertions are useful in tests also in cases where we have the corresponding type annotations in the production code. Part of #1252 --- phpstan-baseline.neon | 21 +-------------------- phpstan.neon | 3 +++ 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 79afc6c..aab4991 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,21 +1,2 @@ parameters: - ignoreErrors: - - - message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with 'TYPO3\\\\\\\\CMS\\\\\\\\Extbase\\\\\\\\Mvc\\\\\\\\Controller\\\\\\\\ActionController' and PHPUnit\\\\Framework\\\\MockObject\\\\MockObject&TTN\\\\Tea\\\\Controller\\\\FrontEndEditorController&TYPO3\\\\TestingFramework\\\\Core\\\\AccessibleObjectInterface will always evaluate to true\\.$#" - count: 1 - path: Tests/Unit/Controller/FrontEndEditorControllerTest.php - - - - message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with 'TYPO3\\\\\\\\CMS\\\\\\\\Extbase\\\\\\\\Mvc\\\\\\\\Controller\\\\\\\\ActionController' and PHPUnit\\\\Framework\\\\MockObject\\\\MockObject&TTN\\\\Tea\\\\Controller\\\\TeaController&TYPO3\\\\TestingFramework\\\\Core\\\\AccessibleObjectInterface will always evaluate to true\\.$#" - count: 1 - path: Tests/Unit/Controller/TeaControllerTest.php - - - - message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with 'TYPO3\\\\\\\\CMS\\\\\\\\Extbase\\\\\\\\DomainObject\\\\\\\\AbstractEntity' and TTN\\\\Tea\\\\Domain\\\\Model\\\\Tea will always evaluate to true\\.$#" - count: 1 - path: Tests/Unit/Domain/Model/TeaTest.php - - - - message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with 'TYPO3\\\\\\\\CMS\\\\\\\\Extbase\\\\\\\\Persistence\\\\\\\\Repository' and TTN\\\\Tea\\\\Domain\\\\Repository\\\\TeaRepository will always evaluate to true\\.$#" - count: 1 - path: Tests/Unit/Domain/Repository/TeaRepositoryTest.php + ignoreErrors: [] diff --git a/phpstan.neon b/phpstan.neon index b5b0aa0..f0fb6e3 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -17,6 +17,9 @@ parameters: - Configuration - Tests + # Allow instanceof checks, particularly in tests + checkAlwaysTrueCheckTypeFunctionCall: false + type_coverage: return_type: 100 param_type: 100