[wp-trac] [WordPress Trac] #38296: Remove $sep variable duplication from Ternary Operator
WordPress Trac
noreply at wordpress.org
Wed Oct 12 20:20:13 UTC 2016
#38296: Remove $sep variable duplication from Ternary Operator
----------------------------+-----------------------------
Reporter: joelcj91 | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Administration | Version: 4.6.1
Severity: normal | Keywords:
Focuses: administration |
----------------------------+-----------------------------
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,
{{{#!php
( $i == $action_count ) ? $sep = '' : $sep = ' | ';
}}}
Can we use,
{{{#!php
$sep = ( $i == $action_count ) ? '' : ' | ';
}}}
So the variable $sep is written once. Shortening the code a bit.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38296>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list