From c13d9a761a30cc4a680a77e5b0b57c6e57368f20 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 19 Nov 2026 12:21:50 +0100 Subject: [PATCH] Suppress NamedArgumentNotAllowed in the scenarios calling PHPUnit with named arguments PHPUnit marks its classes @no-named-arguments, which Psalm applies since vimeo/psalm#12389. These scenarios test how the plugin resolves the named arguments, so they suppress the issue the call now gets. --- tests/acceptance/Assertions.feature | 6 ++++-- tests/acceptance/CoversTargets.feature | 6 ++++-- tests/acceptance/Dependencies.feature | 3 ++- tests/acceptance/ExternalProviders.feature | 3 ++- tests/acceptance/IntersectionMocks.feature | 3 ++- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/tests/acceptance/Assertions.feature b/tests/acceptance/Assertions.feature index b761b4b..da39e2d 100644 --- a/tests/acceptance/Assertions.feature +++ b/tests/acceptance/Assertions.feature @@ -218,7 +218,8 @@ Feature: Assertions And I see no other errors Scenario: assertEquals with different, mixed, nullable or non-scalar arguments is not reported - Given I have the following code + Given the config suppresses the issue "NamedArgumentNotAllowed" + And I have the following code """ enum Suit: string { case Hearts = 'h'; @@ -285,7 +286,8 @@ Feature: Assertions Then I see no errors Scenario: Assertions without a literal expectation or a plain count are not reported - Given I have the following code + Given the config suppresses the issue "NamedArgumentNotAllowed" + And I have the following code """ /** @psalm-immutable */ final class Bag { diff --git a/tests/acceptance/CoversTargets.feature b/tests/acceptance/CoversTargets.feature index d863064..29947a8 100644 --- a/tests/acceptance/CoversTargets.feature +++ b/tests/acceptance/CoversTargets.feature @@ -4,7 +4,8 @@ Feature: Coverage targets Given PHPUnit identifies as version "11.5.0" Scenario: Missing methods and functions in #[CoversMethod], #[UsesMethod], #[CoversFunction] and #[UsesFunction] are reported - Given I have the following code + Given the config suppresses the issue "NamedArgumentNotAllowed" + And I have the following code """ use PHPUnit\Framework\Attributes\CoversFunction; use PHPUnit\Framework\Attributes\CoversMethod; @@ -45,7 +46,8 @@ Feature: Coverage targets And I see no other errors Scenario: Existing targets of #[CoversMethod] and #[CoversFunction] are not reported - Given I have the following code + Given the config suppresses the issue "NamedArgumentNotAllowed" + And I have the following code """ use PHPUnit\Framework\Attributes\CoversFunction; use PHPUnit\Framework\Attributes\CoversMethod; diff --git a/tests/acceptance/Dependencies.feature b/tests/acceptance/Dependencies.feature index 8066ddc..d617afa 100644 --- a/tests/acceptance/Dependencies.feature +++ b/tests/acceptance/Dependencies.feature @@ -196,7 +196,8 @@ Feature: Dependencies And I see no other errors Scenario: Named DependsExternal arguments are resolved by name - Given I have the following code + Given the config suppresses the issue "NamedArgumentNotAllowed" + And I have the following code """ use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\DependsExternal; diff --git a/tests/acceptance/ExternalProviders.feature b/tests/acceptance/ExternalProviders.feature index 37209a8..b832d00 100644 --- a/tests/acceptance/ExternalProviders.feature +++ b/tests/acceptance/ExternalProviders.feature @@ -417,7 +417,8 @@ Feature: External data providers And I see no other errors Scenario: #[DataProviderExternal] class is resolved through an import alias and named arguments - Given I have the following code + Given the config suppresses the issue "NamedArgumentNotAllowed" + And I have the following code """ use PHPUnit\Framework\Attributes\DataProviderExternal as Ext; use NS\External as Provider; diff --git a/tests/acceptance/IntersectionMocks.feature b/tests/acceptance/IntersectionMocks.feature index 76a832e..e82ea79 100644 --- a/tests/acceptance/IntersectionMocks.feature +++ b/tests/acceptance/IntersectionMocks.feature @@ -38,7 +38,8 @@ Feature: Intersection mocks and stubs Then I see no errors Scenario: Intersection stubs have the type of every listed interface - Given I have the following code + Given the config suppresses the issue "NamedArgumentNotAllowed" + And I have the following code """ /** @psalm-mutable */ interface Clock {