File tree Expand file tree Collapse file tree
rules/Privatization/TypeManipulator Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,7 +57,8 @@ public function generalizeConstantBoolTypes(Type $type): Type
5757 */
5858 public function generalizeConstantTypes (Type $ type ): Type
5959 {
60- return TypeTraverser::map ($ type , function (Type $ type , callable $ traverseCallback ): Type {
60+ $ originalType = $ type ;
61+ return TypeTraverser::map ($ type , function (Type $ type , callable $ traverseCallback ) use ($ originalType ): Type {
6162 if ($ type instanceof AccessoryNonFalsyStringType || $ type instanceof AccessoryLiteralStringType || $ type instanceof AccessoryNonEmptyStringType) {
6263 return new StringType ();
6364 }
@@ -81,7 +82,7 @@ public function generalizeConstantTypes(Type $type): Type
8182 if ($ type instanceof ConstantArrayType) {
8283 // is relevant int constantArrayType?
8384 if ($ this ->isImplicitNumberedListKeyType ($ type )) {
84- $ keyType = new MixedType ();
85+ $ keyType = $ originalType === $ type ? new MixedType () : new IntegerType ();
8586 } else {
8687 $ keyType = $ this ->generalizeConstantTypes ($ type ->getKeyType ());
8788 }
You can’t perform that action at this time.
0 commit comments