@@ -526,6 +526,7 @@ public function sayEmptyArray(
526526 * @param array{} $emptyArr
527527 * @param 'php' $phpStr
528528 * @param '' $emptyStr
529+ * @param non-falsy-string $nonFalsyString
529530 */
530531 public function sayNonFalsyStr (
531532 $ true ,
@@ -540,7 +541,8 @@ public function sayNonFalsyStr(
540541 $ null ,
541542 $ emptyArr ,
542543 $ phpStr ,
543- $ emptyStr
544+ $ emptyStr ,
545+ $ nonFalsyString
544546 ): void
545547 {
546548 assertType ('true ' , $ phpStr == $ true );
@@ -555,6 +557,100 @@ public function sayNonFalsyStr(
555557 assertType ('false ' , $ phpStr == $ emptyArr );
556558 assertType ('true ' , $ phpStr == $ phpStr );
557559 assertType ('false ' , $ phpStr == $ emptyStr );
560+
561+ assertType ('bool ' , $ nonFalsyString == $ true );
562+ assertType ('false ' , $ nonFalsyString == $ false );
563+ assertType ('bool ' , $ nonFalsyString == $ one );
564+ assertType ('false ' , $ nonFalsyString == $ zero );
565+ assertType ('bool ' , $ nonFalsyString == $ minusOne );
566+ assertType ('bool ' , $ nonFalsyString == $ oneStr );
567+ assertType ('false ' , $ nonFalsyString == $ zeroStr );
568+ assertType ('bool ' , $ nonFalsyString == $ minusOneStr );
569+ assertType ('bool ' , $ nonFalsyString == $ plusOneStr );
570+ assertType ('false ' , $ nonFalsyString == $ null );
571+ assertType ('false ' , $ nonFalsyString == $ emptyArr );
572+ assertType ('bool ' , $ nonFalsyString == $ phpStr );
573+ assertType ('false ' , $ nonFalsyString == $ emptyStr );
574+ }
575+
576+ /**
577+ * @param true $true
578+ * @param false $false
579+ * @param 1 $one
580+ * @param 0 $zero
581+ * @param -1 $minusOne
582+ * @param '1' $oneStr
583+ * @param '0' $zeroStr
584+ * @param '-1' $minusOneStr
585+ * @param '+1' $plusOneStr
586+ * @param null $null
587+ * @param array{} $emptyArr
588+ * @param 'php' $phpStr
589+ * @param '' $emptyStr
590+ * @param numeric-string $numericStr
591+ */
592+ public function sayStr (
593+ $ true ,
594+ $ false ,
595+ $ one ,
596+ $ zero ,
597+ $ minusOne ,
598+ $ oneStr ,
599+ $ zeroStr ,
600+ $ minusOneStr ,
601+ $ plusOneStr ,
602+ $ null ,
603+ $ emptyArr ,
604+ string $ string ,
605+ $ phpStr ,
606+ $ emptyStr ,
607+ $ numericStr ,
608+ ?string $ stringOrNull ,
609+ ): void
610+ {
611+ assertType ('bool ' , $ string == $ true );
612+ assertType ('bool ' , $ string == $ false );
613+ assertType ('bool ' , $ string == $ one );
614+ assertType ('bool ' , $ string == $ zero );
615+ assertType ('bool ' , $ string == $ minusOne );
616+ assertType ('bool ' , $ string == $ oneStr );
617+ assertType ('bool ' , $ string == $ zeroStr );
618+ assertType ('bool ' , $ string == $ minusOneStr );
619+ assertType ('bool ' , $ string == $ plusOneStr );
620+ assertType ('bool ' , $ string == $ null );
621+ assertType ('bool ' , $ string == $ stringOrNull );
622+ assertType ('false ' , $ string == $ emptyArr );
623+ assertType ('bool ' , $ string == $ phpStr );
624+ assertType ('bool ' , $ string == $ emptyStr );
625+ assertType ('bool ' , $ string == $ numericStr );
626+
627+ assertType ('bool ' , $ numericStr == $ true );
628+ assertType ('bool ' , $ numericStr == $ false );
629+ assertType ('bool ' , $ numericStr == $ one );
630+ assertType ('bool ' , $ numericStr == $ zero );
631+ assertType ('bool ' , $ numericStr == $ minusOne );
632+ assertType ('bool ' , $ numericStr == $ oneStr );
633+ assertType ('bool ' , $ numericStr == $ zeroStr );
634+ assertType ('bool ' , $ numericStr == $ minusOneStr );
635+ assertType ('bool ' , $ numericStr == $ plusOneStr );
636+ assertType ('false ' , $ numericStr == $ null );
637+ assertType ('bool ' , $ numericStr == $ stringOrNull );
638+ assertType ('false ' , $ numericStr == $ emptyArr );
639+ assertType ('bool ' , $ numericStr == $ string );
640+ assertType ('false ' , $ numericStr == $ phpStr );
641+ assertType ('false ' , $ numericStr == $ emptyStr );
642+ if (is_numeric ($ string )) {
643+ assertType ('bool ' , $ numericStr == $ string );
644+ }
645+
646+ assertType ('false ' , "" == 1 );
647+ assertType ('true ' , "" == null );
648+ assertType ('false ' , "" == true );
649+ assertType ('true ' , "" == false );
650+ assertType ('false ' , "" == "1 " );
651+ assertType ('false ' , "" == "0 " );
652+ assertType ('false ' , "" == "-1 " );
653+ assertType ('false ' , "" == []);
558654 }
559655
560656 /**
@@ -657,11 +753,13 @@ public function sayInt(
657753 * @param true|1|"1" $looseOne
658754 * @param false|0|"0" $looseZero
659755 * @param false|1 $constMix
756+ * @param "abc"|"def" $constNonFalsy
660757 */
661758 public function sayConstUnion (
662759 $ looseOne ,
663760 $ looseZero ,
664- $ constMix
761+ $ constMix ,
762+ $ constNonFalsy ,
665763 ): void
666764 {
667765 assertType ('true ' , $ looseOne == 1 );
@@ -696,6 +794,14 @@ public function sayConstUnion(
696794 assertType ('bool ' , $ constMix == $ looseOne );
697795 assertType ('bool ' , $ looseZero == $ constMix );
698796 assertType ('bool ' , $ constMix == $ looseZero );
797+
798+ assertType ('false ' , $ constNonFalsy == 1 );
799+ assertType ('false ' , $ constNonFalsy == null );
800+ assertType ('true ' , $ constNonFalsy == true );
801+ assertType ('false ' , $ constNonFalsy == false );
802+ assertType ('false ' , $ constNonFalsy == "1 " );
803+ assertType ('false ' , $ constNonFalsy == "0 " );
804+ assertType ('false ' , $ constNonFalsy == []);
699805 }
700806
701807 /**
0 commit comments