Hi,

Marcus Boerger wrote:
Last but not least we know already that a lot of people like to
be able to handle both instanceof or null with typehints. But at
the moment we have no solution that can go into PHP 5.0. However
i am quite sure we will address this for 5.1.

I'm glad this issue will be re-evaluated. I think the loss of null option is disappointing since it precludes optional params (which was really the only place I was using it), but I also understand the reasoning.


Here is a slightly related example from my code which is preventing me from being able to use typehints at all -- the issue is more than just allowing null, clearly:

abstract class BasePeer {

  // ...
  public static function doDelete(Criteria $criteria, Connection $con) {
   // ...
  }

}

class AuthorPeer extends BasePeer {

  public static function doDelete(Criteria $criteria, $con = null) {
     if ($con === null) {
        $con = Transaction::begin();
     }
     // ...
     parent::doDelete($criteria, $con);
  }
}

Now, even though I am using typehints propertly (i.e. not specifying one for $con in subclass), my code is no longer E_STRICT -- because the signatures do not match. :( Obviously issue is larger than the typehints, but it would be nice if the above code were able to be E_STRICT (especially since BasePeer is an abstract class) -- and it would be nice if I could use optional paramters w/ typehints.

Of course, namespaces are more important than anything ;)

Hans

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



Reply via email to