? Success

User tests: Successful: Unsuccessful:

avatar photodude
photodude
25 May 2015

Best Practice fix: The expression $associations of type array is implicitly converted to a boolean; using !empty($expr) instead to make it clear that we intend to check for an array without elements.

avatar photodude photodude - open - 25 May 2015
avatar zero-24 zero-24 - change - 25 May 2015
Labels Added: ?
avatar zero-24 zero-24 - change - 25 May 2015
Labels Added: ?
avatar zero-24 zero-24 - change - 25 May 2015
Category Code style
avatar zero-24 zero-24 - change - 25 May 2015
Status New Pending
avatar smz
smz - comment - 27 May 2015

@test OK by code review: I agree!!

avatar smz smz - test_item - 27 May 2015 - Tested successfully
avatar Bakual
Bakual - comment - 28 May 2015

Imho, the only difference between !empty() and the 'boolean' check is that empty also has an issetcheck included. Other than that they work exactly the same as far as I am aware.

So it just boils down to personal flavor which you want to use.
Personally I prefer the boolean check as I don't like the "double negation" of !empty. I only use empty when I'm not sure if the variable is defined or not. Then I can avoid using an additional isset check. But that's me, others handle it different.

avatar wilsonge
wilsonge - comment - 1 Jun 2015

We are using !empty throughout the rest of the file. So I don't think that's an issue. Merging on code review

avatar wilsonge wilsonge - change - 1 Jun 2015
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2015-06-01 11:40:43
Closed_By wilsonge
avatar wilsonge wilsonge - close - 1 Jun 2015
avatar wilsonge wilsonge - reference | 9f9d4b6 - 1 Jun 15
avatar wilsonge wilsonge - merge - 1 Jun 2015
avatar wilsonge wilsonge - close - 1 Jun 2015
avatar wilsonge wilsonge - change - 1 Jun 2015
Milestone Added:
avatar photodude photodude - head_ref_deleted - 1 Jun 2015

Add a Comment

Login with GitHub to post a comment