zf1-future icon indicating copy to clipboard operation
zf1-future copied to clipboard

Made all constant literal string equality checks use strict equality.

Open boenrobot opened this issue 1 year ago • 3 comments

Implemented by literally searching for ' == " == == ' == " and replacing the "==" with "===".

All other equality checks are left untouched, as changing them may result in different behavior, whereas these ones should behave the same, while reducing the surface area for type related bugs.

boenrobot avatar Oct 11 '23 11:10 boenrobot

Why exactly we need this, pls? I can see a lot o potential issues with this change.

develart-projects avatar Oct 11 '23 14:10 develart-projects

Why exactly we need this, pls? I can see a lot o potential issues with this change.

The hope was that it would be a trivial change to have less noise in IDEs and static analysis tools when further improving type safety (which in turn is important in ensuring cross version combability as PHP is moving into the direction of requiring more explicit things that were previously implicit).

But then again, the unit test suite already confirms your suspicions, so back to the drawing board for me 🤣

boenrobot avatar Oct 11 '23 14:10 boenrobot

I can see a lot of potential troubles with

=== '1' === ''

Potentially forcing me to disconnect from upstream, as strict typing is not the way I like to go with PHP. And backward compatibility is more important here, as static analyzers imo.

develart-projects avatar Oct 11 '23 15:10 develart-projects