[Debug] Deprecate ContextErrorException
This commit is contained in:
parent
9d8c6c6c28
commit
c3797074ff
|
@ -6,6 +6,11 @@ ClassLoader
|
|||
|
||||
* The component is deprecated and will be removed in 4.0. Use Composer instead.
|
||||
|
||||
Debug
|
||||
-----
|
||||
|
||||
* The `ContextErrorException` class is deprecated. `\ErrorException` will be used instead in 4.0.
|
||||
|
||||
DependencyInjection
|
||||
-------------------
|
||||
|
||||
|
|
|
@ -15,6 +15,9 @@ Console
|
|||
Debug
|
||||
-----
|
||||
|
||||
|
||||
* The `ContextErrorException` class has been removed. Use `\ErrorException` instead.
|
||||
|
||||
* `FlattenException::getTrace()` now returns additional type descriptions
|
||||
`integer` and `float`.
|
||||
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
CHANGELOG
|
||||
=========
|
||||
|
||||
3.3.0
|
||||
-----
|
||||
|
||||
* deprecated the `ContextErrorException` class: use \ErrorException directly now
|
||||
|
||||
3.2.0
|
||||
-----
|
||||
|
||||
|
|
|
@ -521,9 +521,6 @@ class ErrorHandler
|
|||
}
|
||||
} elseif ($exception instanceof \ErrorException) {
|
||||
$message = 'Uncaught '.$exception->getMessage();
|
||||
if ($exception instanceof ContextErrorException) {
|
||||
$e['context'] = $exception->getContext();
|
||||
}
|
||||
} else {
|
||||
$message = 'Uncaught Exception: '.$exception->getMessage();
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@ namespace Symfony\Component\Debug\Exception;
|
|||
* Error Exception with Variable Context.
|
||||
*
|
||||
* @author Christian Sciberras <uuf6429@gmail.com>
|
||||
*
|
||||
* @deprecated since version 3.3. Instead, \ErrorException will be used directly in 4.0.
|
||||
*/
|
||||
class ContextErrorException extends \ErrorException
|
||||
{
|
||||
|
@ -31,6 +33,8 @@ class ContextErrorException extends \ErrorException
|
|||
*/
|
||||
public function getContext()
|
||||
{
|
||||
@trigger_error(sprintf('The %s class is deprecated since version 3.3 and will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED);
|
||||
|
||||
return $this->context;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ namespace Symfony\Component\Debug\Tests;
|
|||
use Psr\Log\LogLevel;
|
||||
use Symfony\Component\Debug\BufferingLogger;
|
||||
use Symfony\Component\Debug\ErrorHandler;
|
||||
use Symfony\Component\Debug\Exception\ContextErrorException;
|
||||
use Symfony\Component\Debug\Exception\SilencedErrorContext;
|
||||
|
||||
/**
|
||||
|
@ -71,13 +70,12 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
try {
|
||||
self::triggerNotice($this);
|
||||
$this->fail('ContextErrorException expected');
|
||||
} catch (ContextErrorException $exception) {
|
||||
$this->fail('ErrorException expected');
|
||||
} catch (\ErrorException $exception) {
|
||||
// if an exception is thrown, the test passed
|
||||
$this->assertEquals(E_NOTICE, $exception->getSeverity());
|
||||
$this->assertEquals(__FILE__, $exception->getFile());
|
||||
$this->assertRegExp('/^Notice: Undefined variable: (foo|bar)/', $exception->getMessage());
|
||||
$this->assertArrayHasKey('foobar', $exception->getContext());
|
||||
|
||||
$trace = $exception->getTrace();
|
||||
|
||||
|
|
Reference in New Issue