@@ -182,6 +182,8 @@ protected function assertDoesNotMatchRegularExpression(string $pattern, string $
182182 * Asserts that a variable is empty.
183183 *
184184 * @param mixed $actual
185+ *
186+ * @phpstan-assert empty $actual
185187 */
186188 protected function assertEmpty ($ actual , string $ message = '' )
187189 {
@@ -236,6 +238,8 @@ protected function assertEqualsWithDelta($expected, $actual, float $delta, strin
236238 * Asserts that a condition is false.
237239 *
238240 * @param mixed $condition
241+ *
242+ * @phpstan-assert false $condition
239243 */
240244 protected function assertFalse ($ condition , string $ message = '' )
241245 {
@@ -383,7 +387,12 @@ protected function assertInfinite($actual, string $message = '')
383387 /**
384388 * Asserts that a variable is of a given type.
385389 *
390+ * @template ExpectedType of object
391+ *
386392 * @param mixed $actual
393+ * @param class-string<ExpectedType> $expected
394+ *
395+ * @phpstan-assert =ExpectedType $actual
387396 */
388397 protected function assertInstanceOf (string $ expected , $ actual , string $ message = '' )
389398 {
@@ -394,6 +403,8 @@ protected function assertInstanceOf(string $expected, $actual, string $message =
394403 * Asserts that a variable is of type array.
395404 *
396405 * @param mixed $actual
406+ *
407+ * @phpstan-assert array $actual
397408 */
398409 protected function assertIsArray ($ actual , string $ message = '' )
399410 {
@@ -404,6 +415,8 @@ protected function assertIsArray($actual, string $message = '')
404415 * Asserts that a variable is of type bool.
405416 *
406417 * @param mixed $actual
418+ *
419+ * @phpstan-assert bool $actual
407420 */
408421 protected function assertIsBool ($ actual , string $ message = '' )
409422 {
@@ -414,6 +427,8 @@ protected function assertIsBool($actual, string $message = '')
414427 * Asserts that a variable is of type callable.
415428 *
416429 * @param mixed $actual
430+ *
431+ * @phpstan-assert callable $actual
417432 */
418433 protected function assertIsCallable ($ actual , string $ message = '' )
419434 {
@@ -424,6 +439,8 @@ protected function assertIsCallable($actual, string $message = '')
424439 * Asserts that a variable is of type resource and is closed.
425440 *
426441 * @param mixed $actual
442+ *
443+ * @phpstan-assert resource $actual
427444 */
428445 protected function assertIsClosedResource ($ actual , string $ message = '' )
429446 {
@@ -434,6 +451,8 @@ protected function assertIsClosedResource($actual, string $message = '')
434451 * Asserts that a variable is of type float.
435452 *
436453 * @param mixed $actual
454+ *
455+ * @phpstan-assert float $actual
437456 */
438457 protected function assertIsFloat ($ actual , string $ message = '' )
439458 {
@@ -444,6 +463,8 @@ protected function assertIsFloat($actual, string $message = '')
444463 * Asserts that a variable is of type int.
445464 *
446465 * @param mixed $actual
466+ *
467+ * @phpstan-assert int $actual
447468 */
448469 protected function assertIsInt ($ actual , string $ message = '' )
449470 {
@@ -454,6 +475,8 @@ protected function assertIsInt($actual, string $message = '')
454475 * Asserts that a variable is of type iterable.
455476 *
456477 * @param mixed $actual
478+ *
479+ * @phpstan-assert iterable $actual
457480 */
458481 protected function assertIsIterable ($ actual , string $ message = '' )
459482 {
@@ -464,6 +487,8 @@ protected function assertIsIterable($actual, string $message = '')
464487 * Asserts that a variable is not of type array.
465488 *
466489 * @param mixed $actual
490+ *
491+ * @phpstan-assert !array $actual
467492 */
468493 protected function assertIsNotArray ($ actual , string $ message = '' )
469494 {
@@ -474,6 +499,8 @@ protected function assertIsNotArray($actual, string $message = '')
474499 * Asserts that a variable is not of type bool.
475500 *
476501 * @param mixed $actual
502+ *
503+ * @phpstan-assert !bool $actual
477504 */
478505 protected function assertIsNotBool ($ actual , string $ message = '' )
479506 {
@@ -484,6 +511,8 @@ protected function assertIsNotBool($actual, string $message = '')
484511 * Asserts that a variable is not of type callable.
485512 *
486513 * @param mixed $actual
514+ *
515+ * @phpstan-assert !callable $actual
487516 */
488517 protected function assertIsNotCallable ($ actual , string $ message = '' )
489518 {
@@ -494,6 +523,8 @@ protected function assertIsNotCallable($actual, string $message = '')
494523 * Asserts that a variable is not of type resource.
495524 *
496525 * @param mixed $actual
526+ *
527+ * @phpstan-assert !resource $actual
497528 */
498529 protected function assertIsNotClosedResource ($ actual , string $ message = '' )
499530 {
@@ -504,6 +535,8 @@ protected function assertIsNotClosedResource($actual, string $message = '')
504535 * Asserts that a variable is not of type float.
505536 *
506537 * @param mixed $actual
538+ *
539+ * @phpstan-assert !float $actual
507540 */
508541 protected function assertIsNotFloat ($ actual , string $ message = '' )
509542 {
@@ -514,6 +547,8 @@ protected function assertIsNotFloat($actual, string $message = '')
514547 * Asserts that a variable is not of type int.
515548 *
516549 * @param mixed $actual
550+ *
551+ * @phpstan-assert !int $actual
517552 */
518553 protected function assertIsNotInt ($ actual , string $ message = '' )
519554 {
@@ -524,6 +559,8 @@ protected function assertIsNotInt($actual, string $message = '')
524559 * Asserts that a variable is not of type iterable.
525560 *
526561 * @param mixed $actual
562+ *
563+ * @phpstan-assert !iterable $actual
527564 */
528565 protected function assertIsNotIterable ($ actual , string $ message = '' )
529566 {
@@ -534,6 +571,8 @@ protected function assertIsNotIterable($actual, string $message = '')
534571 * Asserts that a variable is not of type numeric.
535572 *
536573 * @param mixed $actual
574+ *
575+ * @phpstan-assert !numeric $actual
537576 */
538577 protected function assertIsNotNumeric ($ actual , string $ message = '' )
539578 {
@@ -544,6 +583,8 @@ protected function assertIsNotNumeric($actual, string $message = '')
544583 * Asserts that a variable is not of type object.
545584 *
546585 * @param mixed $actual
586+ *
587+ * @phpstan-assert !object $actual
547588 */
548589 protected function assertIsNotObject ($ actual , string $ message = '' )
549590 {
@@ -562,6 +603,8 @@ protected function assertIsNotReadable(string $filename, string $message = '')
562603 * Asserts that a variable is not of type resource.
563604 *
564605 * @param mixed $actual
606+ *
607+ * @phpstan-assert !resource $actual
565608 */
566609 protected function assertIsNotResource ($ actual , string $ message = '' )
567610 {
@@ -572,6 +615,8 @@ protected function assertIsNotResource($actual, string $message = '')
572615 * Asserts that a variable is not of type scalar.
573616 *
574617 * @param mixed $actual
618+ *
619+ * @psalm-assert !scalar $actual
575620 */
576621 protected function assertIsNotScalar ($ actual , string $ message = '' )
577622 {
@@ -582,6 +627,8 @@ protected function assertIsNotScalar($actual, string $message = '')
582627 * Asserts that a variable is not of type string.
583628 *
584629 * @param mixed $actual
630+ *
631+ * @phpstan-assert !string $actual
585632 */
586633 protected function assertIsNotString ($ actual , string $ message = '' )
587634 {
@@ -600,6 +647,8 @@ protected function assertIsNotWritable(string $filename, string $message = '')
600647 * Asserts that a variable is of type numeric.
601648 *
602649 * @param mixed $actual
650+ *
651+ * @phpstan-assert numeric $actual
603652 */
604653 protected function assertIsNumeric ($ actual , string $ message = '' )
605654 {
@@ -610,6 +659,8 @@ protected function assertIsNumeric($actual, string $message = '')
610659 * Asserts that a variable is of type object.
611660 *
612661 * @param mixed $actual
662+ *
663+ * @phpstan-assert object $actual
613664 */
614665 protected function assertIsObject ($ actual , string $ message = '' )
615666 {
@@ -628,6 +679,8 @@ protected function assertIsReadable(string $filename, string $message = '')
628679 * Asserts that a variable is of type resource.
629680 *
630681 * @param mixed $actual
682+ *
683+ * @phpstan-assert resource $actual
631684 */
632685 protected function assertIsResource ($ actual , string $ message = '' )
633686 {
@@ -638,6 +691,8 @@ protected function assertIsResource($actual, string $message = '')
638691 * Asserts that a variable is of type scalar.
639692 *
640693 * @param mixed $actual
694+ *
695+ * @phpstan-assert scalar $actual
641696 */
642697 protected function assertIsScalar ($ actual , string $ message = '' )
643698 {
@@ -648,6 +703,8 @@ protected function assertIsScalar($actual, string $message = '')
648703 * Asserts that a variable is of type string.
649704 *
650705 * @param mixed $actual
706+ *
707+ * @phpstan-assert string $actual
651708 */
652709 protected function assertIsString ($ actual , string $ message = '' )
653710 {
@@ -795,6 +852,8 @@ protected function assertNotCount(int $expectedCount, $haystack, string $message
795852 * Asserts that a variable is not empty.
796853 *
797854 * @param mixed $actual
855+ *
856+ * @phpstan-assert !empty $actual
798857 */
799858 protected function assertNotEmpty ($ actual , string $ message = '' )
800859 {
@@ -849,6 +908,8 @@ protected function assertNotEqualsWithDelta($expected, $actual, float $delta, st
849908 * Asserts that a condition is not false.
850909 *
851910 * @param mixed $condition
911+ *
912+ * @phpstan-assert !false $condition
852913 */
853914 protected function assertNotFalse ($ condition , string $ message = '' )
854915 {
@@ -858,7 +919,12 @@ protected function assertNotFalse($condition, string $message = '')
858919 /**
859920 * Asserts that a variable is not of a given type.
860921 *
922+ * @template ExpectedType of object
923+ *
861924 * @param mixed $actual
925+ * @param class-string<ExpectedType> $expected
926+ *
927+ * @phpstan-assert !ExpectedType $actual
862928 */
863929 protected function assertNotInstanceOf (string $ expected , $ actual , string $ message = '' )
864930 {
@@ -869,6 +935,8 @@ protected function assertNotInstanceOf(string $expected, $actual, string $messag
869935 * Asserts that a variable is not null.
870936 *
871937 * @param mixed $actual
938+ *
939+ * @phpstan-assert !null $actual
872940 */
873941 protected function assertNotNull ($ actual , string $ message = '' )
874942 {
@@ -901,6 +969,8 @@ protected function assertNotSameSize($expected, $actual, string $message = '')
901969 * Asserts that a condition is not true.
902970 *
903971 * @param mixed $condition
972+ *
973+ * @phpstan-assert !true $condition
904974 */
905975 protected function assertNotTrue ($ condition , string $ message = '' )
906976 {
@@ -911,6 +981,8 @@ protected function assertNotTrue($condition, string $message = '')
911981 * Asserts that a variable is null.
912982 *
913983 * @param mixed $actual
984+ *
985+ * @phpstan-assert null $actual
914986 */
915987 protected function assertNull ($ actual , string $ message = '' )
916988 {
@@ -947,9 +1019,15 @@ protected function assertObjectNotHasAttribute(string $attributeName, object $ob
9471019
9481020 /**
9491021 * Asserts that two variables have the same type and value.
1022+ * Used on objects, it asserts that two variables reference
1023+ * the same object.
9501024 *
951- * @param mixed $expected
1025+ * @template ExpectedType
1026+ *
1027+ * @param ExpectedType $expected
9521028 * @param mixed $actual
1029+ *
1030+ * @phpstan-assert =ExpectedType $actual
9531031 */
9541032 protected function assertSame ($ expected , $ actual , string $ message = '' )
9551033 {
@@ -1113,6 +1191,8 @@ protected function assertThat($value, PHPUnitConstraint $constraint, string $mes
11131191 * Asserts that a condition is true.
11141192 *
11151193 * @param mixed $condition
1194+ *
1195+ * @phpstan-assert true $condition
11161196 */
11171197 protected function assertTrue ($ condition , string $ message = '' )
11181198 {
0 commit comments