Skip to content

Commit a882a6e

Browse files
herndlmondrejmirtes
authored andcommitted
Mark support for isEmpty and notEmpty
1 parent f4f29ab commit a882a6e

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ This extension specifies types of values passed to:
5757
* `Assert::notFalse`
5858
* `Assert::null`
5959
* `Assert::notNull`
60+
* `Assert::isEmpty`
61+
* `Assert::notEmpty`
6062
* `Assert::eq`
6163
* `Assert::notEq`
6264
* `Assert::same`

tests/Type/WebMozartAssert/data/comparison.php

+26
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,32 @@ public function notNull(?int $a): void
4444
assertType('int', $a);
4545
}
4646

47+
/** @param string|null $c */
48+
public function isEmpty(string $a, $b, $c): void
49+
{
50+
Assert::isEmpty($a);
51+
assertType("''|'0'", $a);
52+
53+
Assert::isEmpty($b);
54+
assertType("0|0.0|''|'0'|array{}|false|null", $b);
55+
56+
Assert::isEmpty($c);
57+
assertType("''|'0'|null", $c);
58+
}
59+
60+
/** @param string|null $c */
61+
public function notEmpty(string $a, $b, $c): void
62+
{
63+
Assert::notEmpty($a);
64+
assertType('non-falsy-string', $a);
65+
66+
Assert::notEmpty($b);
67+
assertType("mixed~0|0.0|''|'0'|array{}|false|null", $b);
68+
69+
Assert::notEmpty($c);
70+
assertType('non-falsy-string', $c);
71+
}
72+
4773
/**
4874
* @param non-empty-string $b2
4975
*/

0 commit comments

Comments
 (0)