mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
parent
608ca417bc
commit
25e7039f02
@ -860,12 +860,16 @@ class ForeachAnalyzer
|
||||
$statements_analyzer->addSuppressedIssues(['PossiblyInvalidMethodCall']);
|
||||
}
|
||||
|
||||
$context->inside_call = true;
|
||||
|
||||
\Psalm\Internal\Analyzer\Statements\Expression\Call\MethodCallAnalyzer::analyze(
|
||||
$statements_analyzer,
|
||||
$fake_method_call,
|
||||
$context
|
||||
);
|
||||
|
||||
$context->inside_call = false;
|
||||
|
||||
if (!in_array('PossiblyInvalidMethodCall', $suppressed_issues, true)) {
|
||||
$statements_analyzer->removeSuppressedIssues(['PossiblyInvalidMethodCall']);
|
||||
}
|
||||
|
@ -669,6 +669,20 @@ class UnusedCodeTest extends TestCase
|
||||
|
||||
new Foo();'
|
||||
],
|
||||
'useIteratorMethodsWhenCallingForeach' => [
|
||||
'<?php
|
||||
/** @psalm-suppress UnimplementedInterfaceMethod */
|
||||
class IterableResult implements \Iterator {
|
||||
public function current() {
|
||||
return $this->current;
|
||||
}
|
||||
}
|
||||
|
||||
$items = new IterableResult();
|
||||
|
||||
/** @psalm-suppress MixedAssignment */
|
||||
foreach ($items as $_item) {}'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user