File tree Expand file tree Collapse file tree 2 files changed +19
-7
lines changed
tests/PHPStan/Analyser/nsrt Expand file tree Collapse file tree 2 files changed +19
-7
lines changed Original file line number Diff line number Diff line change @@ -1313,14 +1313,15 @@ private function specifyTypesForConstantStringBinaryExpression(
13131313 ) {
13141314 $ argType = $ scope ->getType ($ exprNode ->getArgs ()[0 ]->value );
13151315
1316- if ($ argType ->isString ()->yes ()) {
1317- return $ this ->create (
1318- $ exprNode ->getArgs ()[0 ]->value ,
1316+ return $ this ->create (
1317+ $ exprNode ->getArgs ()[0 ]->value ,
1318+ TypeCombinator::intersect (
1319+ new StringType (),
13191320 new AccessoryNonEmptyStringType (),
1320- $ context -> negate ( ),
1321- $ scope ,
1322- )-> setRootExpr ( $ rootExpr );
1323- }
1321+ ),
1322+ $ context -> negate () ,
1323+ $ scope ,
1324+ )-> setRootExpr ( $ rootExpr );
13241325 }
13251326
13261327 return null ;
Original file line number Diff line number Diff line change @@ -16,6 +16,17 @@ function nullIfBlank(?string $value): ?string
1616 return null ;
1717}
1818
19+ function trimMixed ($ value ): void
20+ {
21+ if (trim ($ value ) === '' ) {
22+ assertType ('mixed ' , $ value );
23+ } else {
24+ assertType ('non-empty-string ' , $ value );
25+ }
26+ assertType ('mixed ' , $ value );
27+
28+ }
29+
1930function trimTypes (string $ value ): void
2031{
2132 if (trim ($ value ) === '' ) {
You can’t perform that action at this time.
0 commit comments