Skip to content

Commit d0c4d10

Browse files
Feedback
1 parent 93ac2e4 commit d0c4d10

File tree

3 files changed

+45
-3
lines changed

3 files changed

+45
-3
lines changed

src/dumpType.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,38 @@
55
/**
66
* @phpstan-pure
77
* @param mixed $value
8+
* @param mixed $values
89
* @return mixed
910
*
1011
* @throws void
1112
*/
12-
function dumpType(...$value) // phpcs:ignore Squiz.Functions.GlobalFunction.Found
13+
function dumpType($value, ...$values) // phpcs:ignore Squiz.Functions.GlobalFunction.Found
1314
{
1415
return null;
1516
}
1617

1718
/**
1819
* @phpstan-pure
1920
* @param mixed $value
21+
* @param mixed $values
2022
* @return mixed
2123
*
2224
* @throws void
2325
*/
24-
function dumpNativeType(...$value) // phpcs:ignore Squiz.Functions.GlobalFunction.Found
26+
function dumpNativeType($value, ...$values) // phpcs:ignore Squiz.Functions.GlobalFunction.Found
2527
{
2628
return null;
2729
}
2830

2931
/**
3032
* @phpstan-pure
3133
* @param mixed $value
34+
* @param mixed $values
3235
* @return mixed
3336
*
3437
* @throws void
3538
*/
36-
function dumpPhpDocType(...$value) // phpcs:ignore Squiz.Functions.GlobalFunction.Found
39+
function dumpPhpDocType($value, ...$values) // phpcs:ignore Squiz.Functions.GlobalFunction.Found
3740
{
3841
return null;
3942
}

tests/PHPStan/Rules/Functions/CallToFunctionParametersRuleTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2679,6 +2679,24 @@ public function testBug8936(): void
26792679
$this->analyse([__DIR__ . '/data/bug-8936.php'], []);
26802680
}
26812681

2682+
public function testDumpFunctions(): void
2683+
{
2684+
$this->analyse([__DIR__ . '/data/dump-functions.php'], [
2685+
[
2686+
'Function PHPStan\dumpType invoked with 0 parameters, at least 1 required.',
2687+
13,
2688+
],
2689+
[
2690+
'Function PHPStan\dumpNativeType invoked with 0 parameters, at least 1 required.',
2691+
14,
2692+
],
2693+
[
2694+
'Function PHPStan\dumpPhpDocType invoked with 0 parameters, at least 1 required.',
2695+
15,
2696+
],
2697+
]);
2698+
}
2699+
26822700
public function testBug14012(): void
26832701
{
26842702
$this->checkExplicitMixed = true;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace DumpFunctions;
4+
5+
use function PHPStan\dumpType;
6+
use function PHPStan\dumpNativeType;
7+
use function PHPStan\dumpPhpdocType;
8+
9+
class HelloWorld
10+
{
11+
public function sayHello(): void
12+
{
13+
dumpType();
14+
dumpNativeType();
15+
dumpPhpdocType();
16+
17+
dumpType(1, 2, 3);
18+
dumpNativeType(1, 2, 3);
19+
dumpPhpdocType(1, 2, 3);
20+
}
21+
}

0 commit comments

Comments
 (0)