mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Fix #4315 - prevent crash when setting unknown property in finally
This commit is contained in:
parent
278a306681
commit
399a7bfd11
@ -479,7 +479,7 @@ class TryAnalyzer
|
||||
$finally_context->vars_in_scope[$var_id],
|
||||
$codebase
|
||||
);
|
||||
} else {
|
||||
} elseif (isset($finally_context->vars_in_scope[$var_id])) {
|
||||
$context->vars_in_scope[$var_id] = clone $finally_context->vars_in_scope[$var_id];
|
||||
}
|
||||
}
|
||||
|
@ -365,6 +365,13 @@ class TryCatchTest extends TestCase
|
||||
}
|
||||
}'
|
||||
],
|
||||
'suppressUndefinedVarInFinally' => [
|
||||
'<?php
|
||||
try {} finally {
|
||||
/** @psalm-suppress UndefinedGlobalVariable, MixedPropertyAssignment */
|
||||
$event->end = null;
|
||||
}',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user