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

Allow nested specialisation

This commit is contained in:
Matt Brown 2020-12-04 15:44:24 -05:00 committed by Daniil Gentili
parent 309c13700d
commit b21e138cc7
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
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.