Convert::to(string, callable, int) does not handle $severity
chitoku-k opened this issue · comments
Convert::to
does not properly set ErrorException::$severity
when called via to(string, callable, int)
signature:
<?php
// OK: \ErrorException::$severity is set
// Using Convert::toErrorException, which handles it manually
Convert::toErrorException(function () {
var_dump($undefined);
});
// NG: \ErrorException::$severity is default
// Using Convert::to, which does not specifically treat \ErrorException
Convert::to(\ErrorException::class, function () {
var_dump($undefined);
});
This behavior is slightly confusing as they are neither documented nor logical.