Pierre-Lannoy / wp-decalog

Capture and log events, metrics and traces on your site. Make WordPress observable - finally!
https://perfops.one/
GNU General Public License v3.0
64 stars 8 forks source link

Remove else from CoreListener #8

Closed szepeviktor closed 5 years ago

szepeviktor commented 5 years ago

else is no one's friend

Pierre-Lannoy commented 5 years ago

Hello Viktor! Sorry to ask, I'm not totally aware of these sort of things... Could you tell me why you suggest not to use else? Is it in this specific case or is it a general recommandation?

szepeviktor commented 5 years ago

else adds a branch, it'll be more complex, and those pesky indentations! Some standards ban them: https://github.com/object-calisthenics/phpcs-calisthenics-rules#2-do-not-use-else-keyword

And my favourite: https://youtu.be/5DVDewOReoY?t=404

szepeviktor commented 5 years ago

Another good one from the same person: https://www.youtube.com/watch?v=crSUWtRYw-M

Pierre-Lannoy commented 5 years ago

Aha. You (and Adam Wathan) convinced me :) I will merge your PR and will try to do this way in the billions of places where I did it badly. As and as I will refactor classes... Thanks for the hint.