It's hard to trust a stranger from internet claiming something, but we are in IT so it should be relatively trivial to prove your claims, right?
It's hard to trust a stranger from internet claiming something, but we are in IT so it should be relatively trivial to prove your claims, right?
And that will return true, because you forgot the third "strict" parameter. This is really something strict_types could/should have fixed, but it doesn't.
You can have code reviews and static analysers and all of that to catch this, but it's definitely a landmine. I've seen some pretty serious CVEs that were fixed just by adding that last parameter to some in_array() call.
Was that everything? You basically state there's a problem because you didn't use the function correctly and language didn't fall head over heels to stop you from doing silly things due to slopiness?
P.I.C.N.I.C.
Anyone who is not capable of taking care of what you called footgun in a way where they automate - that person is not serious.
If there's a pretty huge problem - manage it. That's your job as programmer. If you're lazy, sloppy and prefer whining online over being proud of your work - there's no programming language that will take care of that for you.
Please provide examples in other languages (eg rust) so that I can answer your original question properly and to your satisfaction
What kind of logic is this, to blame the tool because you have no clue how to use it?
Tools must be designed so that they're difficult to use incorrectly. That's why we have guards and interlocks on any tool more complicated than a shovel.
This really isn't that hard, we're not trying to travel to Mars.
It would easily catch this. https://phpstan.org/r/a827ff45-4ee2-4bee-8ae0-935832e627b3
I hate Rollercoasters, I hate surprises and strong emotions. So if you ask me how Disneyworld is, I'll tell you it sucked for me. But maybe you are onto that, so you shouldn't trust me.
Back yo PHP I've used it for super fast tiny dynamic websites, and it works wonders. I wouldn't do an online exchange with it though.