From 92b6c362c5cf6bb5b1e13a8cdc5263c2b592a7b0 Mon Sep 17 00:00:00 2001 From: W0rma Date: Mon, 16 Nov 2026 12:28:40 +0100 Subject: [PATCH] fix: use fully qualified ArrayAccess in PHPDoc Codeception copies module docblocks verbatim into generated actor traits without their imports, so the short `ArrayAccess` name used in assertArrayHasKey() and assertArrayNotHasKey() resolved to the generated namespace. This brings back the problem from #10, which #11 had fixed and #15 accidentally undid. --- phpstan.neon | 7 ------- src/Codeception/Util/Shared/InheritedAsserts.php | 7 +++---- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index 312d874..af29ed1 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -3,10 +3,3 @@ parameters: paths: - tests/ - src/ - ignoreErrors: - - - message: '#Parameter \#1 \$className of static method PHPUnit\\Framework\\Assert::assertContainsOnlyInstancesOf\(\) expects class-string, string given\.#' - path: src/Codeception/Util/Shared/InheritedAsserts.php - - - message: '#Parameter \#1 \$className of static method PHPUnit\\Framework\\Assert::assertContainsNotOnlyInstancesOf\(\) expects class-string, string given\.#' - path: src/Codeception/Util/Shared/InheritedAsserts.php \ No newline at end of file diff --git a/src/Codeception/Util/Shared/InheritedAsserts.php b/src/Codeception/Util/Shared/InheritedAsserts.php index 18613ac..c2cfd4b 100644 --- a/src/Codeception/Util/Shared/InheritedAsserts.php +++ b/src/Codeception/Util/Shared/InheritedAsserts.php @@ -4,7 +4,6 @@ namespace Codeception\Util\Shared; -use ArrayAccess; use PHPUnit\Framework\Assert; use PHPUnit\Framework\Constraint\Constraint as PHPUnitConstraint; use PHPUnit\Framework\Constraint\LogicalNot; @@ -16,16 +15,16 @@ trait InheritedAsserts { /** * Asserts that an array has a specified key. - * @param array|ArrayAccess $array + * @param array|\ArrayAccess $array */ - protected function assertArrayHasKey(int|string $key, array|ArrayAccess $array, string $message = ''): void + protected function assertArrayHasKey(int|string $key, array|\ArrayAccess $array, string $message = ''): void { Assert::assertArrayHasKey($key, $array, $message); } /** * Asserts that an array does not have a specified key. - * @param array|ArrayAccess $array + * @param array|\ArrayAccess $array */ protected function assertArrayNotHasKey(int|string $key, array|\ArrayAccess $array, string $message = ''): void {