Re: [RFC][Vote] Typed Properties

From: Date: Wed, 25 May 2016 16:20:06 +0000
Subject: Re: [RFC][Vote] Typed Properties
References: 1 2 3 4 5 6 7 8 9  Groups: php.internals 
Request: Send a blank email to internals+get-93513@lists.php.net to get a copy of this message
> Am 25.05.2016 um 17:57 schrieb James Gilliland <neclimdul@gmail.com>: > > This is a cool idea and continuation of the typing systems so I've been > sort of skimming this thread as its been discussed and this example and the > associated errors caught my attention. > >> class C { >> public $a; >> public int $b; >> public ?int $c; >> } >> $obj = new C; >> > > Excuse me if this has been addressed but to clarify, using that snippet, > would this also throw an error? > > var_dump($obj); > > If so, I see a lot of cursing in my future if this goes in. Like "what's > the bad data on this object that's getting in here? aww #$%^ that > deprecated property wasn't set so the whole thing blew up!" sort of > cursing. :( These don't throw errors, they just won't appear upon foreach or print_r etc., just like other unset() properties. var_dump()/debug_zval_dump() are special casing it and display e.g. "uninitialized(int)" for $b. Bob

« previous php.internals (#93513) next »