1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 12:55:26 +01:00

Allow nested specialisation

This commit is contained in:
Matt Brown 2020-12-04 15:44:24 -05:00
parent fd67d41120
commit 3f155792a7
2 changed files with 17 additions and 0 deletions

View File

@ -471,6 +471,8 @@ class TaintFlowGraph extends DataFlowGraph
$new_source->id = $source->id . '-' . $specialization;
unset($new_source->specialized_calls[$specialization]);
$generated_sources[] = $new_source;
}
}

View File

@ -1960,6 +1960,21 @@ class TaintTest extends TestCase
echo post("x");',
'error_message' => 'TaintedHtml',
],
'taintSpecializedTwice' => [
'<?php
/** @psalm-taint-specialize */
function data(array $data, string $key) {
return $data[$key];
}
/** @psalm-taint-specialize */
function get(string $key) {
return data($_GET, $key);
}
echo get("x");',
'error_message' => 'TaintedHtml',
],
/*
// TODO: Stubs do not support this type of inference even with $this->message = $message.
// Most uses of getMessage() would be with caught exceptions, so this is not representative of real code.