@@ -104,28 +104,18 @@ public function getTypeFromFunctionCall(FunctionReflection $functionReflection,
104104 if ($ flagArg !== null ) {
105105 $ flagState = $ this ->bitwiseFlagAnalyser ->bitwiseOrContainsConstant ($ flagArg ->value , $ scope , 'PREG_SPLIT_OFFSET_CAPTURE ' );
106106 if ($ flagState ->yes ()) {
107+ $ arrayType = TypeCombinator::intersect (
108+ new ArrayType (new IntegerType (), $ capturedArrayType ),
109+ new AccessoryArrayListType (),
110+ );
111+
107112 if ($ subjectType ->isNonEmptyString ()->yes ()) {
108- return TypeUtils::toBenevolentUnion (
109- TypeCombinator::union (
110- TypeCombinator::intersect (
111- new ArrayType (new IntegerType (), $ capturedArrayType ),
112- new NonEmptyArrayType (),
113- new AccessoryArrayListType (),
114- ),
115- new ConstantBooleanType (false )
116- )
117- );
118- } else {
119- return TypeUtils::toBenevolentUnion (
120- TypeCombinator::union (
121- TypeCombinator::intersect (
122- new ArrayType (new IntegerType (), $ capturedArrayType ),
123- new AccessoryArrayListType (),
124- ),
125- new ConstantBooleanType (false )
126- )
127- );
113+ $ arrayType = TypeCombinator::intersect ($ arrayType , new NonEmptyArrayType ());
128114 }
115+
116+ return TypeUtils::toBenevolentUnion (
117+ TypeCombinator::union ($ arrayType , new ConstantBooleanType (false ))
118+ );
129119 }
130120 if ($ flagState ->maybe ()) {
131121 $ valueType = TypeCombinator::union (new StringType (), $ capturedArrayType );
0 commit comments