Reputation: 950
Let's say I have the following code:
$result = $thirdPartyAPI->doSomething(); // returns false if error
if ($result == false) {
return $someErrorCode;
}
// process the valid $result
I have lots of calls to the $thirdPartyAPI
spread throughout the code, so I don't want to forget about checking if $result
is a valid one or an error happened.
I've checked PHP Code Sniffer and PHP Mess Detector tools, but I've found none of their rules to be appropiate for this particular case.
I'm wondering if there is a tool (such a static code analysis one) that is able to report whether I forgot to check that a returned value has a certain value.
Upvotes: 1
Views: 341
Reputation: 24298
Since 2017 there is: PHPStan
I use it and it works like a charm. Here is simple intro to it
Upvotes: 1