- Issue created by @mstrelan
- 🇦🇺Australia acbramley
Big +1, surprised this isn't already a thing!
- 🇦🇹Austria drunken monkey Vienna, Austria
Would be +1, but still requires the actually proposed changes, of course.
- 🇦🇺Australia mstrelan
Honestly I don't know what to propose, it's essentially "turn on
SlevomatCodingStandard.ControlStructures.RequireShortTernaryOperator
and let phpcs enforce it". Happy for others to come up with the wording for the coding standards. - Status changed to Needs work
about 1 year ago 3:42am 29 February 2024 - 🇦🇺Australia mstrelan
Added acbramley and alexskrypnyk as supporters (confirmed in slack)
- 🇦🇹Austria drunken monkey Vienna, Austria
Thanks for proposing the text, looks good!
Added myself as a supporter. - 🇳🇱Netherlands bbrala Netherlands
Next step should be the change record it seems, after that it can be discussed in the next meeting.
- Status changed to Needs review
about 1 year ago 8:03pm 8 May 2024 - 🇳🇱Netherlands bbrala Netherlands
Added a change record to keep it moving :)
[#3446111]
- 🇳🇿New Zealand quietone
Setting to RTBC so it gets reviewed by the committee.
- Status changed to RTBC
10 months ago 12:50am 19 July 2024 - 🇦🇺Australia mstrelan
Updating status on behalf of @quietone as per #13.
- 🇳🇿New Zealand quietone
Can someone check if there are any sniffs to enforce this change?
- 🇦🇺Australia mstrelan
@quietone the sniff is already implemented in 📌 Require short ternary (Elvis operator) syntax Postponed
- 🇳🇿New Zealand quietone
This was announced in blog post → published 9 Oct.
- 🇳🇿New Zealand quietone
There has been no feedback from the blog post.
- 🇦🇺Australia dpi Perth, Australia
Im now a -1 on this issue, copying my comment from the core issue:
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.
So I'd be advocating for SlevomatCodingStandard.ControlStructures.DisallowShortTernaryOperator
- 🇦🇺Australia mstrelan
The proposed text talks about a specific scenario which is already a non-strict comparison. So disallowing the short ternary syntax does not improve this. It may encourage people to learn more as to why it's disallowed, and refactoring to use a strict comparison, but in most cases people would probably just expand it out to the longer syntax.
- 🇳🇿New Zealand quietone
I've updated the documentation and published the change record.
- 🇧🇪Belgium borisson_ Mechelen, 🇧🇪
Reviewed the documentation page, that still had visibile html tags, fixed those. I think this is done now.
- 🇳🇿New Zealand quietone
@dpi, I think it best to discuss using SlevomatCodingStandard.ControlStructures.DisallowShortTernaryOperator in a meeting or a separate issue.
Updating credit. I've included myself as well.
Automatically closed - issue fixed for 2 weeks with no activity.