Skip to content

Commit

Permalink
Implicitly cast floats to integers where required
Browse files Browse the repository at this point in the history
  • Loading branch information
szymach committed Jun 27, 2022
1 parent 4273e96 commit 9b903cb
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 172 deletions.
136 changes: 0 additions & 136 deletions .scrutinizer.yml

This file was deleted.

2 changes: 1 addition & 1 deletion codeception.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ settings:
convert_deprecations_to_exceptions: true
colors: true
error_level: E_ALL | E_STRICT | E_DEPRECATED
report_useless_tests: true

This comment has been minimized.

Copy link
@cath-crypto

cath-crypto Dec 26, 2024

This comment has been minimized.

Copy link
@cath-crypto

cath-crypto Dec 26, 2024

murderer

report_useless_tests: true
9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
version: "3.4"

services:
web:
image: fsiopen/docker-php-apache:alpine-8.1
container_name: c-pchart-php
volumes:
- ./:/var/www/application
18 changes: 13 additions & 5 deletions src/BaseDraw.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,17 +264,20 @@ public function allocateColor($Picture, $R, $G, $B, $Alpha = 100)
{
if ($R < 0) {
$R = 0;
} if ($R > 255) {
}
if ($R > 255) {
$R = 255;
}
if ($G < 0) {
$G = 0;
} if ($G > 255) {
}
if ($G > 255) {
$G = 255;
}
if ($B < 0) {
$B = 0;
} if ($B > 255) {
}
if ($B > 255) {
$B = 255;
}
if ($Alpha < 0) {
Expand All @@ -285,7 +288,7 @@ public function allocateColor($Picture, $R, $G, $B, $Alpha = 100)
}

$Alpha = $this->convertAlpha($Alpha);
return imagecolorallocatealpha($Picture, $R, $G, $B, $Alpha);
return imagecolorallocatealpha($Picture, (int) $R, (int) $G, (int) $B, (int) $Alpha);
}

/**
Expand Down Expand Up @@ -573,7 +576,12 @@ public function countDrawableSeries()
*/
public function fixBoxCoordinates($Xa, $Ya, $Xb, $Yb)
{
return [min($Xa, $Xb), min($Ya, $Yb), max($Xa, $Xb), max($Ya, $Yb)];
return [
(int) min($Xa, $Xb),
(int) min($Ya, $Yb),
(int) max($Xa, $Xb),
(int) max($Ya, $Yb)
];
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Chart/Spring.php
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ public function doPass()
if ($Force > 1) {
$this->Data[$Key]["Vectors"][] = [
"Type" => "R",
"Angle" => $Angle % 360,
"Angle" => ((int) $Angle) % 360,
"Force" => $Force
];
}
Expand Down Expand Up @@ -690,7 +690,7 @@ public function doPass()
if ($Force > 1) {
$this->Data[$Key]["Vectors"][] = [
"Type" => "A",
"Angle" => $Angle % 360,
"Angle" => ((int) $Angle) % 360,
"Force" => $Force
];
}
Expand Down
Loading

0 comments on commit 9b903cb

Please sign in to comment.