Page MenuHomePhabricator

Forbid empty() on set variables
Open, Needs TriagePublic

Description

empty is as widely used as dangerous. Per the php.net manual and our coding conventions, empty should only be used when the target may be unset, to suppress errors. Otherwise, a simple boolean cast is enough.

Given how hard is to determine whether a variable is set, this should be implemented within phan. I opened an upstream task for it, https://github.com/phan/phan/issues/3167. If an upstream rule is added, we must make sure to enable it in our config.

Event Timeline

Daimona created this task.Sep 30 2019, 4:11 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 30 2019, 4:11 PM
Daimona updated the task description. (Show Details)Sep 30 2019, 4:11 PM