Skip to content

Commit

Permalink
use try/finally to avoid side effect
Browse files Browse the repository at this point in the history
  • Loading branch information
saeideng committed Oct 9, 2017
1 parent ddb31e8 commit e737cf9
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/TestSuite/TestCase.php
Expand Up @@ -95,10 +95,13 @@ public function skipIf($shouldSkip, $message = '')
*/
public function deprecated($callable)
{
$errorLevel = error_reporting();
error_reporting(E_ALL ^ E_USER_DEPRECATED);
$callable();
error_reporting($errorLevel);
try {
$errorLevel = error_reporting();
error_reporting(E_ALL ^ E_USER_DEPRECATED);
$callable();
} finally {
error_reporting($errorLevel);
}
}

/**
Expand Down

0 comments on commit e737cf9

Please sign in to comment.