mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
parent
f4f4a32f08
commit
febd60dade
@ -362,6 +362,8 @@ class TryAnalyzer
|
||||
&& $old_unreferenced_vars[$var_id] !== $locations
|
||||
) {
|
||||
$statements_analyzer->registerVariableUses($locations);
|
||||
} elseif (isset($newly_unreferenced_vars[$var_id])) {
|
||||
$context->unreferenced_vars[$var_id] = $newly_unreferenced_vars[$var_id];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1088,6 +1088,20 @@ class UnusedVariableTest extends TestCase
|
||||
$a->bar($i);
|
||||
}',
|
||||
],
|
||||
'noUnusedVariableAfterRedeclaredInCatch' => [
|
||||
'<?php
|
||||
$path = "";
|
||||
|
||||
echo $path;
|
||||
|
||||
try {
|
||||
// do nothing
|
||||
} catch (\Exception $exception) {
|
||||
$path = "hello";
|
||||
}
|
||||
|
||||
echo $path;'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user