Re: [RFC] Reclassifying engine warnings
| From: | Robert Korulczyk | Date: | Thu, 12 Sep 2019 14:43:27 +0000 |
| Subject: | Re: [RFC] Reclassifying engine warnings | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-106962@lists.php.net to get a copy of this message | ||
> But, if you're dealing with a counter, then, the intent is that you are
> going to start counting at 0 and increase it.
This is not that clear as you may think. Several questions may come to mind when you will see
incrementation of non-existing variable/key. Is it a bug
and this should be initialized with a different value than 0? Maybe a mistake on copy&paste?
Maybe a typo?
One additional line will make your code much more obvious and easier to read and understand:
$i ??= 0;
$i++;
Your code is not only for compiler/parser, but also for humans. Expressing your intentions clearly
is important - the less ambiguity the better.
Regards,
Robert Korulczyk