- Issue created by @mstrelan
- Status changed to Postponed
about 1 year ago 3:09am 20 February 2024 - 🇦🇺Australia dpi Perth, Australia
Keen on not needing to postpone the actionable code changes. Maybe we need another issue that tracks the standard change so we don't forget to bring it in.
- 🇦🇺Australia dpi Perth, Australia
Marked 📌 About an ?: assignment operator. Closed: duplicate as duplicate.
- Status changed to Active
2 months ago 7:28am 29 January 2025 - 🇧🇪Belgium borisson_ Mechelen, 🇧🇪
Setting to active, this is now ready to work on.
- 🇦🇺Australia dpi Perth, Australia
I've been making use of phpstan strict ruleset for a couple years now, and I have to mention that I agree with one of their rules, that would be at odds with this issue. That is, to never use
?:
. Because it has weak comparison semantics.Justification, from docs:
Disallow short ternary operator (?:) - implies weak comparison, it's recommended to use null coalesce operator (??) or ternary operator with strict condition.
So, since this issue is about core itself, not coding standards. I'd support enabling this rule from strict, and/or in the interim finding a codesniffer rule that disallows it.
- 🇦🇺Australia mstrelan
Well there has been an MR for almost 12 months, so this is Needs Work, as it needs a reroll. Adding appropriate tags to hopefully encourage someone else to get this green.
- 🇦🇺Australia dpi Perth, Australia
- 🇦🇺Australia mstrelan
Cross post with @dpi, seems your should voice that concern on the coding standards issue before it's resolved.
- 🇧🇪Belgium borisson_ Mechelen, 🇧🇪
The rule is now enabled in phpcs.xml.dist, all places that were not yet compliant are now fixed. Looks good to go.
- 🇬🇧United Kingdom catch
@dpi I think we could have a new issue to disallow this, and reverse the changes here, but since this doesn't actually reduce any strictness in the comparisons being changed, going to go ahead here.
Committed/pushed to 11.x, thanks!
Automatically closed - issue fixed for 2 weeks with no activity.