@@ -892,7 +892,7 @@ public function specifyTypesInCondition(
892892 return $ exprType ->unionWith ($ this ->create (
893893 new IssetExpr ($ issetExpr ),
894894 new NullType (),
895- $ context ,
895+ TypeSpecifierContext:: createFalse () ,
896896 $ scope ,
897897 ))->setRootExpr ($ expr );
898898 }
@@ -902,7 +902,7 @@ public function specifyTypesInCondition(
902902 return $ exprType ->unionWith ($ this ->create (
903903 new IssetExpr ($ issetExpr ),
904904 new NullType (),
905- $ context -> negate (),
905+ TypeSpecifierContext:: createTruthy (),
906906 $ scope ,
907907 ))->setRootExpr ($ expr );
908908 }
@@ -929,23 +929,24 @@ public function specifyTypesInCondition(
929929 $ dimType = $ scope ->getType ($ issetExpr ->dim );
930930
931931 if ($ dimType instanceof ConstantIntegerType || $ dimType instanceof ConstantStringType) {
932- $ types = $ varType instanceof UnionType ? $ varType -> getTypes () : [ $ varType ] ;
932+ $ constantArrays = $ varType-> getConstantArrays () ;
933933 $ typesToRemove = [];
934- foreach ($ types as $ innerType ) {
935- $ hasOffset = $ innerType ->hasOffsetValueType ($ dimType );
936- if (!$ hasOffset ->yes () || !$ innerType ->getOffsetValueType ($ dimType )->isNull ()->no ()) {
934+ foreach ($ constantArrays as $ constantArray ) {
935+ $ hasOffset = $ constantArray ->hasOffsetValueType ($ dimType );
936+ if (!$ hasOffset ->yes () || !$ constantArray ->getOffsetValueType ($ dimType )->isNull ()->no ()) {
937937 continue ;
938938 }
939939
940- $ typesToRemove [] = $ innerType ;
940+ $ typesToRemove [] = $ constantArray ;
941941 }
942942
943943 if ($ typesToRemove !== []) {
944944 $ typeToRemove = TypeCombinator::union (...$ typesToRemove );
945+
945946 $ result = $ this ->create (
946947 $ issetExpr ->var ,
947948 $ typeToRemove ,
948- TypeSpecifierContext:: createFalse () ,
949+ $ context ,
949950 $ scope ,
950951 )->setRootExpr ($ expr );
951952
@@ -954,7 +955,7 @@ public function specifyTypesInCondition(
954955 $ this ->create (
955956 new IssetExpr ($ issetExpr ->var ),
956957 new NullType (),
957- TypeSpecifierContext:: createTruthy (),
958+ $ context -> negate (),
958959 $ scope ,
959960 )->setRootExpr ($ expr ),
960961 );
0 commit comments