Skip to content

Commit

Permalink
fix: Make sure Assert::assertIsList correctly asserts an array as list
Browse files Browse the repository at this point in the history
  • Loading branch information
mitelg authored and ondrejmirtes committed Nov 12, 2024
1 parent 146d9c3 commit 11d4235
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
3 changes: 3 additions & 0 deletions extension.neon
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ parameters:
- markTestIncomplete
- markTestSkipped
stubFiles:
- stubs/Assert.stub
- stubs/AssertionFailedError.stub
- stubs/ExpectationFailedException.stub
- stubs/InvocationMocker.stub
- stubs/MockBuilder.stub
- stubs/MockObject.stub
Expand Down
13 changes: 13 additions & 0 deletions stubs/Assert.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace PHPUnit\Framework;

abstract class Assert
{
/**
* @phpstan-assert list $array
*
* @throws ExpectationFailedException
*/
final public static function assertIsList(mixed $array, string $message = ''): void {}
}
8 changes: 8 additions & 0 deletions stubs/AssertionFailedError.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace PHPUnit\Framework;

class AssertionFailedError extends \Exception
{

}
8 changes: 8 additions & 0 deletions stubs/ExpectationFailedException.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace PHPUnit\Framework;

final class ExpectationFailedException extends AssertionFailedError
{

}

0 comments on commit 11d4235

Please sign in to comment.