Skip to content

Commit 0e7c2d4

Browse files
committed
Fix
1 parent abcfaab commit 0e7c2d4

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

src/Psalm/Internal/Analyzer/StatementsAnalyzer.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
use Psalm\Internal\Analyzer\Statements\UnsetAnalyzer;
4040
use Psalm\Internal\Analyzer\Statements\UnusedAssignmentRemover;
4141
use Psalm\Internal\Codebase\DataFlowGraph;
42-
use Psalm\Internal\Codebase\TaintFlowGraph;
4342
use Psalm\Internal\Codebase\VariableUseGraph;
4443
use Psalm\Internal\DataFlow\DataFlowNode;
4544
use Psalm\Internal\FileManipulation\FileManipulationBuffer;
@@ -150,8 +149,11 @@ final class StatementsAnalyzer extends SourceAnalyzer
150149
*/
151150
public array $foreach_var_locations = [];
152151

153-
public function __construct(protected SourceAnalyzer $source, public NodeDataProvider $node_data, private readonly bool $root_scope)
154-
{
152+
public function __construct(
153+
protected SourceAnalyzer $source,
154+
public NodeDataProvider $node_data,
155+
private readonly bool $root_scope,
156+
) {
155157
$this->file_analyzer = $source->getFileAnalyzer();
156158
$this->codebase = $source->getCodebase();
157159

src/Psalm/Internal/Codebase/TaintFlowGraph.php

+5-9
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ public function connectSinksAndSources(Progress $progress): void
225225
$codebase = $project_analyzer->getCodebase();
226226

227227
// Remove all specializations without an outgoing edge
228-
/*foreach ($this->specializations as $k => &$map) {
228+
foreach ($this->specializations as $k => &$map) {
229229
foreach ($map as $kk => $specialized_id) {
230230
if (!isset($this->forward_edges[$specialized_id])) {
231231
unset($map[$kk]);
@@ -234,7 +234,7 @@ public function connectSinksAndSources(Progress $progress): void
234234
if (!$map) {
235235
unset($this->specializations[$k]);
236236
}
237-
} unset($map);*/
237+
} unset($map);
238238

239239
$stack = [];
240240
// reprocess resolved descendants up to a maximum nesting level of 40
@@ -270,7 +270,9 @@ public function connectSinksAndSources(Progress $progress): void
270270
// If this is a specialized node, de-specialize;
271271
// Then, if we have one or more edges starting at the de-specialized node,
272272
// process destinations of those edges.
273-
if ($source->specialization_key !== null && isset($this->specialized_calls[$source->specialization_key])) {
273+
if ($source->specialization_key !== null
274+
&& isset($this->specialized_calls[$source->specialization_key])
275+
) {
274276
/** @var string $source->unspecialized_id */
275277
if (!isset($this->forward_edges[$source->unspecialized_id])) {
276278
continue;
@@ -310,9 +312,6 @@ public function connectSinksAndSources(Progress $progress): void
310312
if ($specialized_calls) {
311313
// If processing descendants of a specialized call, accept only descendants.
312314
foreach ($this->specializations[$source->id] as $specialization => $specialized_id) {
313-
if (!isset($this->forward_edges[$specialized_id])) {
314-
continue;
315-
}
316315
if (!isset($specialized_calls[$specialization])) {
317316
continue;
318317
}
@@ -345,9 +344,6 @@ public function connectSinksAndSources(Progress $progress): void
345344
} else {
346345
// If not processing descendants, accept all specializations.
347346
foreach ($this->specializations[$source->id] as $specialization => $specialized_id) {
348-
if (!isset($this->forward_edges[$specialized_id])) {
349-
continue;
350-
}
351347
$new_source = new DataFlowNode(
352348
$specialized_id,
353349
$source->id,

0 commit comments

Comments
 (0)