Skip to content

Commit 4bb5e1e

Browse files
committed
Address Psalm issues
1 parent 856d830 commit 4bb5e1e

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

psalm.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
88
findUnusedBaselineEntry="true"
99
findUnusedCode="false"
10+
ensureOverrideAttribute="false"
1011
phpVersion="8.3"
1112
>
1213
<projectFiles>
@@ -38,5 +39,7 @@
3839
<referencedClass name="Text_Template"/>
3940
</errorLevel>
4041
</UndefinedDocblockClass>
42+
<!-- Breaking change, final keywords to be added in next major version -->
43+
<ClassMustBeFinal errorLevel="info" />
4144
</issueHandlers>
4245
</psalm>

src/analyzer/Report/Html/Renderer/DashboardRenderer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ public function generate(AnalyzerResult $result): void
7373
$numDeleted = \count($result->getDeleted());
7474
$total = $numDead + $numUndead;
7575

76-
$deadPercent = $total ? $numDead / $total * 100 : 0;
77-
$undeadPercent = $total ? $numUndead / $total * 100 : 0;
76+
$deadPercent = $total ? (float) $numDead / (float) $total * 100.0 : 0.0;
77+
$undeadPercent = $total ? (float) $numUndead / (float) $total * 100.0 : 0.0;
7878

7979
$this->dashboardTemplate->setVar([
8080
'path_to_root' => '',

src/analyzer/Report/Html/Renderer/DirectoryItemRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ private function renderBar(int $numDead, int $total): string
6666
{
6767
$this->barTemplate->setVar([
6868
'level' => 'success',
69-
'percent' => round($numDead / $total * 100, 2),
69+
'percent' => round((float) $numDead / (float) $total * 100.0, 2),
7070
]);
7171

7272
return $this->barTemplate->render();

src/analyzer/Report/TimePeriodFormatter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ public static function formatAge(string $date): ?string
2020
return 'less than a day';
2121
}
2222

23-
$weeksPassed = floor($daysPassed / 7);
24-
$daysPassed = $daysPassed % 7;
23+
$weeksPassed = (int) floor($daysPassed / 7.0);
24+
$daysPassed = (int) $daysPassed % 7;
2525

2626
$timePassed = $daysPassed.' days';
2727
if ($weeksPassed) {

src/analyzer/Stock/TombstoneNodeVisitor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ private function visitClassNode(Class_ $node): void
6565

6666
private function visitMethodNode(ClassMethod $node): void
6767
{
68-
$methodName = $this->currentClass.($node->isStatic() ? '::' : '->').$node->name;
68+
$methodName = $this->currentClass.($node->isStatic() ? '::' : '->').(string) $node->name;
6969
$this->currentMethod[] = $methodName;
7070
}
7171

0 commit comments

Comments
 (0)