Hm. I would be open to this. We can include the sample code to copy-paste in the errata, and include it in the utlis package.

Does anyone object to this recommendation for the errata? Paul and Robert especially?

--Larry Garfield

On 07/28/2016 11:19 AM, Brent Shaffer wrote:
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] <mailto:[email protected]>. To post to this group, send email to [email protected] <mailto:[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 <https://groups.google.com/d/msgid/php-fig/b38673aa-3cac-4c29-bbc3-69030036dfbf%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.


--
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/9e949206-2349-1392-35d8-658dc91a0e0a%40garfieldtech.com.
For more options, visit https://groups.google.com/d/optout.
  • Re: [Cache] Erra... Daniel Plainview
    • Re: [Cache]... Larry Garfield
      • Re: [Ca... Daniel Plainview
      • Re: [Ca... 'Takashi Matsuo' via PHP Framework Interoperability Group
        • Re:... Daniel Hunsaker
          • ... 'Takashi Matsuo' via PHP Framework Interoperability Group
          • ... Larry Garfield
            • ... Brent Shaffer
              • ... Brent Shaffer
              • ... Larry Garfield
              • ... Paul Dragoonis
              • ... Larry Garfield
              • ... Matteo Beccati
              • ... Larry Garfield
              • ... Robert Hafner
              • ... Larry Garfield
              • ... Nicolas Grekas
              • ... Larry Garfield
              • ... Nicolas Grekas
            • ... Daniel Hunsaker

Reply via email to