@@ -591,33 +591,37 @@ public function resolveConcatType(Type $left, Type $right): Type
591591 $ accessoryTypes [] = new AccessoryUppercaseStringType ();
592592 }
593593
594- $ leftNumericStringNonEmpty = TypeCombinator::remove ($ leftStringType , new ConstantStringType ('' ));
595- if ($ leftNumericStringNonEmpty ->isNumericString ()->yes ()) {
596- $ validationCallback = $ left ->isInteger ()->yes ()
597- ? static fn (string $ value ): bool => !str_starts_with ($ value , '- ' )
598- : static fn (string $ value ): bool => Strings::match ($ value , '#^\d+$# ' ) !== null ;
599-
600- $ allRightConstantsZeroOrMore = false ;
601- foreach ($ rightConstantStrings as $ rightConstantString ) {
602- if ($ rightConstantString ->getValue () === '' ) {
603- continue ;
604- }
594+ if ($ leftStringType ->isDecimalIntegerString ()->and ($ rightStringType ->isDecimalIntegerString ())->yes ()) {
595+ $ accessoryTypes [] = new AccessoryUppercaseStringType ();
596+ } else {
597+ $ leftNumericStringNonEmpty = TypeCombinator::remove ($ leftStringType , new ConstantStringType ('' ));
598+ if ($ leftNumericStringNonEmpty ->isNumericString ()->yes ()) {
599+ $ validationCallback = $ left ->isInteger ()->yes ()
600+ ? static fn (string $ value ): bool => !str_starts_with ($ value , '- ' )
601+ : static fn (string $ value ): bool => Strings::match ($ value , '#^\d+$# ' ) !== null ;
605602
606- if (
607- !is_numeric ($ rightConstantString ->getValue ())
608- || !$ validationCallback ($ rightConstantString ->getValue ())
609- ) {
610- $ allRightConstantsZeroOrMore = false ;
611- break ;
612- }
603+ $ allRightConstantsZeroOrMore = false ;
604+ foreach ($ rightConstantStrings as $ rightConstantString ) {
605+ if ($ rightConstantString ->getValue () === '' ) {
606+ continue ;
607+ }
613608
614- $ allRightConstantsZeroOrMore = true ;
615- }
609+ if (
610+ !is_numeric ($ rightConstantString ->getValue ())
611+ || !$ validationCallback ($ rightConstantString ->getValue ())
612+ ) {
613+ $ allRightConstantsZeroOrMore = false ;
614+ break ;
615+ }
616+
617+ $ allRightConstantsZeroOrMore = true ;
618+ }
616619
617- $ zeroOrMoreInteger = IntegerRangeType::fromInterval (0 , null );
618- $ nonNegativeRight = $ allRightConstantsZeroOrMore || $ zeroOrMoreInteger ->isSuperTypeOf ($ right )->yes ();
619- if ($ nonNegativeRight ) {
620- $ accessoryTypes [] = new AccessoryNumericStringType ();
620+ $ zeroOrMoreInteger = IntegerRangeType::fromInterval (0 , null );
621+ $ nonNegativeRight = $ allRightConstantsZeroOrMore || $ zeroOrMoreInteger ->isSuperTypeOf ($ right )->yes ();
622+ if ($ nonNegativeRight ) {
623+ $ accessoryTypes [] = new AccessoryNumericStringType ();
624+ }
621625 }
622626 }
623627
0 commit comments