Skip to content

Commit e5ac757

Browse files
VincentLangletondrejmirtes
authored andcommitted
Add tests for DumpNativeRule
1 parent 89d0610 commit e5ac757

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace PHPStan\Rules\Debug;
4+
5+
use PHPStan\Rules\Rule;
6+
use PHPStan\Testing\RuleTestCase;
7+
8+
/**
9+
* @extends RuleTestCase<DumpNativeTypeRule>
10+
*/
11+
class DumpNativeTypeRuleTest extends RuleTestCase
12+
{
13+
14+
protected function getRule(): Rule
15+
{
16+
return new DumpNativeTypeRule(self::createReflectionProvider());
17+
}
18+
19+
public function testRule(): void
20+
{
21+
$this->analyse([__DIR__ . '/data/dump-native-type.php'], [
22+
[
23+
'Dumped type: non-empty-array',
24+
11,
25+
],
26+
[
27+
'Dumped type: array',
28+
12,
29+
],
30+
]);
31+
}
32+
33+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace PHPStan;
4+
5+
/** @param non-empty-array $b */
6+
function (array $a, array $b) {
7+
if ($a === []) {
8+
return;
9+
}
10+
11+
dumpNativeType($a);
12+
dumpNativeType($b);
13+
};

0 commit comments

Comments
 (0)