Skip to content

Commit f764dd1

Browse files
committed
kill mutants
1 parent c90bb0e commit f764dd1

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

tests/PHPStan/Rules/TooWideTypehints/TooWideFunctionReturnTypehintRuleTest.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ public function testBug13384cPhp82(): void
9494
'Function Bug13384c\doFooPhpdoc2() never returns true so the return type can be changed to false.',
9595
100,
9696
],
97+
[
98+
'Function Bug13384c\returnsTrueUnionReturn() never returns int so it can be removed from the return type.',
99+
130,
100+
],
101+
[
102+
'Function Bug13384c\returnsTruePhpdocUnionReturn() never returns int so it can be removed from the return type.',
103+
137,
104+
],
97105
]);
98106
}
99107

@@ -116,7 +124,16 @@ public function testBug13384cPrePhp82(): void
116124

117125
public function testBug13384cOff(): void
118126
{
119-
$this->analyse([__DIR__ . '/data/bug-13384c.php'], []);
127+
$this->analyse([__DIR__ . '/data/bug-13384c.php'], [
128+
[
129+
'Function Bug13384c\returnsTrueUnionReturn() never returns int so it can be removed from the return type.',
130+
130,
131+
],
132+
[
133+
'Function Bug13384c\returnsTruePhpdocUnionReturn() never returns int so it can be removed from the return type.',
134+
137,
135+
],
136+
]);
120137
}
121138

122139
public function testNestedTooWideType(): void

tests/PHPStan/Rules/TooWideTypehints/data/bug-13384c.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,14 @@ function returnsTrueNoPhpdoc(): bool {
126126
function returnsFalseNoPhpdoc(): bool {
127127
return false;
128128
}
129+
130+
function returnsTrueUnionReturn(): int|bool {
131+
return true;
132+
}
133+
134+
/**
135+
* @return int|bool
136+
*/
137+
function returnsTruePhpdocUnionReturn() {
138+
return true;
139+
}

0 commit comments

Comments
 (0)