One of the many things people fight in PHP or JS, especially if they are coming from some other language. Myself included when I first started using JS over two decades ago.
And when you stop fighting it, things get so much easier. Go so far as to embrace and leverage it -- such as loose false on success, loose true contains an error message -- you find out that loose typecasting is in fact easier and powerful. The opposite of what we assume and have been repeatedly told.