Skip to content

Commit 71c0efb

Browse files
committed
cleanup denom
1 parent 307f03c commit 71c0efb

1 file changed

Lines changed: 0 additions & 39 deletions

File tree

rules/Privatization/TypeManipulator/ArrayTypeLeastCommonDenominatorResolver.php

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
use PHPStan\Type\NeverType;
1111
use PHPStan\Type\Type;
1212
use PHPStan\Type\TypeCombinator;
13-
use PHPStan\Type\VerbosityLevel;
1413

1514
/**
1615
* Made with GPT-5
@@ -37,44 +36,6 @@ public function sharedArrayStructure(Type ...$types): Type
3736
}
3837
}
3938

40-
// If all are ConstantArrayType and have the *same* ordered key list -> preserve shape.
41-
$allConstantArrayTypes = array_reduce($types, fn ($c, $t): bool => $c && $t instanceof ConstantArrayType, true);
42-
if ($allConstantArrayTypes) {
43-
$consts = array_filter($types, static fn (Type $type): bool => $type instanceof ConstantArrayType);
44-
45-
// Compare key sets (by stringified key types)
46-
$firstKeys = array_map(
47-
fn (Type $type): string => $type->describe(VerbosityLevel::typeOnly()),
48-
$consts[0]->getKeyTypes()
49-
);
50-
foreach ($consts as $c) {
51-
$keys = array_map(
52-
fn (Type $type): string => $type->describe(VerbosityLevel::typeOnly()),
53-
$c->getKeyTypes()
54-
);
55-
if ($keys !== $firstKeys) {
56-
$allConstantArrayTypes = false;
57-
break;
58-
}
59-
}
60-
61-
if ($allConstantArrayTypes) {
62-
$resultKeyTypes = $consts[0]->getKeyTypes();
63-
$valueColumns = [];
64-
foreach ($consts as $const) {
65-
$valueColumns[] = $const->getValueTypes();
66-
}
67-
68-
$resultValueTypes = [];
69-
foreach (array_keys($resultKeyTypes) as $i) {
70-
$col = array_column($valueColumns, $i);
71-
$resultValueTypes[] = $this->sharedArrayStructure(...$col);
72-
}
73-
74-
return new ConstantArrayType($resultKeyTypes, $resultValueTypes);
75-
}
76-
}
77-
7839
// Generic ArrayType path: reconcile key type + recurse into item types
7940
/** @var ArrayType[] $types */
8041
/** @var ArrayType[] $arrayTypes */

0 commit comments

Comments
 (0)