Skip to content

Commit 71e7550

Browse files
committed
functionMap - synchronized some of parameter names with PHP 8 stubs to have the test always pass
1 parent b87dba1 commit 71e7550

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

resources/functionMap.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -1796,7 +1796,7 @@
17961796
'debugger_print' => [''],
17971797
'debugger_start_debug' => [''],
17981798
'decbin' => ['string', 'decimal_number'=>'int'],
1799-
'dechex' => ['string', 'decimal_number'=>'int'],
1799+
'dechex' => ['string', 'num'=>'int'],
18001800
'decoct' => ['string', 'decimal_number'=>'int'],
18011801
'define' => ['bool', 'constant_name'=>'string', 'value'=>'mixed', 'case_insensitive='=>'bool'],
18021802
'define_syslog_variables' => ['void'],
@@ -3003,7 +3003,7 @@
30033003
'forward_static_call_array' => ['mixed', 'function'=>'callable', 'parameters'=>'array<int,mixed>'],
30043004
'fpassthru' => ['int|false', 'fp'=>'resource'],
30053005
'fpm_get_status' => ['array|false'],
3006-
'fprintf' => ['int', 'stream'=>'resource', 'format'=>'string', '...args='=>'string|int|float'],
3006+
'fprintf' => ['int', 'stream'=>'resource', 'format'=>'string', '...values='=>'string|int|float'],
30073007
'fputcsv' => ['int|false', 'fp'=>'resource', 'fields'=>'array', 'delimiter='=>'string', 'enclosure='=>'string', 'escape_char='=>'string'],
30083008
'fputs' => ['int|false', 'fp'=>'resource', 'str'=>'string', 'length='=>'int'],
30093009
'fread' => ['string|false', 'fp'=>'resource', 'length'=>'int'],
@@ -8845,7 +8845,7 @@
88458845
'prev' => ['mixed', '&rw_array_arg'=>'array'],
88468846
'print' => ['int', 'arg'=>'string'],
88478847
'print_r' => ['string|true', 'var'=>'mixed', 'return='=>'bool'],
8848-
'printf' => ['int', 'format'=>'string', '...args='=>'string|int|float'],
8848+
'printf' => ['int', 'format'=>'string', '...values='=>'string|int|float'],
88498849
'proc_close' => ['int', 'process'=>'resource'],
88508850
'proc_get_status' => ['array{command: string, pid: int, running: bool, signaled: bool, stopped: bool, exitcode: int, termsig: int, stopsig: int}|false', 'process'=>'resource'],
88518851
'proc_nice' => ['bool', 'priority'=>'int'],
@@ -9875,7 +9875,7 @@
98759875
'register_tick_function' => ['bool', 'function'=>'callable(): void', '...args='=>'mixed'],
98769876
'rename' => ['bool', 'old_name'=>'string', 'new_name'=>'string', 'context='=>'resource'],
98779877
'rename_function' => ['bool', 'original_name'=>'string', 'new_name'=>'string'],
9878-
'reset' => ['mixed', '&rw_array_arg'=>'array'],
9878+
'reset' => ['mixed', '&rw_array'=>'array'],
98799879
'ResourceBundle::__construct' => ['void', 'locale'=>'string', 'bundlename'=>'string', 'fallback='=>'bool'],
98809880
'ResourceBundle::count' => ['int'],
98819881
'ResourceBundle::create' => ['?ResourceBundle', 'locale'=>'string', 'bundlename'=>'string', 'fallback='=>'bool'],
@@ -10141,7 +10141,7 @@
1014110141
'SessionUpdateTimestampHandler::validateId' => ['char', 'id'=>'string'],
1014210142
'SessionUpdateTimestampHandlerInterface::updateTimestamp' => ['bool', 'key'=>'string', 'val'=>'string'],
1014310143
'SessionUpdateTimestampHandlerInterface::validateId' => ['bool', 'key'=>'string'],
10144-
'set_error_handler' => ['?callable', 'error_handler'=>'null|callable(int,string,string,int,array):bool|callable(int,string,string,int):bool|callable(int,string,string):bool|callable(int,string):bool', 'error_types='=>'int'],
10144+
'set_error_handler' => ['?callable', 'callback'=>'null|callable(int,string,string,int,array):bool|callable(int,string,string,int):bool|callable(int,string,string):bool|callable(int,string):bool', 'error_types='=>'int'],
1014510145
'set_exception_handler' => ['null|callable(Throwable):void', 'exception_handler'=>'null|callable(Throwable):void'],
1014610146
'set_file_buffer' => ['int', 'fp'=>'resource', 'buffer'=>'int'],
1014710147
'set_include_path' => ['string', 'new_include_path'=>'string'],
@@ -10232,7 +10232,7 @@
1023210232
'SimpleXMLElement::addChild' => ['SimpleXMLElement', 'name'=>'string', 'value='=>'string', 'ns='=>'string'],
1023310233
'SimpleXMLElement::asXML' => ['string|bool', 'filename='=>'string'],
1023410234
'SimpleXMLElement::attributes' => ['SimpleXMLElement|null', 'ns='=>'string', 'is_prefix='=>'bool'],
10235-
'SimpleXMLElement::children' => ['SimpleXMLElement', 'ns='=>'string|null', 'is_prefix='=>'bool'],
10235+
'SimpleXMLElement::children' => ['SimpleXMLElement', 'namespaceOrPrefix='=>'string|null', 'is_prefix='=>'bool'],
1023610236
'SimpleXMLElement::count' => ['int'],
1023710237
'SimpleXMLElement::getDocNamespaces' => ['string[]', 'recursive='=>'bool', 'from_root='=>'bool'],
1023810238
'SimpleXMLElement::getName' => ['string'],
@@ -10298,9 +10298,9 @@
1029810298
'SoapClient::__setSoapHeaders' => ['bool', 'soapheaders='=>''],
1029910299
'SoapClient::__soapCall' => ['', 'function_name'=>'string', 'arguments'=>'array', 'options='=>'array', 'input_headers='=>'SoapHeader|array', '&w_output_headers='=>'array'],
1030010300
'SoapClient::SoapClient' => ['object', 'wsdl'=>'mixed', 'options='=>'array|null'],
10301-
'SoapFault::__construct' => ['void', 'faultcode'=>'string', 'faultstring'=>'string', 'faultactor='=>'string', 'detail='=>'string', 'faultname='=>'string', 'headerfault='=>'string'],
10301+
'SoapFault::__construct' => ['void', 'faultcode'=>'string', 'string'=>'string', 'faultactor='=>'string', 'detail='=>'string', 'faultname='=>'string', 'headerfault='=>'string'],
1030210302
'SoapFault::__toString' => ['string'],
10303-
'SoapFault::SoapFault' => ['object', 'faultcode'=>'string', 'faultstring'=>'string', 'faultactor='=>'string', 'detail='=>'string', 'faultname='=>'string', 'headerfault='=>'string'],
10303+
'SoapFault::SoapFault' => ['object', 'faultcode'=>'string', 'string'=>'string', 'faultactor='=>'string', 'detail='=>'string', 'faultname='=>'string', 'headerfault='=>'string'],
1030410304
'SoapHeader::__construct' => ['void', 'namespace'=>'string', 'name'=>'string', 'data='=>'mixed', 'mustunderstand='=>'bool', 'actor='=>'string'],
1030510305
'SoapHeader::SoapHeader' => ['object', 'namespace'=>'string', 'name'=>'string', 'data='=>'mixed', 'mustunderstand='=>'bool', 'actor='=>'string'],
1030610306
'SoapParam::__construct' => ['void', 'data'=>'mixed', 'name'=>'string'],
@@ -11400,7 +11400,7 @@
1140011400
'Spoofchecker::setAllowedLocales' => ['void', 'locale_list'=>'string'],
1140111401
'Spoofchecker::setChecks' => ['void', 'checks'=>'long'],
1140211402
'Spoofchecker::setRestrictionLevel' => ['void', 'restriction_level'=>'int'],
11403-
'sprintf' => ['string', 'format'=>'string', '...args='=>'string|int|float|bool'],
11403+
'sprintf' => ['string', 'format'=>'string', '...values='=>'string|int|float|bool'],
1140411404
'sql_regcase' => ['string', 'string'=>'string'],
1140511405
'SQLite3::__construct' => ['void', 'filename'=>'string', 'flags='=>'int', 'encryption_key='=>'string|null'],
1140611406
'SQLite3::busyTimeout' => ['bool', 'msecs'=>'int'],

