Re: [RFC] Deprecate implicitly nullable parameter type
| From: | tag Knife | Date: | Mon, 22 Jan 2024 10:21:12 +0000 |
| Subject: | Re: [RFC] Deprecate implicitly nullable parameter type | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-122216@lists.php.net to get a copy of this message | ||
On Mon, 22 Jan 2024 at 09:51, Gina P. Banyard <internals@gpb.moe> wrote:
> Hello internals,
>
> Máté Kocsis and myself would like to propose deprecating implicitly
> nullable parameter types.
>
> The RFC is available on the wiki at the following address:
> https://wiki.php.net/rfc/deprecate-implicitly-nullable-types
>
>
> Best regards,
>
> Gina P. Banyard
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: https://www.php.net/unsub.php
>
>
Also just did a quick test, and i don't believe this would be possible. It
would remove functionality from the language widely used.
As you are mistaking
iint $var = null params as "nullable". Which they
are not, they are "optional default" parameters. The equals
can be succeeded by any value, to set the parameter to such variable where
the parameter is not passed. int ?$arg is not provided as
an alternative, the directive int ?$arg simple allows the parameters to
be passed as null, it is still required to pass through the
parameter.
To clarify
T ?$var = Requires the parameter to be passed to the function, null
value allowed
T $var = null = Does not require the parameter to be passed to the
function, is set to null if not.
https://3v4l.org/IWsqK