The ?? operator is currently used without thinking about it and is used repeatedly to introduce the same default value. Don’t get me wrong I use this operator my self all the time, but the silverstripe code base currently uses it in places where it does not make any sense.
This method for example:
The default for $sql is repeated multiple times.
$type inside the if, cannnot even be null; The is_array already prevents that.
$operation should also never be null, only if PREG_UNMATCHED_AS_NULL is given to preg_match it may be null.
Another problem with the null-safe operator is that it may hide typos in variable names.
Micro-Optimizations normally are not worth it, but in functions like the isQueryType which are called multiple times it may make sense to reduce calls like that.
This is nothing which must be changed directly, but I would prefer that instead of just spamming this operator the code is checked of plausibility.
I’m sure that if you open a PR on the relevant package, with the explanation of why the changes are an improvement (and don’t introduce any regressions), it would be welcomed.
It is all over the code. A PR would change most files
And I already have so many open PRs (some of them are pending over one year) … I don’t have the time for something like that.