1
0
Fork 0

remove broken list() support, I didn't think this through

pull/551/head
Philip Nelson 2017-12-12 21:36:55 +11:00
parent 744d3ba10a
commit bcb630db90
No known key found for this signature in database
GPG Key ID: 8C8235644C5E2279
3 changed files with 6 additions and 33 deletions

View File

@ -32,10 +32,6 @@ foreach ($array3 as $key => $value) {
$
}
foreach ($array1 as list($z, $y)) {
$
}
foreach ($bar->test() as $value) {
$
}

View File

@ -1107,8 +1107,10 @@ class DefinitionResolver
return new Types\Mixed_();
}
// FOREACH VALUE
if ($node instanceof Node\ForeachValue || $node->getFirstAncestor(Node\ForeachValue::class)) {
// FOREACH VALUE/VARIABLE
if ($node instanceof Node\ForeachValue
|| ($node instanceof Node\Expression\Variable && $node->parent instanceof Node\ForeachValue)
) {
$foreach = $node->getFirstAncestor(Node\Statement\ForeachStatement::class);
$collectionType = $this->resolveExpressionNodeToType($foreach->forEachCollectionName);
if ($collectionType instanceof Types\Array_) {

View File

@ -676,33 +676,8 @@ class CompletionTest extends TestCase
),
]
],
'foreach with list()' => [
new Position(35, 5),
[
new CompletionItem(
'$z',
CompletionItemKind::VARIABLE,
'\\Foo\\Bar|\\stdClass',
null,
null,
null,
null,
new TextEdit(new Range(new Position(35, 5), new Position(35, 5)), 'z')
),
new CompletionItem(
'$y',
CompletionItemKind::VARIABLE,
'\\Foo\\Bar|\\stdClass',
null,
null,
null,
null,
new TextEdit(new Range(new Position(35, 5), new Position(35, 5)), 'y')
),
]
],
'foreach function call' => [
new Position(39, 5),
new Position(35, 5),
[
new CompletionItem(
'$value',
@ -712,7 +687,7 @@ class CompletionTest extends TestCase
null,
null,
null,
new TextEdit(new Range(new Position(39, 5), new Position(39, 5)), 'value')
new TextEdit(new Range(new Position(35, 5), new Position(35, 5)), 'value')
),
]
],