Hi!
> Scalar types declarations were introduced in PHP 7.0 but it was not
> possible to pass null as a default value to function/method. It was
> finally done by a small workaround described in documentation as "The
> declaration can be made to accept NULL values if the default value of
> the para
2017-02-25 16:12 GMT+01:00 Andrea Faulds :
> Hi,
>
> Rowan Collins wrote:
>
>> On 23 February 2017 09:15:27 GMT+00:00, "Michał" wrote:
>>
>>> And what about situation when someone is forcing
>>> declare(strict_types=1)? I think, it's really a good place to force
>>> proper types. Including nulls.
Hi,
Rowan Collins wrote:
On 23 February 2017 09:15:27 GMT+00:00, "Michał" wrote:
And what about situation when someone is forcing
declare(strict_types=1)? I think, it's really a good place to force
proper types. Including nulls.
strict_types controls the behaviour of *calling* functions, but
On Wed, Feb 22, 2017 at 2:18 PM, Michał wrote:
> a(string $test=null) // incorrect type, should throw error
>
> There is no reason, except of backwards compatibility, to keep this
> behaviour. It's too late to change this in 7.1, maybe even in 7.2. But, what
> is Your opinion? Should it be preserv
On 23 February 2017 09:15:27 GMT+00:00, "Michał" wrote:
>And what about situation when someone is forcing
>declare(strict_types=1)? I think, it's really a good place to force
>proper types. Including nulls.
strict_types controls the behaviour of *calling* functions, but the check here
would ha
Indeed, it's far too early to think about forcing people to change all their code to the ?
notation. I'm also not convinced of the value even once that's established; it's not like "Foo
$foo = null" can ever mean *something different* from "?Foo $foo = null", it would
just be an error.
Maybe i
On 23 February 2017 07:23:02 GMT+00:00, Andrey Andreev wrote:
>Hi,
>
>On Wed, Feb 22, 2017 at 11:18 PM, Michał wrote:
>
>> "The
>declaration
>> can be made to accept NULL values if the default value of the
>parameter is
>> set to NULL".
>
>This isn't just a PHP 7 work-around for null types, it ha
Hi,
On Wed, Feb 22, 2017 at 11:18 PM, Michał wrote:
> Hello PHP internals,
> Scalar types declarations were introduced in PHP 7.0 but it was not
> possible to pass null as a default value to function/method. It was finally
> done by a small workaround described in documentation as "The declarati
Hello PHP internals,
Scalar types declarations were introduced in PHP 7.0 but it was not
possible to pass null as a default value to function/method. It was
finally done by a small workaround described in documentation as "The
declaration can be made to accept NULL values if the default value o