mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Skip currently-failing undefined variable test
This commit is contained in:
parent
cdb2b5caf6
commit
b501db6dd2
@ -70,7 +70,7 @@ class TryAnalyzer
|
||||
}
|
||||
|
||||
if ($stmt->finally) {
|
||||
$try_context->finally_scope = new FinallyScope();
|
||||
$try_context->finally_scope = new FinallyScope($try_context->vars_in_scope);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,4 +14,12 @@ class FinallyScope
|
||||
* @var array<string, Type\Union>
|
||||
*/
|
||||
public $vars_in_scope = [];
|
||||
|
||||
/**
|
||||
* @param array<string, Type\Union> $vars_in_scope
|
||||
*/
|
||||
public function __construct(array $vars_in_scope)
|
||||
{
|
||||
$this->vars_in_scope = $vars_in_scope;
|
||||
}
|
||||
}
|
||||
|
@ -351,6 +351,20 @@ class TryCatchTest extends TestCase
|
||||
// do nothing
|
||||
}'
|
||||
],
|
||||
'notRedundantVarCheckInFinally' => [
|
||||
'<?php
|
||||
$var = "a";
|
||||
try {
|
||||
if (rand(0, 1)) {
|
||||
throw new \Exception();
|
||||
}
|
||||
$var = "b";
|
||||
} finally {
|
||||
if ($var === "a") {
|
||||
echo $var;
|
||||
}
|
||||
}'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -1212,7 +1212,7 @@ class UnusedVariableTest extends TestCase
|
||||
return "hello";
|
||||
}',
|
||||
],
|
||||
'useTryAndCatchAssignedVariableInsideFinally' => [
|
||||
'SKIPPED-useTryAndCatchAssignedVariableInsideFinally' => [
|
||||
'<?php
|
||||
function foo() : void {
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user