You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As of PHPStan 1.5.0 and 1.5.1, the return type on curl_getinfo($ch, CURLINFO_CONTENT_TYPE) seems to string even though false will be returned when the header is not present.
I did glance at the PR that added the dynamic types and the author seems to have intended to handle this case. It was not immediately clear to me why it wasn't working.
Code snippet that reproduces the problem
For instance, the following code results in an error:
------ -------------------------------------------------------------------------------------
Line src/WebService/Http/CurlRequest.php
------ -------------------------------------------------------------------------------------
132 Strict comparison using === between string and false will always evaluate to false.
------ -------------------------------------------------------------------------------------
Bug report
As of PHPStan 1.5.0 and 1.5.1, the return type on
curl_getinfo($ch, CURLINFO_CONTENT_TYPE)
seems tostring
even thoughfalse
will be returned when the header is not present.I did glance at the PR that added the dynamic types and the author seems to have intended to handle this case. It was not immediately clear to me why it wasn't working.
Code snippet that reproduces the problem
For instance, the following code results in an error:
See this link.
Output:
Build failure.
Expected output
I expect no output from this code.
Did PHPStan help you today? Did it make you happy in any way?
PHPStan is extremely helpful in finding issues without running and testing the code.
The text was updated successfully, but these errors were encountered: