Skip to content

Commit f3210ff

Browse files
committed
bleeding edge only
1 parent 5ce0d45 commit f3210ff

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

conf/bleedingEdge.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ parameters:
1313
reportTooWideBool: true
1414
rawMessageInBaseline: true
1515
reportNestedTooWideType: false
16+
curlSetOptArrayTypes: true

conf/config.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ parameters:
3737
reportTooWideBool: false
3838
rawMessageInBaseline: false
3939
reportNestedTooWideType: false
40+
curlSetOptArrayTypes: false
4041
fileExtensions:
4142
- php
4243
checkAdvancedIsset: false

conf/parametersSchema.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ parametersSchema:
4040
reportTooWideBool: bool()
4141
rawMessageInBaseline: bool()
4242
reportNestedTooWideType: bool()
43+
curlSetOptArrayTypes: bool()
4344
])
4445
fileExtensions: listOf(string())
4546
checkAdvancedIsset: bool()

src/Reflection/ParametersAcceptorSelector.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
use PHPStan\Type\ArrayType;
2828
use PHPStan\Type\BooleanType;
2929
use PHPStan\Type\CallableType;
30-
use PHPStan\Type\Constant\ConstantArrayType;
3130
use PHPStan\Type\Constant\ConstantArrayTypeBuilder;
3231
use PHPStan\Type\Constant\ConstantIntegerType;
3332
use PHPStan\Type\Generic\TemplateType;
@@ -53,6 +52,7 @@
5352
use function constant;
5453
use function count;
5554
use function defined;
55+
use function is_int;
5656
use function is_string;
5757
use function sprintf;
5858
use const ARRAY_FILTER_USE_BOTH;
@@ -163,7 +163,7 @@ public static function selectFromArgs(
163163
$optArrayType = $scope->getType($args[1]->value);
164164

165165
$builder = ConstantArrayTypeBuilder::createEmpty();
166-
foreach($optArrayType->getIterableKeyType()->getConstantScalarValues() as $optValue) {
166+
foreach ($optArrayType->getIterableKeyType()->getConstantScalarValues() as $optValue) {
167167
if (!is_int($optValue)) {
168168
$builder = null;
169169
break;
@@ -177,7 +177,7 @@ public static function selectFromArgs(
177177

178178
$builder->setOffsetValueType(
179179
new ConstantIntegerType($optValue),
180-
$optValueType
180+
$optValueType,
181181
);
182182
}
183183

tests/PHPStan/Rules/Functions/CallToFunctionParametersRuleTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,17 +1384,17 @@ public function testCurlSetOptArray(): void
13841384
[
13851385
"Parameter #2 \$options of function curl_setopt_array expects array{19913: bool, 10102: string, 68: int, 13: int, 84: int, 10036: non-empty-string|null}, array{19913: true, 10102: '', 68: 10, 13: 30, 84: 2, 10036: CurlSetOptArray\RequestMethod::POST} given.",
13861386
30,
1387-
"Offset 10036 (non-empty-string|null) does not accept type CurlSetOptArray\RequestMethod::POST."
1387+
'Offset 10036 (non-empty-string|null) does not accept type CurlSetOptArray\RequestMethod::POST.',
13881388
],
13891389
[
13901390
"Parameter #2 \$options of function curl_setopt_array expects array{19913: bool, 10102: string, 68: int, 13: int, 84: int, 10036: non-empty-string|null}, array{19913: true, 10102: '', 68: 10, 13: 30, 84: 2, 10036: CurlSetOptArray\BackedRequestMethod::POST} given.",
13911391
42,
1392-
"Offset 10036 (non-empty-string|null) does not accept type CurlSetOptArray\BackedRequestMethod::POST."
1392+
'Offset 10036 (non-empty-string|null) does not accept type CurlSetOptArray\BackedRequestMethod::POST.',
13931393
],
13941394
[
13951395
"Parameter #2 \$options of function curl_setopt_array expects array{19913: bool, 10102: string, 68: int, 13: int, 84: int}, array{19913: '123', 10102: '', 68: 10, 13: 30, 84: false} given.",
13961396
54,
1397-
"Offset 19913 (bool) does not accept type string."
1397+
'Offset 19913 (bool) does not accept type string.',
13981398
],
13991399

14001400
]);

0 commit comments

Comments
 (0)