psalm
psalm copied to clipboard
False-positive `UnusedFunctionCall` on `curl_share_setopt()`
https://psalm.dev/r/d1e3f95e5d
I found these snippets:
https://psalm.dev/r/d1e3f95e5d
<?php
function createCurlShareHandle(): CurlShareHandle
{
$handle = curl_share_init();
curl_share_setopt($handle, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
curl_share_setopt($handle, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS);
curl_share_setopt($handle, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION);
return $handle;
}
Psalm output (using commit cdceda0):
ERROR: UnusedFunctionCall - 6:5 - The call to curl_share_setopt is not used
ERROR: UnusedFunctionCall - 7:5 - The call to curl_share_setopt is not used
ERROR: UnusedFunctionCall - 8:5 - The call to curl_share_setopt is not used
The solution is probably to add curl_share_setopt in the list of impure functions (as done already for curl_setopt)