Skip to content

Commit 90933b3

Browse files
authored
Remove incorrect CURLOPT_ACCEPT_ENCODING alias
1 parent f8d27d5 commit 90933b3

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

src/Reflection/ParametersAcceptorSelector.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,6 @@ private static function getCurlOptValueType(int $curlOpt): ?Type
919919
}
920920

921921
$nullableStringConstants = [
922-
'CURLOPT_ACCEPT_ENCODING',
923922
'CURLOPT_CUSTOMREQUEST',
924923
'CURLOPT_DNS_INTERFACE',
925924
'CURLOPT_DNS_LOCAL_IP4',
@@ -1032,7 +1031,7 @@ private static function getCurlOptValueType(int $curlOpt): ?Type
10321031

10331032
$stringConstants = [
10341033
'CURLOPT_COOKIEFILE',
1035-
'CURLOPT_ENCODING',
1034+
'CURLOPT_ENCODING', // Alias: CURLOPT_ACCEPT_ENCODING
10361035
'CURLOPT_PRE_PROXY',
10371036
'CURLOPT_PRIVATE',
10381037
'CURLOPT_PROXY',

tests/PHPStan/Rules/Functions/CallToFunctionParametersRuleTest.php

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,40 +1321,48 @@ public function testCurlSetOpt(): void
13211321
18,
13221322
],
13231323
[
1324-
'Parameter #3 $value of function curl_setopt expects bool, int given.',
1324+
'Parameter #3 $value of function curl_setopt expects string, int given.',
1325+
19,
1326+
],
1327+
[
1328+
'Parameter #3 $value of function curl_setopt expects string, int given.',
13251329
20,
13261330
],
1331+
[
1332+
'Parameter #3 $value of function curl_setopt expects bool, int given.',
1333+
22,
1334+
],
13271335
[
13281336
'Parameter #3 $value of function curl_setopt expects bool, string given.',
1329-
21,
1337+
23,
13301338
],
13311339
[
13321340
'Parameter #3 $value of function curl_setopt expects int, string given.',
1333-
23,
1341+
25,
13341342
],
13351343
[
13361344
'Parameter #3 $value of function curl_setopt expects array, string given.',
1337-
25,
1345+
27,
13381346
],
13391347
[
13401348
'Parameter #3 $value of function curl_setopt expects resource, string given.',
1341-
27,
1349+
29,
13421350
],
13431351
[
13441352
'Parameter #3 $value of function curl_setopt expects array|string, int given.',
1345-
29,
1353+
31,
13461354
],
13471355
[
13481356
'Parameter #3 $value of function curl_setopt expects non-empty-string, \'\' given.',
1349-
31,
1357+
33,
13501358
],
13511359
[
13521360
'Parameter #3 $value of function curl_setopt expects non-empty-string|null, \'\' given.',
1353-
32,
1361+
34,
13541362
],
13551363
[
13561364
'Parameter #3 $value of function curl_setopt expects array<int, string>, array<string, string> given.',
1357-
73,
1365+
77,
13581366
],
13591367
]);
13601368
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ public function errors(int $i, string $s) {
1616
curl_setopt($curl, CURLOPT_URL, $i);
1717
curl_setopt($curl, CURLOPT_HTTPHEADER, $i);
1818
curl_setopt($curl, CURLOPT_ABSTRACT_UNIX_SOCKET, null);
19+
curl_setopt($curl, CURLOPT_ENCODING, $i);
20+
curl_setopt($curl, CURLOPT_ACCEPT_ENCODING, $i);
1921
// expecting bool
2022
curl_setopt($curl, CURLOPT_AUTOREFERER, $i);
2123
curl_setopt($curl, CURLOPT_RETURNTRANSFER, $s);
@@ -62,6 +64,8 @@ public function allGood(string $url, array $header) {
6264
curl_setopt($curl, CURLOPT_PRE_PROXY, '');
6365
curl_setopt($curl, CURLOPT_PROXY, '');
6466
curl_setopt($curl, CURLOPT_PRIVATE, '');
67+
curl_setopt($curl, CURLOPT_ENCODING, '');
68+
curl_setopt($curl, CURLOPT_ACCEPT_ENCODING, '');
6569
}
6670

6771
public function bug9263() {

0 commit comments

Comments
 (0)