Skip to content

Commit ff0b69a

Browse files
committed
Add test cases
1 parent 8f4bc33 commit ff0b69a

File tree

2 files changed

+34
-14
lines changed

2 files changed

+34
-14
lines changed

tests/PHPStan/Rules/Debug/DumpPhpDocTypeRuleTest.php

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,61 +27,77 @@ public function testRuleSymbols(): void
2727
"Dumped type: array{'\0': 'NUL', NUL: '\0'}",
2828
6,
2929
],
30+
[
31+
"Dumped type: array{'\001': 'SOH', SOH: '\001'}",
32+
7,
33+
],
34+
[
35+
"Dumped type: array{'\t': 'HT', HT: '\t'}",
36+
8,
37+
],
3038
[
3139
"Dumped type: array{' ': 'SP', SP: ' '}",
32-
9,
40+
11,
3341
],
3442
[
3543
"Dumped type: array{'foo ': 'ends with SP', ' foo': 'starts with SP', ' foo ': 'surrounded by SP', foo: 'no SP'}",
36-
10,
44+
12,
3745
],
3846
[
3947
"Dumped type: array{'foo?': 'foo?'}",
40-
13,
48+
15,
4149
],
4250
[
4351
"Dumped type: array{shallwedance: 'yes'}",
44-
14,
52+
16,
4553
],
4654
[
4755
"Dumped type: array{'shallwedance?': 'yes'}",
48-
15,
56+
17,
4957
],
5058
[
5159
"Dumped type: array{'Shall we dance': 'yes'}",
52-
16,
60+
18,
5361
],
5462
[
5563
"Dumped type: array{'Shall we dance?': 'yes'}",
56-
17,
64+
19,
5765
],
5866
[
5967
"Dumped type: array{shall_we_dance: 'yes'}",
60-
18,
68+
20,
6169
],
6270
[
6371
"Dumped type: array{'shall_we_dance?': 'yes'}",
64-
19,
72+
21,
6573
],
6674
[
6775
"Dumped type: array{shall-we-dance: 'yes'}",
68-
20,
76+
22,
6977
],
7078
[
7179
"Dumped type: array{'shall-we-dance?': 'yes'}",
72-
21,
80+
23,
7381
],
7482
[
7583
"Dumped type: array{'Let\'s go': 'Let\'s go'}",
76-
22,
84+
24,
7785
],
7886
[
7987
"Dumped type: array{Foo\\Bar: 'Foo\\\\Bar'}",
80-
23,
88+
25,
89+
],
90+
[
91+
"Dumped type: array{'3.14': 3.14}",
92+
26,
93+
],
94+
[
95+
"Dumped type: array{1: true, 0: false}",
96+
27,
8197
],
8298
[
8399
"Dumped type: T",
84-
32,
100+
36,
85101
],
86102
]);
87103
}

tests/PHPStan/Rules/Debug/data/dump-phpdoc-type.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
dumpPhpDocType(['' => '']);
66
dumpPhpDocType(["\0" => 'NUL', 'NUL' => "\0"]);
7+
dumpPhpDocType(["\x01" => 'SOH', 'SOH' => "\x01"]);
8+
dumpPhpDocType(["\t" => 'HT', 'HT' => "\t"]);
79

810
// Space
911
dumpPhpDocType([" " => 'SP', 'SP' => ' ']);
@@ -21,6 +23,8 @@
2123
dumpPhpDocType(["shall-we-dance?" => 'yes']);
2224
dumpPhpDocType(['Let\'s go' => "Let's go"]);
2325
dumpPhpDocType(['Foo\\Bar' => 'Foo\\Bar']);
26+
dumpPhpDocType(['3.14' => 3.14]);
27+
dumpPhpDocType([true => true, false => false]);
2428

2529
/**
2630
* @template T

0 commit comments

Comments
 (0)