On Sat, Sep 20, 2014 at 9:40 AM, Patrick Schaaf <p...@bof.de> wrote:

> Am 20.09.2014 01:35 schrieb "Andrea Faulds" <a...@ajf.me>:
> >
> > https://wiki.php.net/rfc/isset_ternary#vote
>
> Hi,
>
> got a question after being bitten my the issue yesterday in the context of
> the "@yadda ?: 'default'" form yesterday:
>
> What about yadda that results, at the moment, in fatal errors?? Things like
> static::$missingproperty, $this->missingmethod(), and other stuff?
>
> Will the ?? operator
> A) make these non-fatal
> B) silently fatal (like now when @ is used)
> C) loudly fatal (like when no @ is used)
> D) depends on what fatal it is?
>

$this->missingmethod() ?? null will continue to be (loudly) fatal (or
recoverable fatal, once a recent RFC is merged).

static::$missingproperty ?? null will not throw an error, as it is subject
to isset().


> To me the most annoying case here, not only in relation to ?? of course, is
> the different behaviour of $this->missingproperty and
> someclass::$missingproperty, with the latter being fatal, but easily
> provocable by a call to unset(someclass::$missingproperty earlier in the
> code.
>

It's not possible to unset a static property, see http://3v4l.org/PkD36.
Which is probably also why accessing an undefined static property is fatal
as well ;)

Nikita

Reply via email to