1
0
Fork 0

don't default key to string|int

pull/551/head
Philip Nelson 2017-12-12 19:30:49 +11:00
parent d8fd306ed1
commit 744d3ba10a
No known key found for this signature in database
GPG Key ID: 8C8235644C5E2279
1 changed files with 2 additions and 2 deletions

View File

@ -1097,14 +1097,14 @@ class DefinitionResolver
return new Types\Mixed_; return new Types\Mixed_;
} }
// FOREACH KEY // FOREACH KEY/VARIABLE
if ($node instanceof Node\ForeachKey || $node->parent instanceof Node\ForeachKey) { if ($node instanceof Node\ForeachKey || $node->parent instanceof Node\ForeachKey) {
$foreach = $node->getFirstAncestor(Node\Statement\ForeachStatement::class); $foreach = $node->getFirstAncestor(Node\Statement\ForeachStatement::class);
$collectionType = $this->resolveExpressionNodeToType($foreach->forEachCollectionName); $collectionType = $this->resolveExpressionNodeToType($foreach->forEachCollectionName);
if ($collectionType instanceof Types\Array_) { if ($collectionType instanceof Types\Array_) {
return $collectionType->getKeyType(); return $collectionType->getKeyType();
} }
return new Types\Compound([new Types\String_(), new Types\Integer()]); return new Types\Mixed_();
} }
// FOREACH VALUE // FOREACH VALUE