For "functions that return false", use thecodingmachine/safe which wraps those nasty builtins with ones that throw exceptions. PHP's gotten a lot better lately, but it's always going to need library fixes like that for its awful legacy builtins.
> I love the smell of false in the morning, but despite that I do wish that all PHP’s built-in functions threw exceptions. We have the famous safe library which does just that! But if you’re like me then you don’t like coupling huge amounts of code in perpetuity to an external library.