Skip to content

Commit 0a12248

Browse files
committed
Use try/finally to restore error handlers
Signed-off-by: Alexander M. Turek <[email protected]>
1 parent cd63dba commit 0a12248

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Tests/OptionsResolverTest.php

+7-5
Original file line numberDiff line numberDiff line change
@@ -537,11 +537,13 @@ public function testDeprecationMessages(\Closure $configureOptions, array $optio
537537
});
538538
$e = error_reporting(0);
539539

540-
$configureOptions($this->resolver);
541-
$this->resolver->resolve($options);
542-
543-
error_reporting($e);
544-
restore_error_handler();
540+
try {
541+
$configureOptions($this->resolver);
542+
$this->resolver->resolve($options);
543+
} finally {
544+
error_reporting($e);
545+
restore_error_handler();
546+
}
545547

546548
$lastError = error_get_last();
547549
unset($lastError['file'], $lastError['line']);

0 commit comments

Comments
 (0)