Re: Passing null to parameter

From: Date: Fri, 10 Nov 2023 12:16:11 +0000
Subject: Re: Passing null to parameter
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-121639@lists.php.net to get a copy of this message
On 10.11.23 12:33, Craig Francis wrote:
On 10 Nov 2023, at 10:54, Alex Wells<autaut03@gmail.com> wrote:
PHPStan does find them:https://phpstan.org/r/38fc1545-2567-49b9-9937-f275dcfff6f5
It does not: https://phpstan.org/r/c533ff42-80e4-4309-9751-1ec79e359946
Psalm does give you a PossiblyInvalidArgument here, PHPStan will likely detect this soon too, as both static analyzers are covering more and more ground. Also note that in your example $q could be an array (leading to a fatal error in the code)from the request data, which is why checking types thoroughly (not just coercing them with strval) can be helpful in avoiding unexpected situations and deciding how to handle such situations, instead of yolo-ing it.

« previous php.internals (#121639) next »