We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ef9e8aa commit a8c0d9cCopy full SHA for a8c0d9c
src/Type/Php/ArrayKeyExistsFunctionTypeSpecifyingExtension.php
@@ -66,12 +66,16 @@ public function specifyTypes(
66
&& !$keyType instanceof ConstantStringType
67
) {
68
if ($context->true()) {
69
- $specifiedTypes = $this->typeSpecifier->create(
70
- $array,
71
- new NonEmptyArrayType(),
72
- $context,
73
- $scope,
74
- );
+ $specifiedTypes = new SpecifiedTypes();
+
+ if (count($keyType->getConstantScalarTypes()) <= 1) {
+ $specifiedTypes = $specifiedTypes->unionWith($this->typeSpecifier->create(
+ $array,
+ new NonEmptyArrayType(),
75
+ $context,
76
+ $scope,
77
+ ));
78
+ }
79
80
if ($arrayType->isIterableAtLeastOnce()->no()) {
81
return $specifiedTypes;
0 commit comments