Am 12.03.2015 um 12:16 schrieb Crypto Compress:
> Hello Johannes,
> 
> class Foo {
>     private static function __static() {
>         throw new Exception("boom");
>     }
> }
> 
> while(true) {
>     try {
>         $foo = new Foo;
>     } catch (Exception ex) {}
> }
> 
> Would this code be valid?

Have to think about this issue, but on the first look I would say yes!

Because the meaning of the static constructor is to do some necassary
initialize for the class it should be able to throw an Exception if it
cannot do it's work correctly. For example if it needs to read some
configuration from a Database and is not able to connect.

For the caller I although would say, that the error inside the static
constructor should be catchable, for the simple fact that every Error
should be catchable for user-errorhandling.

What is your point of view for this? I'm open for discussion about this.

Regards
-- 
DerOetzi

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to