[wp-trac] [WordPress Trac] #23089: Rewrite a confusing condition in default-widgets.php

WordPress Trac noreply at wordpress.org
Wed Jan 23 08:39:15 UTC 2013


#23089: Rewrite a confusing condition in default-widgets.php
-------------------------+-----------------------
 Reporter:  alexvorn2    |       Owner:
     Type:  enhancement  |      Status:  reopened
 Priority:  lowest       |   Milestone:  3.6
Component:  Widgets      |     Version:
 Severity:  minor        |  Resolution:
 Keywords:  has-patch    |
-------------------------+-----------------------
Changes (by kovshenin):

 * cc: kovshenin (added)


Comment:

 I rarely use the ternary operator, but when I do, I always put brackets
 around the condition, so that it's more obvious, easier to read and
 modify, just like an if statement.

 {{{
 $number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number']
 ) : 10;
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/23089#comment:11>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list