Hi,

On 01/14/2015 10:32 AM, Andrea Faulds wrote:
Hi Leigh,

On 14 Jan 2015, at 09:17, Leigh <lei...@gmail.com> wrote:

I really don't like this behaviour being changed at the call site. If
I design a function that I _know_ should only take a string, then I
want it to be an error if the user supplies anything else, so that
they know they messed up.

I don’t like the idea of being forced to use strict (or weak) type checking 
because the API author decided as much.

What happens with that code:

----------------
$i = 1;
$a = myFunc( $i );

declare(strict_typehints=TRUE);

function myFunc( float $f )
{
    return otherFunc( $f );
}

function otherFunc( float $f )
{
    ...
}
----------------

As author of strict code I need to replace

    return otherFunc( $f );

by

    return otherFunc( (float) $f );


I'm not sure

- if this is what a strict coder wants and

- if you find an acceptable way to test your strict code if it works with non-strict code.


Regards

Thomas

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

Reply via email to