mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Avoid empty variable names instead of filtering them later
This commit is contained in:
parent
4fd87f2d77
commit
0d0a06e78f
@ -61,6 +61,7 @@ use function strtolower;
|
||||
use function substr;
|
||||
use function trim;
|
||||
|
||||
use const PREG_SPLIT_NO_EMPTY;
|
||||
use const STDERR;
|
||||
|
||||
/**
|
||||
@ -382,12 +383,9 @@ class StatementsAnalyzer extends SourceAnalyzer
|
||||
|
||||
if (isset($statements_analyzer->parsed_docblock->tags['psalm-trace'])) {
|
||||
foreach ($statements_analyzer->parsed_docblock->tags['psalm-trace'] as $traced_variable_line) {
|
||||
$possible_traced_variable_names = preg_split('/(?:\s*,\s*|\s+)/', $traced_variable_line);
|
||||
$possible_traced_variable_names = preg_split('/(?:\s*,\s*|\s+)/', $traced_variable_line, -1, PREG_SPLIT_NO_EMPTY);
|
||||
if ($possible_traced_variable_names) {
|
||||
$traced_variables = array_merge(
|
||||
$traced_variables,
|
||||
array_filter($possible_traced_variable_names)
|
||||
);
|
||||
$traced_variables = array_merge($traced_variables, $possible_traced_variable_names);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user