From 273e02e0efe510eb7b19a591184227edc064862d Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Wed, 27 Nov 2024 11:23:27 +0900 Subject: [PATCH] Suppress PHPStan false-positive in test assertions Added comments to clarify the purpose of assertions and ignored lines in `testDomainException`. This ensures that PHPStan does not produce false-positive errors and maintains code clarity for future maintenance. --- tests/DependencyCompilerTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/DependencyCompilerTest.php b/tests/DependencyCompilerTest.php index 98f2cd3..be9c852 100644 --- a/tests/DependencyCompilerTest.php +++ b/tests/DependencyCompilerTest.php @@ -143,9 +143,10 @@ public function testDependencyObjectInstanceCompile(): void public function testDomainException(): void { $this->expectException(DomainException::class); - assert(class_exists(FakeInvalidDependency::class)); + assert(class_exists(FakeInvalidDependency::class)); // to suppress phpstan false-positive $fake = new FakeInvalidDependency(); assert($fake instanceof DependencyInterface); // @phpstan-ignore-line + // FakeInvalidDependency is not a valid dependency, so the DomainException is thrown. (new DependencyCode(new Container()))->getCode($fake); }