scrutinizer-ci / scrutinizer

Legacy repository - archives past feature requests/bug reports
https://scrutinizer-ci.com/docs
140 stars 36 forks source link

empty(array()) implicitly == false but reported to use instead of boolean #361

Open ktomk opened 8 years ago

ktomk commented 8 years ago

see https://scrutinizer-ci.com/g/ktomk/n98-magerun/inspections/1f9fe671-717a-48d2-ba90-34f375f4c1eb/issues/files/src/N98/Util/Console/Helper/Table/Renderer/CsvRenderer.php?status=new&selectedLabels%5B0%5D=9&orderField=path&order=asc&honorSelectedPaths=0#inspectioncomment-4573546

The suggestion to use empty() instead of implicit boolean false is superfluous, empty checks the same (plus isset() check) according to the manual (http://php.net/empty):

A variable is considered empty if it does not exist or if its value equals FALSE.

isset() check is not intended most often, so suggesting empty() is not only superfluous for existing variables as in this reported case but also misleading as it suggest the variable might not exist (for some reason) while it absolutely does under the reported circumstances.