Skip to content

Commit 4b36054

Browse files
committed
use increment
1 parent e504202 commit 4b36054

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

rules/Privatization/TypeManipulator/TypeNormalizer.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ public function generalizeConstantBoolTypes(Type $type): Type
5757
*/
5858
public function generalizeConstantTypes(Type $type): Type
5959
{
60-
$originalType = $type;
61-
return TypeTraverser::map($type, function (Type $type, callable $traverseCallback) use ($originalType): Type {
60+
$deep = 0;
61+
return TypeTraverser::map($type, function (Type $type, callable $traverseCallback) use (&$deep): Type {
62+
++$deep;
6263
if ($type instanceof AccessoryNonFalsyStringType || $type instanceof AccessoryLiteralStringType || $type instanceof AccessoryNonEmptyStringType) {
6364
return new StringType();
6465
}
@@ -82,7 +83,7 @@ public function generalizeConstantTypes(Type $type): Type
8283
if ($type instanceof ConstantArrayType) {
8384
// is relevant int constantArrayType?
8485
if ($this->isImplicitNumberedListKeyType($type)) {
85-
$keyType = $originalType === $type ? new MixedType() : new IntegerType();
86+
$keyType = $deep === 1 ? new MixedType() : new IntegerType();
8687
} else {
8788
$keyType = $this->generalizeConstantTypes($type->getKeyType());
8889
}

0 commit comments

Comments
 (0)