mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Fix #3215 - suppress PossiblyUndefinedMethod in synthetic call
This commit is contained in:
parent
e9666372d0
commit
e1c6fcc707
@ -735,6 +735,10 @@ class ForeachAnalyzer
|
||||
$statements_analyzer->addSuppressedIssues(['PossiblyInvalidMethodCall']);
|
||||
}
|
||||
|
||||
if (!in_array('PossiblyUndefinedMethod', $suppressed_issues, true)) {
|
||||
$statements_analyzer->addSuppressedIssues(['PossiblyUndefinedMethod']);
|
||||
}
|
||||
|
||||
\Psalm\Internal\Analyzer\Statements\Expression\Call\MethodCallAnalyzer::analyze(
|
||||
$statements_analyzer,
|
||||
$fake_method_call,
|
||||
@ -745,6 +749,10 @@ class ForeachAnalyzer
|
||||
$statements_analyzer->removeSuppressedIssues(['PossiblyInvalidMethodCall']);
|
||||
}
|
||||
|
||||
if (!in_array('PossiblyUndefinedMethod', $suppressed_issues, true)) {
|
||||
$statements_analyzer->removeSuppressedIssues(['PossiblyUndefinedMethod']);
|
||||
}
|
||||
|
||||
$iterator_class_type = $statements_analyzer->node_data->getType($fake_method_call) ?: null;
|
||||
|
||||
$statements_analyzer->node_data = $old_data_provider;
|
||||
|
@ -223,6 +223,14 @@ class GeneratorTest extends TestCase
|
||||
return 5;
|
||||
}'
|
||||
],
|
||||
'iteratorUnion' => [
|
||||
'<?php
|
||||
/** @return Iterator|IteratorAggregate */
|
||||
function getIteratorOrAggregate() {
|
||||
yield 2;
|
||||
}
|
||||
echo json_encode(iterator_to_array(getIteratorOrAggregate()));'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user