Skip to content

Commit b85a920

Browse files
TysonAndresebastianbergmann
authored andcommitted
Fix an impossible condition
In PHP, `0 === 0.0` is false. Impact: rendering some output as an int `x` instead of `x.00`
1 parent b93a224 commit b85a920

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/Node/File.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ private function processFunctions(\PHP_Token_Stream $tokens): void
578578

579579
private function crap(int $ccn, float $coverage): string
580580
{
581-
if ($coverage === 0) {
581+
if ($coverage === 0.0) {
582582
return (string) ($ccn ** 2 + $ccn);
583583
}
584584

tests/_files/BankAccount-clover.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</class>
88
<line num="6" type="method" name="getBalance" signature="getBalance" visibility="public" complexity="1" crap="1" count="2"/>
99
<line num="8" type="stmt" count="2"/>
10-
<line num="11" type="method" name="setBalance" signature="setBalance" visibility="protected" complexity="2" crap="6.00" count="0"/>
10+
<line num="11" type="method" name="setBalance" signature="setBalance" visibility="protected" complexity="2" crap="6" count="0"/>
1111
<line num="13" type="stmt" count="0"/>
1212
<line num="14" type="stmt" count="0"/>
1313
<line num="15" type="stmt" count="0"/>

tests/_files/Report/HTML/CoverageForBankAccount/BankAccount.php.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
</td>
131131
<td class="danger small"><div align="right">0.00%</div></td>
132132
<td class="danger small"><div align="right">0&nbsp;/&nbsp;1</div></td>
133-
<td class="danger small">6.00</td>
133+
<td class="danger small">6</td>
134134
<td class="danger big"> <div class="progress">
135135
<div class="progress-bar bg-danger" role="progressbar" aria-valuenow="0.00" aria-valuemin="0" aria-valuemax="100" style="width: 0.00%">
136136
<span class="sr-only">0.00% covered (danger)</span>

tests/_files/Report/XML/CoverageForBankAccount/BankAccount.php.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<package full="" name="" sub="" category=""/>
1313
<namespace name=""/>
1414
<method name="getBalance" signature="getBalance()" start="6" end="9" crap="1" executable="1" executed="1" coverage="100"/>
15-
<method name="setBalance" signature="setBalance($balance)" start="11" end="18" crap="6.00" executable="5" executed="0" coverage="0"/>
15+
<method name="setBalance" signature="setBalance($balance)" start="11" end="18" crap="6" executable="5" executed="0" coverage="0"/>
1616
<method name="depositMoney" signature="depositMoney($balance)" start="20" end="25" crap="1" executable="2" executed="2" coverage="100"/>
1717
<method name="withdrawMoney" signature="withdrawMoney($balance)" start="27" end="32" crap="1" executable="2" executed="2" coverage="100"/>
1818
</class>

0 commit comments

Comments
 (0)