mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Fix errors
This commit is contained in:
parent
14b37b95af
commit
16a1dc8538
@ -999,7 +999,7 @@ class StaticCallAnalyzer extends \Psalm\Internal\Analyzer\Statements\Expression\
|
||||
$method_id
|
||||
. '-' . $code_location->file_name
|
||||
. ':' . $code_location->raw_file_start
|
||||
),
|
||||
),
|
||||
new CodeLocation($source, $stmt->name)
|
||||
);
|
||||
} else {
|
||||
|
@ -154,19 +154,23 @@ class Taint
|
||||
*/
|
||||
public function getPredecessorPath(TypeSource $source, array $visited_paths = []) : string
|
||||
{
|
||||
$location_summary = $source->code_location->getQuickSummary();
|
||||
$location_summary = '';
|
||||
|
||||
if (isset($visited_paths[$location_summary])) {
|
||||
return '';
|
||||
if ($source->code_location) {
|
||||
$location_summary = $source->code_location->getQuickSummary();
|
||||
|
||||
if (isset($visited_paths[$location_summary])) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$visited_paths[$location_summary] = true;
|
||||
}
|
||||
|
||||
$visited_paths[$location_summary] = true;
|
||||
|
||||
$source_descriptor = $source->id . ($source->code_location ? ' (' . $location_summary . ')' : '');
|
||||
$source_descriptor = $source->id . ($location_summary ? ' (' . $location_summary . ')' : '');
|
||||
|
||||
if ($previous_source = $this->new_sources[$source->id] ?? self::$archived_sources[$source->id] ?? null) {
|
||||
if ($previous_source === $source) {
|
||||
throw new \UnexpectedValueException('bad');
|
||||
return '';
|
||||
}
|
||||
|
||||
return $this->getPredecessorPath($previous_source, $visited_paths) . ' -> ' . $source_descriptor;
|
||||
@ -180,17 +184,25 @@ class Taint
|
||||
*/
|
||||
public function getSuccessorPath(TypeSource $source, array $visited_paths = []) : string
|
||||
{
|
||||
$location_summary = $source->code_location->getQuickSummary();
|
||||
$location_summary = '';
|
||||
|
||||
if (isset($visited_paths[$location_summary])) {
|
||||
return '';
|
||||
if ($source->code_location) {
|
||||
$location_summary = $source->code_location->getQuickSummary();
|
||||
|
||||
if (isset($visited_paths[$location_summary])) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$visited_paths[$location_summary] = true;
|
||||
}
|
||||
|
||||
$visited_paths[$location_summary] = true;
|
||||
|
||||
$source_descriptor = $source->id . ($source->code_location ? ' (' . $location_summary . ')' : '');
|
||||
$source_descriptor = $source->id . ($location_summary ? ' (' . $location_summary . ')' : '');
|
||||
|
||||
if ($next_source = $this->new_sinks[$source->id] ?? self::$archived_sinks[$source->id] ?? null) {
|
||||
if ($next_source === $source) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $source_descriptor . ' -> ' . $this->getSuccessorPath($next_source, $visited_paths);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user