Re: Really Need..

From: Date: Sun, 18 Jan 2009 22:30:23 +0000
Subject: Re: Really Need..
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-42688@lists.php.net to get a copy of this message
On Sun, Jan 18, 2009 at 9:39 PM, Nathan Rixham <nrixham@gmail.com> wrote: > I've reworded my original mail completely maybe this one will have more > feedback (or not) > > question: Would anybody else like to see, or feel the need for, *optional* > type hinting of variables and class properties in PHP? > I was involved on a thread on exactly this some weeks earlier. I (and a few others, though I don't really remember specifics) would very much appreciate the possibilities of proper code structure when working with large teams that this could help provide :) (As to your original proposal, multiple method signatures is something I've come across a need for *occasionally*, though personally, I'm not a big fan of the feature -- the one place I would like having it is __construct(). Say, you've got an ORM class which is derived for usage: class ORM { public function __construct(string $sPK) { // Fetch and populate based on PK } } class Person extends ORM { public function __construct(int $iID) { // Fetch and populate based on PK parent::__construct((string)$iID); } public function __construct(string $sNewName, string $sAddress) { parent::__insert(....); } } Yes, I realise that this can be done with retrieving arguments and the like, but for such purposes it's not the neatest solution syntactically.)

« previous php.internals (#42688) next »