|
247 | 247 |
|
248 | 248 | return 'string';
|
249 | 249 | }));
|
| 250 | +assertType('Illuminate\Support\Collection<int, User>|void', $collection->when('Taylor', function ($collection, $name) { |
| 251 | + assertType('Illuminate\Support\Collection<int, User>', $collection); |
| 252 | + assertType('string', $name); |
| 253 | +})); |
| 254 | +assertType( |
| 255 | + 'Illuminate\Support\Collection<int, User>|void', |
| 256 | + $collection->when( |
| 257 | + 'Taylor', |
| 258 | + function ($collection, $name) { |
| 259 | + assertType('Illuminate\Support\Collection<int, User>', $collection); |
| 260 | + assertType('string', $name); |
| 261 | + }, |
| 262 | + function ($collection, $name) { |
| 263 | + assertType('Illuminate\Support\Collection<int, User>', $collection); |
| 264 | + assertType('string', $name); |
| 265 | + } |
| 266 | + ) |
| 267 | +); |
| 268 | +assertType('Illuminate\Support\Collection<int, User>|void', $collection->when(fn () =>'Taylor', function ($collection, $name) { |
| 269 | + assertType('Illuminate\Support\Collection<int, User>', $collection); |
| 270 | + assertType('string', $name); |
| 271 | +})); |
| 272 | +assertType( |
| 273 | + 'Illuminate\Support\Collection<int, User>|void', |
| 274 | + $collection->when( |
| 275 | + function ($collection) { |
| 276 | + assertType('Illuminate\Support\Collection<int, User>', $collection); |
| 277 | + |
| 278 | + return 14; |
| 279 | + }, |
| 280 | + function ($collection, $count) { |
| 281 | + assertType('Illuminate\Support\Collection<int, User>', $collection); |
| 282 | + assertType('int', $count); |
| 283 | + }, |
| 284 | + function ($collection, $count) { |
| 285 | + assertType('Illuminate\Support\Collection<int, User>', $collection); |
| 286 | + assertType('int', $count); |
| 287 | + } |
| 288 | + ) |
| 289 | +); |
250 | 290 |
|
251 | 291 | assertType('bool|Illuminate\Support\Collection<int, User>', $collection->whenEmpty(function ($collection) {
|
252 | 292 | assertType('Illuminate\Support\Collection<int, User>', $collection);
|
|
289 | 329 |
|
290 | 330 | return 'string';
|
291 | 331 | }));
|
| 332 | +assertType('Illuminate\Support\Collection<int, User>|void', $collection->unless('Taylor', function ($collection, $name) { |
| 333 | + assertType('Illuminate\Support\Collection<int, User>', $collection); |
| 334 | + assertType('string', $name); |
| 335 | +})); |
| 336 | +assertType( |
| 337 | + 'Illuminate\Support\Collection<int, User>|void', |
| 338 | + $collection->unless( |
| 339 | + 'Taylor', |
| 340 | + function ($collection, $name) { |
| 341 | + assertType('Illuminate\Support\Collection<int, User>', $collection); |
| 342 | + assertType('string', $name); |
| 343 | + }, |
| 344 | + function ($collection, $name) { |
| 345 | + assertType('Illuminate\Support\Collection<int, User>', $collection); |
| 346 | + assertType('string', $name); |
| 347 | + } |
| 348 | + ) |
| 349 | +); |
| 350 | +assertType('Illuminate\Support\Collection<int, User>|void', $collection->unless(fn () => 'Taylor', function ($collection, $name) { |
| 351 | + assertType('Illuminate\Support\Collection<int, User>', $collection); |
| 352 | + assertType('string', $name); |
| 353 | +})); |
| 354 | +assertType( |
| 355 | + 'Illuminate\Support\Collection<int, User>|void', |
| 356 | + $collection->unless( |
| 357 | + function ($collection) { |
| 358 | + assertType('Illuminate\Support\Collection<int, User>', $collection); |
| 359 | + |
| 360 | + return 14; |
| 361 | + }, |
| 362 | + function ($collection, $count) { |
| 363 | + assertType('Illuminate\Support\Collection<int, User>', $collection); |
| 364 | + assertType('int', $count); |
| 365 | + }, |
| 366 | + function ($collection, $count) { |
| 367 | + assertType('Illuminate\Support\Collection<int, User>', $collection); |
| 368 | + assertType('int', $count); |
| 369 | + } |
| 370 | + ) |
| 371 | +); |
292 | 372 |
|
293 | 373 | assertType('bool|Illuminate\Support\Collection<int, User>', $collection->unlessEmpty(function ($collection) {
|
294 | 374 | assertType('Illuminate\Support\Collection<int, User>', $collection);
|
|
0 commit comments