On 2012-03-12, Arvids Godjuks <arvids.godj...@gmail.com> wrote:
> --f46d0442880e02b97f04bb0b432b
> Content-Type: text/plain; charset=UTF-8
>
> I think that the "null issue" is not an issue. Strictly speaking if you
> want null or an int - leave out the type hint and use generic argument that
> will accept anything.
> I think it's over-engineering to try and push a special treatment for the
> null. If function/method argument accepts anything but a single type -
> it's type-less and does not need a type hint.

However, that conflicts with how typehints work currently in PHP:

    public function setContainer(Container $container = null)
    {
        $this->container = $container;
    }

This is perfectly valid currently, and allows "unsetting" a value
easily. I'd expect scalar hints to work exactly the same way -- in other
words, null, or a value that satisfies the hint.


-- 
Matthew Weier O'Phinney
Project Lead            | matt...@zend.com
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

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

Reply via email to