diff --git a/examples/svgWithLogoAndCustomShapes.php b/examples/svgWithLogoAndCustomShapes.php index ae85a7514..2f063c190 100644 --- a/examples/svgWithLogoAndCustomShapes.php +++ b/examples/svgWithLogoAndCustomShapes.php @@ -79,7 +79,7 @@ class QRSvgWithLogoAndCustomShapes extends QRMarkupSVG{ */ protected function getFinderPatterns():string{ - $qz = $this->options->addQuietzone ? $this->options->quietzoneSize : 0; + $qz = ($this->options->addQuietzone) ? $this->options->quietzoneSize : 0; // the positions for the finder patterns (top left corner) // $this->moduleCount includes 2* the quiet zone size already, so we need to take this into account $pos = [ diff --git a/src/Common/GF256.php b/src/Common/GF256.php index cf61f1195..d8ba0950b 100644 --- a/src/Common/GF256.php +++ b/src/Common/GF256.php @@ -136,7 +136,7 @@ final class GF256{ throw new QRCodeException('$a === 0'); } - return self::expTable[256 - self::logTable[$a] - 1]; + return self::expTable[(256 - self::logTable[$a] - 1)]; } /** @@ -148,7 +148,7 @@ final class GF256{ return 0; } - return self::expTable[(self::logTable[$a] + self::logTable[$b]) % 255]; + return self::expTable[((self::logTable[$a] + self::logTable[$b]) % 255)]; } } diff --git a/src/Data/AlphaNum.php b/src/Data/AlphaNum.php index a18324854..9840d9b7e 100644 --- a/src/Data/AlphaNum.php +++ b/src/Data/AlphaNum.php @@ -78,8 +78,8 @@ final class AlphaNum extends QRDataModeAbstract{ ; // encode 2 characters in 11 bits - for($i = 0; $i + 1 < $len; $i += 2){ - $bitBuffer->put(self::CHAR_TO_ORD[$this->data[$i]] * 45 + self::CHAR_TO_ORD[$this->data[$i + 1]], 11); + for($i = 0; ($i + 1) < $len; $i += 2){ + $bitBuffer->put((self::CHAR_TO_ORD[$this->data[$i]] * 45 + self::CHAR_TO_ORD[$this->data[($i + 1)]]), 11); } // encode a remaining character in 6 bits diff --git a/src/Detector/Detector.php b/src/Detector/Detector.php index 8eda29198..d2f459d5f 100644 --- a/src/Detector/Detector.php +++ b/src/Detector/Detector.php @@ -329,14 +329,22 @@ final class Detector{ } return (new PerspectiveTransform)->quadrilateralToQuadrilateral( - 3.5, 3.5, - $dimMinusThree, 3.5, - $sourceBottomRightX, $sourceBottomRightY, - 3.5, $dimMinusThree, - $nw->getX(), $nw->getY(), - $ne->getX(), $ne->getY(), - $bottomRightX, $bottomRightY, - $sw->getX(), $sw->getY() + 3.5, + 3.5, + $dimMinusThree, + 3.5, + $sourceBottomRightX, + $sourceBottomRightY, + 3.5, + $dimMinusThree, + $nw->getX(), + $nw->getY(), + $ne->getX(), + $ne->getY(), + $bottomRightX, + $bottomRightY, + $sw->getX(), + $sw->getY() ); } diff --git a/src/Detector/GridSampler.php b/src/Detector/GridSampler.php index 9edef21fc..6352d09b7 100644 --- a/src/Detector/GridSampler.php +++ b/src/Detector/GridSampler.php @@ -134,15 +134,15 @@ final class GridSampler{ } $bits = new BitMatrix($dimension); - $points = array_fill(0, 2 * $dimension, 0.0); + $points = array_fill(0, (2 * $dimension), 0.0); for($y = 0; $y < $dimension; $y++){ $max = count($points); - $iValue = $y + 0.5; + $iValue = ($y + 0.5); for($x = 0; $x < $max; $x += 2){ - $points[$x] = ($x / 2) + 0.5; - $points[$x + 1] = $iValue; + $points[$x] = (($x / 2) + 0.5); + $points[($x + 1)] = $iValue; } $transform->transformPoints($points); @@ -153,7 +153,7 @@ final class GridSampler{ try{ for($x = 0; $x < $max; $x += 2){ // Black(-ish) pixel - $bits->set($x / 2, $y, $matrix->check((int)$points[$x], (int)$points[$x + 1]), QRMatrix::M_DATA); + $bits->set(($x / 2), $y, $matrix->check((int)$points[$x], (int)$points[($x + 1)]), QRMatrix::M_DATA); } } // @codeCoverageIgnoreStart