On Sun, Jan 18, 2009 at 9:39 PM, Nathan Rixham <nrix...@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.)

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

Reply via email to