@@ -182,6 +182,8 @@ protected function assertDoesNotMatchRegularExpression(string $pattern, string $
182
182
* Asserts that a variable is empty.
183
183
*
184
184
* @param mixed $actual
185
+ *
186
+ * @phpstan-assert empty $actual
185
187
*/
186
188
protected function assertEmpty ($ actual , string $ message = '' )
187
189
{
@@ -236,6 +238,8 @@ protected function assertEqualsWithDelta($expected, $actual, float $delta, strin
236
238
* Asserts that a condition is false.
237
239
*
238
240
* @param mixed $condition
241
+ *
242
+ * @phpstan-assert false $condition
239
243
*/
240
244
protected function assertFalse ($ condition , string $ message = '' )
241
245
{
@@ -383,7 +387,12 @@ protected function assertInfinite($actual, string $message = '')
383
387
/**
384
388
* Asserts that a variable is of a given type.
385
389
*
390
+ * @template ExpectedType of object
391
+ *
386
392
* @param mixed $actual
393
+ * @param class-string<ExpectedType> $expected
394
+ *
395
+ * @phpstan-assert =ExpectedType $actual
387
396
*/
388
397
protected function assertInstanceOf (string $ expected , $ actual , string $ message = '' )
389
398
{
@@ -394,6 +403,8 @@ protected function assertInstanceOf(string $expected, $actual, string $message =
394
403
* Asserts that a variable is of type array.
395
404
*
396
405
* @param mixed $actual
406
+ *
407
+ * @phpstan-assert array $actual
397
408
*/
398
409
protected function assertIsArray ($ actual , string $ message = '' )
399
410
{
@@ -404,6 +415,8 @@ protected function assertIsArray($actual, string $message = '')
404
415
* Asserts that a variable is of type bool.
405
416
*
406
417
* @param mixed $actual
418
+ *
419
+ * @phpstan-assert bool $actual
407
420
*/
408
421
protected function assertIsBool ($ actual , string $ message = '' )
409
422
{
@@ -414,6 +427,8 @@ protected function assertIsBool($actual, string $message = '')
414
427
* Asserts that a variable is of type callable.
415
428
*
416
429
* @param mixed $actual
430
+ *
431
+ * @phpstan-assert callable $actual
417
432
*/
418
433
protected function assertIsCallable ($ actual , string $ message = '' )
419
434
{
@@ -424,6 +439,8 @@ protected function assertIsCallable($actual, string $message = '')
424
439
* Asserts that a variable is of type resource and is closed.
425
440
*
426
441
* @param mixed $actual
442
+ *
443
+ * @phpstan-assert resource $actual
427
444
*/
428
445
protected function assertIsClosedResource ($ actual , string $ message = '' )
429
446
{
@@ -434,6 +451,8 @@ protected function assertIsClosedResource($actual, string $message = '')
434
451
* Asserts that a variable is of type float.
435
452
*
436
453
* @param mixed $actual
454
+ *
455
+ * @phpstan-assert float $actual
437
456
*/
438
457
protected function assertIsFloat ($ actual , string $ message = '' )
439
458
{
@@ -444,6 +463,8 @@ protected function assertIsFloat($actual, string $message = '')
444
463
* Asserts that a variable is of type int.
445
464
*
446
465
* @param mixed $actual
466
+ *
467
+ * @phpstan-assert int $actual
447
468
*/
448
469
protected function assertIsInt ($ actual , string $ message = '' )
449
470
{
@@ -454,6 +475,8 @@ protected function assertIsInt($actual, string $message = '')
454
475
* Asserts that a variable is of type iterable.
455
476
*
456
477
* @param mixed $actual
478
+ *
479
+ * @phpstan-assert iterable $actual
457
480
*/
458
481
protected function assertIsIterable ($ actual , string $ message = '' )
459
482
{
@@ -464,6 +487,8 @@ protected function assertIsIterable($actual, string $message = '')
464
487
* Asserts that a variable is not of type array.
465
488
*
466
489
* @param mixed $actual
490
+ *
491
+ * @phpstan-assert !array $actual
467
492
*/
468
493
protected function assertIsNotArray ($ actual , string $ message = '' )
469
494
{
@@ -474,6 +499,8 @@ protected function assertIsNotArray($actual, string $message = '')
474
499
* Asserts that a variable is not of type bool.
475
500
*
476
501
* @param mixed $actual
502
+ *
503
+ * @phpstan-assert !bool $actual
477
504
*/
478
505
protected function assertIsNotBool ($ actual , string $ message = '' )
479
506
{
@@ -484,6 +511,8 @@ protected function assertIsNotBool($actual, string $message = '')
484
511
* Asserts that a variable is not of type callable.
485
512
*
486
513
* @param mixed $actual
514
+ *
515
+ * @phpstan-assert !callable $actual
487
516
*/
488
517
protected function assertIsNotCallable ($ actual , string $ message = '' )
489
518
{
@@ -494,6 +523,8 @@ protected function assertIsNotCallable($actual, string $message = '')
494
523
* Asserts that a variable is not of type resource.
495
524
*
496
525
* @param mixed $actual
526
+ *
527
+ * @phpstan-assert !resource $actual
497
528
*/
498
529
protected function assertIsNotClosedResource ($ actual , string $ message = '' )
499
530
{
@@ -504,6 +535,8 @@ protected function assertIsNotClosedResource($actual, string $message = '')
504
535
* Asserts that a variable is not of type float.
505
536
*
506
537
* @param mixed $actual
538
+ *
539
+ * @phpstan-assert !float $actual
507
540
*/
508
541
protected function assertIsNotFloat ($ actual , string $ message = '' )
509
542
{
@@ -514,6 +547,8 @@ protected function assertIsNotFloat($actual, string $message = '')
514
547
* Asserts that a variable is not of type int.
515
548
*
516
549
* @param mixed $actual
550
+ *
551
+ * @phpstan-assert !int $actual
517
552
*/
518
553
protected function assertIsNotInt ($ actual , string $ message = '' )
519
554
{
@@ -524,6 +559,8 @@ protected function assertIsNotInt($actual, string $message = '')
524
559
* Asserts that a variable is not of type iterable.
525
560
*
526
561
* @param mixed $actual
562
+ *
563
+ * @phpstan-assert !iterable $actual
527
564
*/
528
565
protected function assertIsNotIterable ($ actual , string $ message = '' )
529
566
{
@@ -534,6 +571,8 @@ protected function assertIsNotIterable($actual, string $message = '')
534
571
* Asserts that a variable is not of type numeric.
535
572
*
536
573
* @param mixed $actual
574
+ *
575
+ * @phpstan-assert !numeric $actual
537
576
*/
538
577
protected function assertIsNotNumeric ($ actual , string $ message = '' )
539
578
{
@@ -544,6 +583,8 @@ protected function assertIsNotNumeric($actual, string $message = '')
544
583
* Asserts that a variable is not of type object.
545
584
*
546
585
* @param mixed $actual
586
+ *
587
+ * @phpstan-assert !object $actual
547
588
*/
548
589
protected function assertIsNotObject ($ actual , string $ message = '' )
549
590
{
@@ -562,6 +603,8 @@ protected function assertIsNotReadable(string $filename, string $message = '')
562
603
* Asserts that a variable is not of type resource.
563
604
*
564
605
* @param mixed $actual
606
+ *
607
+ * @phpstan-assert !resource $actual
565
608
*/
566
609
protected function assertIsNotResource ($ actual , string $ message = '' )
567
610
{
@@ -572,6 +615,8 @@ protected function assertIsNotResource($actual, string $message = '')
572
615
* Asserts that a variable is not of type scalar.
573
616
*
574
617
* @param mixed $actual
618
+ *
619
+ * @psalm-assert !scalar $actual
575
620
*/
576
621
protected function assertIsNotScalar ($ actual , string $ message = '' )
577
622
{
@@ -582,6 +627,8 @@ protected function assertIsNotScalar($actual, string $message = '')
582
627
* Asserts that a variable is not of type string.
583
628
*
584
629
* @param mixed $actual
630
+ *
631
+ * @phpstan-assert !string $actual
585
632
*/
586
633
protected function assertIsNotString ($ actual , string $ message = '' )
587
634
{
@@ -600,6 +647,8 @@ protected function assertIsNotWritable(string $filename, string $message = '')
600
647
* Asserts that a variable is of type numeric.
601
648
*
602
649
* @param mixed $actual
650
+ *
651
+ * @phpstan-assert numeric $actual
603
652
*/
604
653
protected function assertIsNumeric ($ actual , string $ message = '' )
605
654
{
@@ -610,6 +659,8 @@ protected function assertIsNumeric($actual, string $message = '')
610
659
* Asserts that a variable is of type object.
611
660
*
612
661
* @param mixed $actual
662
+ *
663
+ * @phpstan-assert object $actual
613
664
*/
614
665
protected function assertIsObject ($ actual , string $ message = '' )
615
666
{
@@ -628,6 +679,8 @@ protected function assertIsReadable(string $filename, string $message = '')
628
679
* Asserts that a variable is of type resource.
629
680
*
630
681
* @param mixed $actual
682
+ *
683
+ * @phpstan-assert resource $actual
631
684
*/
632
685
protected function assertIsResource ($ actual , string $ message = '' )
633
686
{
@@ -638,6 +691,8 @@ protected function assertIsResource($actual, string $message = '')
638
691
* Asserts that a variable is of type scalar.
639
692
*
640
693
* @param mixed $actual
694
+ *
695
+ * @phpstan-assert scalar $actual
641
696
*/
642
697
protected function assertIsScalar ($ actual , string $ message = '' )
643
698
{
@@ -648,6 +703,8 @@ protected function assertIsScalar($actual, string $message = '')
648
703
* Asserts that a variable is of type string.
649
704
*
650
705
* @param mixed $actual
706
+ *
707
+ * @phpstan-assert string $actual
651
708
*/
652
709
protected function assertIsString ($ actual , string $ message = '' )
653
710
{
@@ -795,6 +852,8 @@ protected function assertNotCount(int $expectedCount, $haystack, string $message
795
852
* Asserts that a variable is not empty.
796
853
*
797
854
* @param mixed $actual
855
+ *
856
+ * @phpstan-assert !empty $actual
798
857
*/
799
858
protected function assertNotEmpty ($ actual , string $ message = '' )
800
859
{
@@ -849,6 +908,8 @@ protected function assertNotEqualsWithDelta($expected, $actual, float $delta, st
849
908
* Asserts that a condition is not false.
850
909
*
851
910
* @param mixed $condition
911
+ *
912
+ * @phpstan-assert !false $condition
852
913
*/
853
914
protected function assertNotFalse ($ condition , string $ message = '' )
854
915
{
@@ -858,7 +919,12 @@ protected function assertNotFalse($condition, string $message = '')
858
919
/**
859
920
* Asserts that a variable is not of a given type.
860
921
*
922
+ * @template ExpectedType of object
923
+ *
861
924
* @param mixed $actual
925
+ * @param class-string<ExpectedType> $expected
926
+ *
927
+ * @phpstan-assert !ExpectedType $actual
862
928
*/
863
929
protected function assertNotInstanceOf (string $ expected , $ actual , string $ message = '' )
864
930
{
@@ -869,6 +935,8 @@ protected function assertNotInstanceOf(string $expected, $actual, string $messag
869
935
* Asserts that a variable is not null.
870
936
*
871
937
* @param mixed $actual
938
+ *
939
+ * @phpstan-assert !null $actual
872
940
*/
873
941
protected function assertNotNull ($ actual , string $ message = '' )
874
942
{
@@ -901,6 +969,8 @@ protected function assertNotSameSize($expected, $actual, string $message = '')
901
969
* Asserts that a condition is not true.
902
970
*
903
971
* @param mixed $condition
972
+ *
973
+ * @phpstan-assert !true $condition
904
974
*/
905
975
protected function assertNotTrue ($ condition , string $ message = '' )
906
976
{
@@ -911,6 +981,8 @@ protected function assertNotTrue($condition, string $message = '')
911
981
* Asserts that a variable is null.
912
982
*
913
983
* @param mixed $actual
984
+ *
985
+ * @phpstan-assert null $actual
914
986
*/
915
987
protected function assertNull ($ actual , string $ message = '' )
916
988
{
@@ -947,9 +1019,15 @@ protected function assertObjectNotHasAttribute(string $attributeName, object $ob
947
1019
948
1020
/**
949
1021
* Asserts that two variables have the same type and value.
1022
+ * Used on objects, it asserts that two variables reference
1023
+ * the same object.
950
1024
*
951
- * @param mixed $expected
1025
+ * @template ExpectedType
1026
+ *
1027
+ * @param ExpectedType $expected
952
1028
* @param mixed $actual
1029
+ *
1030
+ * @phpstan-assert =ExpectedType $actual
953
1031
*/
954
1032
protected function assertSame ($ expected , $ actual , string $ message = '' )
955
1033
{
@@ -1113,6 +1191,8 @@ protected function assertThat($value, PHPUnitConstraint $constraint, string $mes
1113
1191
* Asserts that a condition is true.
1114
1192
*
1115
1193
* @param mixed $condition
1194
+ *
1195
+ * @phpstan-assert true $condition
1116
1196
*/
1117
1197
protected function assertTrue ($ condition , string $ message = '' )
1118
1198
{
0 commit comments