Make WordPress Core

Opened 21 months ago

Last modified 21 months ago

#38296 new enhancement

Remove $sep variable duplication from Ternary Operator

Reported by: joelcj91 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.6.1
Component: Administration Keywords: has-patch
Focuses: administration Cc:


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 (1)

38296.patch (609 bytes) - added by joelcj91 21 months ago.
Patch to remove variable duplication

Download all attachments as: .zip

Change History (2)

21 months ago

Patch to remove variable duplication

#1 @joelcj91
21 months ago

  • Keywords has-patch added
Note: See TracTickets for help on using tickets.