Skip to content

Commit 90403cc

Browse files
jlherrenondrejmirtes
authored andcommitted
Fix a couple CURLOPT_* parameter types
Fixes phpstan/phpstan#8152 Fixes phpstan/phpstan#8157
1 parent 76bd347 commit 90403cc

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

src/Reflection/ParametersAcceptorSelector.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,6 @@ private static function getCurlOptValueType(int $curlOpt): ?Type
631631
'CURLOPT_CAINFO',
632632
'CURLOPT_CAPATH',
633633
'CURLOPT_COOKIE',
634-
'CURLOPT_COOKIEFILE',
635634
'CURLOPT_COOKIEJAR',
636635
'CURLOPT_COOKIELIST',
637636
'CURLOPT_CUSTOMREQUEST',
@@ -646,9 +645,6 @@ private static function getCurlOptValueType(int $curlOpt): ?Type
646645
'CURLOPT_KRB4LEVEL',
647646
'CURLOPT_LOGIN_OPTIONS',
648647
'CURLOPT_PINNEDPUBLICKEY',
649-
'CURLOPT_PRIVATE',
650-
'CURLOPT_PRE_PROXY',
651-
'CURLOPT_PROXY',
652648
'CURLOPT_PROXY_SERVICE_NAME',
653649
'CURLOPT_PROXY_CAINFO',
654650
'CURLOPT_PROXY_CAPATH',
@@ -700,7 +696,11 @@ private static function getCurlOptValueType(int $curlOpt): ?Type
700696
}
701697

702698
$stringConstants = [
699+
'CURLOPT_COOKIEFILE',
703700
'CURLOPT_ENCODING',
701+
'CURLOPT_PRE_PROXY',
702+
'CURLOPT_PRIVATE',
703+
'CURLOPT_PROXY',
704704
];
705705
foreach ($stringConstants as $constName) {
706706
if (defined($constName) && constant($constName) === $curlOpt) {

tests/PHPStan/Rules/Functions/data/curl_setopt.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,9 @@ public function allGood(string $url, array $header) {
5050
curl_setopt($curl, CURLOPT_POSTFIELDS, array('foo' => 'bar'));
5151
curl_setopt($curl, CURLOPT_POSTFIELDS, '');
5252
curl_setopt($curl, CURLOPT_POSTFIELDS, 'para1=val1&para2=val2');
53+
curl_setopt($curl, CURLOPT_COOKIEFILE, '');
54+
curl_setopt($curl, CURLOPT_PRE_PROXY, '');
55+
curl_setopt($curl, CURLOPT_PROXY, '');
56+
curl_setopt($curl, CURLOPT_PRIVATE, '');
5357
}
5458
}

0 commit comments

Comments
 (0)