Re: Exceptions for method on non-object rather than fatal (desired feature?)

From: Date: Tue, 21 Feb 2012 16:33:29 +0000
Subject: Re: Exceptions for method on non-object rather than fatal (desired feature?)
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Hi Ralk

2012/2/21 Ralf Lang <[email protected]>:
> Am 21.02.2012 16:55, schrieb Martin Amps:
> of course there is always a way to script around issues rather than
> adressing them. I just want to know if the change would be desired. I have
> code around which does exactly this, check on all levels of all possible
> combinations. Semantically, this is nonsense and it bloats the code. It's
> just a requirement because currently PHP handles this as non-recoverable
> fatal.
>
> I see no reason why it would be not desirable to have PHP raise the
> exception rather than putting more or less repeating code snippets all
> around the place. That is why I am asking.

This topic have been raised many many times (Turning errors into
Exceptions). What it seems like you are trying to shave off, is 3
lines, I do know that it is sample code but like Martin replied, you
should implement such yourself as PHP does not do any magical
overloading without explicitly declared, witch I think is a good
decision.

TL;DR, in basic terms, if you want it as a one-liner, you must
implement the overloading methods yourself to obtain that chaning you
are after.

-- 
regards,

Kalle Sommer Nielsen
[email protected]


Thread (18 messages)

« previous php.internals (#57918) next »