src/Reflection/SignatureMap/NativeFunctionReflectionProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function findFunctionReflection(string $functionName): ?NativeFunctionRef
5353
array_map(static function (ParameterSignature $parameterSignature) use ($lowerCasedFunctionName): NativeParameterReflection {
5454
$type = $parameterSignature->getType();
5555
if (
56-
$parameterSignature->getName() === 'args'
56+
$parameterSignature->getName() === 'values'
5757
&& (
5858
$lowerCasedFunctionName === 'printf'
5959
|| $lowerCasedFunctionName === 'sprintf'

tests/PHPStan/Rules/Classes/InstantiationRuleTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ public function testSoap(): void
201201
[__DIR__ . '/data/instantiation-soap.php'],
202202
[
203203
[
204-
'Parameter #2 $faultstring of class SoapFault constructor expects string, int given.',
204+
'Parameter #2 $string of class SoapFault constructor expects string, int given.',
205205
6,
206206
],
207207
]

tests/PHPStan/Rules/Functions/CallToFunctionParametersRuleTest.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function testCallToFunctionWithIncorrectParameters(): void
4343
14,
4444
],
4545
[
46-
'Parameter #1 $error_handler of function set_error_handler expects (callable(int, string, string, int, array): bool)|null, Closure(mixed, mixed, mixed, mixed): void given.',
46+
'Parameter #1 $callback of function set_error_handler expects (callable(int, string, string, int, array): bool)|null, Closure(mixed, mixed, mixed, mixed): void given.',
4747
16,
4848
],
4949
]);
@@ -220,7 +220,7 @@ public function testPassingNonVariableToParameterPassedByReference(): void
220220
33,
221221
],
222222
[
223-
'Parameter #1 $array_arg of function reset expects array, null given.',
223+
'Parameter #1 $array of function reset expects array, null given.',
224224
39,
225225
],
226226
]);
@@ -311,19 +311,19 @@ public function testUnpackOperator(): void
311311
{
312312
$this->analyse([__DIR__ . '/data/unpack-operator.php'], [
313313
[
314-
'Parameter #2 ...$args of function sprintf expects bool|float|int|string|null, array<string> given.',
314+
'Parameter #2 ...$values of function sprintf expects bool|float|int|string|null, array<string> given.',
315315
18,
316316
],
317317
[
318-
'Parameter #2 ...$args of function sprintf expects bool|float|int|string|null, array<int, string> given.',
318+
'Parameter #2 ...$values of function sprintf expects bool|float|int|string|null, array<int, string> given.',
319319
19,
320320
],
321321
[
322-
'Parameter #2 ...$args of function sprintf expects bool|float|int|string|null, UnpackOperator\Foo given.',
322+
'Parameter #2 ...$values of function sprintf expects bool|float|int|string|null, UnpackOperator\Foo given.',
323323
22,
324324
],
325325
[
326-
'Parameter #2 ...$args of function printf expects bool|float|int|string|null, UnpackOperator\Foo given.',
326+
'Parameter #2 ...$values of function printf expects bool|float|int|string|null, UnpackOperator\Foo given.',
327327
24,
328328
],
329329
]);
@@ -333,11 +333,11 @@ public function testFunctionWithNumericParameterThatCreatedByAddition(): void
333333
{
334334
$this->analyse([__DIR__ . '/data/function-with-int-parameter-that-created-by-addition.php'], [
335335
[
336-
'Parameter #1 $decimal_number of function dechex expects int, float|int given.',
336+
'Parameter #1 $num of function dechex expects int, float|int given.',
337337
9,
338338
],
339339
[
340-
'Parameter #1 $decimal_number of function dechex expects int, float|int given.',
340+
'Parameter #1 $num of function dechex expects int, float|int given.',
341341
40,
342342
],
343343
]);

tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ public function testCallMethods(): void
388388
921,
389389
],
390390
[
391-
'Parameter #1 $ns of method SimpleXMLElement::children() expects string|null, int given.',
391+
'Parameter #1 $namespaceOrPrefix of method SimpleXMLElement::children() expects string|null, int given.',
392392
942,
393393
],
394394
[

0 commit comments

Comments
 (0)