Hi,

On Thu, Feb 5, 2015 at 2:58 AM, Stanislav Malyshev <smalys...@gmail.com> wrote:
> Hi!
>
>> Adding another concept, not changing the existing ones. And really,
>> it's just simplifying what is already present via is_<typename>()
>> runtime checks, making our lives a little bit easier.
>
> There's a very big difference between allowing to check types (and then
> do whatever you wish) and having functions throw fatal errors if types
> do not match.
>

True, but obviously, us who want strict typehints want to be able to do this:

    function foo(int $bar) { /* ... */ }

... instead of something like this:

    function foo($bar)
    {
        if ( ! is_int($bar))
        {
            trigger_error(sprintf('foo() expects argument 1 ($foo) to
be int, %s given', gettype($bar)), E_USER_ERROR);
            exit(1);
        }

        /* ... */
    }

Hence, simplifying. :)

Cheers,
Andrey.

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

Reply via email to