Re: RFC: Not Null Assertion Operator
| From: | Christoph M. Becker | Date: | Thu, 06 Feb 2025 18:53:22 +0000 |
| Subject: | Re: RFC: Not Null Assertion Operator | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-126311@lists.php.net to get a copy of this message | ||
On 06.02.2025 at 15:48, Ilija Tovilo wrote:
> * Is assert($foo !== null); $foo->bar; really much worse? I understand
> it requires two statements, so it cannot be used in all contexts.
In my opinion, it is better, because you can completely disable the
assertion checking in production.
> * Are we ever going to promote the (null)->prop warning to an Error?
> If so, is there still any appeal for this feature?
I would rather avoid having ?->, !-> (or postfix !, which can easily be
confused with prefix !), and regular ->. This is one to much. I'm fine
with throwing on (null)->prop, but I'm also fine leaving this for static
analysis.
Christoph