If we want to mimic a type error, we could do the following:

    $error = sprintf('Argument 1 passed to %s::expiresAt() must be an 
instance of DateTime, string given', get_class($this));
    if (class_exists('TypeError')) {
        throw new \TypeError($error);
    }
    trigger_error($error, E_USER_ERROR);

It's verbose but it's the closest we can get to native handling while still 
obeying the spec.

- Brent

On Wednesday, July 27, 2016 at 11:21:30 AM UTC-7, Brent Shaffer wrote:
>
> Unfortunately, there is no way to trigger an E_RECOVERABLE_ERROR. You can 
> only trigger user-level errors, so E_USER_ERROR is the closest you can get. 
> E_USER_ERROR is catchable via set_error_handler(), so this should be 
> approximately the same.
>
> - Brent
>

-- 
You received this message because you are subscribed to the Google Groups "PHP 
Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/php-fig/b38673aa-3cac-4c29-bbc3-69030036dfbf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to