1717
1818trait AssertionTrait
1919{
20- private function determineAssertionType ($ item ) : string
20+ private function determineAssertionType (mixed $ item ) : string
2121 {
2222 return is_object ($ item ) ? $ item ::class : gettype ($ item );
2323 }
2424
25- private function assertArray ($ item , ?string $ key = null ): void
25+ private function assertArray (mixed $ item , ?string $ key = null ): void
2626 {
2727 if (!is_array ($ item )) {
2828 throw new InvalidDataTypeException (
@@ -38,7 +38,7 @@ private function assertArray($item, ?string $key = null): void
3838 }
3939 }
4040
41- private function assertString ($ item , ?string $ key = null ): void
41+ private function assertString (mixed $ item , ?string $ key = null ): void
4242 {
4343 if (!is_string ($ item )) {
4444 throw new InvalidDataTypeException (
@@ -54,7 +54,7 @@ private function assertString($item, ?string $key = null): void
5454 }
5555 }
5656
57- private function assertNumeric ($ item , ?string $ key = null ): void
57+ private function assertNumeric (mixed $ item , ?string $ key = null ): void
5858 {
5959 if (!is_numeric ($ item )) {
6060 throw new InvalidDataTypeException (
@@ -70,7 +70,7 @@ private function assertNumeric($item, ?string $key = null): void
7070 }
7171 }
7272
73- private function assertInteger ($ item , ?string $ key = null ): void
73+ private function assertInteger (mixed $ item , ?string $ key = null ): void
7474 {
7575 if (!is_integer ($ item )) {
7676 throw new InvalidDataTypeException (
@@ -86,7 +86,7 @@ private function assertInteger($item, ?string $key = null): void
8686 }
8787 }
8888
89- private function assertStringOrArray ($ item , ?string $ key = null ): void
89+ private function assertStringOrArray (mixed $ item , ?string $ key = null ): void
9090 {
9191 if (is_string ($ item ) || is_array ($ item )) {
9292 return ;
@@ -103,6 +103,11 @@ private function assertStringOrArray($item, ?string $key = null): void
103103 );
104104 }
105105
106+ /**
107+ * @param array<array-key, mixed> $item
108+ * @param string|null $key
109+ * @return void
110+ */
106111 private function assertArrayStringValue (array $ item , ?string $ key = null ): void
107112 {
108113 foreach ($ item as $ i ) {
@@ -122,6 +127,11 @@ private function assertArrayStringValue(array $item, ?string $key = null): void
122127 }
123128 }
124129
130+ /**
131+ * @param array<array-key, mixed> $item
132+ * @param string|null $key
133+ * @return void
134+ */
125135 private function assertArrayBooleanValue (array $ item , ?string $ key = null ): void
126136 {
127137 foreach ($ item as $ i ) {
@@ -141,6 +151,11 @@ private function assertArrayBooleanValue(array $item, ?string $key = null): void
141151 }
142152 }
143153
154+ /**
155+ * @param array<array-key, mixed> $item
156+ * @param string|null $key
157+ * @return void
158+ */
144159 private function assertArrayStringKey (array $ item , ?string $ key = null ): void
145160 {
146161 foreach ($ item as $ i => $ value ) {
@@ -160,7 +175,12 @@ private function assertArrayStringKey(array $item, ?string $key = null): void
160175 }
161176 }
162177
163- private function assertBoolean ($ item , ?string $ key = null ): void
178+ /**
179+ * @param mixed $item
180+ * @param string|null $key
181+ * @return void
182+ */
183+ private function assertBoolean (mixed $ item , ?string $ key = null ): void
164184 {
165185 if (!is_bool ($ item )) {
166186 throw new InvalidDataTypeException (
@@ -176,7 +196,13 @@ private function assertBoolean($item, ?string $key = null): void
176196 }
177197 }
178198
179- private function assertInstanceOf ($ item , string |object $ instance , ?string $ key = null ): void
199+ /**
200+ * @param mixed $item
201+ * @param string|object $instance
202+ * @param string|null $key
203+ * @return void
204+ */
205+ private function assertInstanceOf (mixed $ item , string |object $ instance , ?string $ key = null ): void
180206 {
181207 $ instance = is_object ($ instance ) ? $ instance ::class : $ instance ;
182208 if (!is_a ($ item , $ instance )) {
@@ -195,7 +221,13 @@ private function assertInstanceOf($item, string|object $instance, ?string $key =
195221 }
196222 }
197223
198- private function assertEqual ($ item , $ expected , ?string $ key = null ): void
224+ /**
225+ * @param mixed $item
226+ * @param mixed $expected
227+ * @param string|null $key
228+ * @return void
229+ */
230+ private function assertEqual (mixed $ item , mixed $ expected , ?string $ key = null ): void
199231 {
200232 if ($ item !== $ expected ) {
201233 throw new MismatchDataBehaviorException (
@@ -209,6 +241,12 @@ private function assertEqual($item, $expected, ?string $key = null): void
209241 }
210242 }
211243
244+ /**
245+ * @param array<array-key, mixed> $item
246+ * @param int $expected
247+ * @param string|null $key
248+ * @return void
249+ */
212250 private function assertCount (array $ item , int $ expected , ?string $ key = null ) : void
213251 {
214252 if (($ count = count ($ item )) !== $ expected ) {
@@ -225,6 +263,12 @@ private function assertCount(array $item, int $expected, ?string $key = null) :
225263 }
226264 }
227265
266+ /**
267+ * @param array<array-key, mixed> $item
268+ * @param int $expected
269+ * @param string|null $key
270+ * @return void
271+ */
228272 private function assertCountGreaterThan (array $ item , int $ expected , ?string $ key = null ) : void
229273 {
230274 if (($ count = count ($ item )) > $ expected ) {
@@ -242,6 +286,12 @@ private function assertCountGreaterThan(array $item, int $expected, ?string $key
242286 );
243287 }
244288
289+ /**
290+ * @param array<array-key, mixed> $item
291+ * @param int $expected
292+ * @param string|null $key
293+ * @return void
294+ */
245295 private function assertCountGreaterOrEqual (array $ item , int $ expected , ?string $ key = null ) : void
246296 {
247297 if (($ count = count ($ item )) >= $ expected ) {
0 commit comments