Skip to content

Commit

Permalink
Suppress PHPStan false-positive in test assertions
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
koriym committed Nov 27, 2024
1 parent 7e876a3 commit 273e02e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/DependencyCompilerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 273e02e

Please sign in to comment.