[VarDumper] Move $prev as 1st argument in ThrowingCasterException::__construct, removing $caster

This commit is contained in:
Nicolas Grekas 2015-10-05 19:08:59 +02:00
parent 9c5565f30c
commit 02b86b0555
2 changed files with 8 additions and 4 deletions

View File

@ -292,7 +292,7 @@ abstract class AbstractCloner implements ClonerInterface
$a = $cast;
}
} catch (\Exception $e) {
$a[(Stub::TYPE_OBJECT === $stub->type ? Caster::PREFIX_VIRTUAL : '').'⚠'] = new ThrowingCasterException($callback, $e);
$a[(Stub::TYPE_OBJECT === $stub->type ? Caster::PREFIX_VIRTUAL : '').'⚠'] = new ThrowingCasterException($e);
}
return $a;

View File

@ -17,11 +17,15 @@ namespace Symfony\Component\VarDumper\Exception;
class ThrowingCasterException extends \Exception
{
/**
* @param callable $caster The failing caster
* @param \Exception $prev The exception thrown from the caster
* @param \Exception $prev The exception thrown from the caster
*/
public function __construct($caster, \Exception $prev)
public function __construct($prev, \Exception $e = null)
{
if (!$prev instanceof \Exception) {
@trigger_error('Providing $caster a 1st argument when instanciating a '.__CLASS__.' is deprecated since version 2.8 and will be removed in 3.0. Provide directly the $prev exception instead.', E_USER_DEPRECATED);
$prev = $e;
}
parent::__construct('Unexpected '.get_class($prev).' thrown from a caster: '.$prev->getMessage(), 0, $prev);
}
}