Opened 4 years ago
Last modified 2 years ago
#38296 new enhancement
Remove $sep variable duplication from Ternary Operator
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | 3.1 |
Component: | Administration | Keywords: | has-patch |
Focuses: | administration | Cc: |
Description
In WP_List_Table class, we are using ternary operators a lot. We know that the main advantage of the ternary operator is, it makes code shorter.
Instead of uisng ternary operator like this,
( $i == $action_count ) ? $sep = '' : $sep = ' | ';
Can we use,
$sep = ( $i == $action_count ) ? '' : ' | ';
So the variable $sep is written once. Shortening the code a bit.
Attachments (2)
Change History (5)
#2
@
2 years ago
- Keywords needs-refresh added
- Milestone changed from Awaiting Review to Future Release
- Version changed from 4.6.1 to 3.1
Thanks for this, @joelcj91! Sorry that it took so long to receive a response.
This is a good suggestion, IMO. Are you able to refresh the patch to apply cleanly to trunk
?
Note: See
TracTickets for help on using
tickets.
Patch to remove variable duplication