From 2b7c9b7020f15384fa8fd47b062057d2553287c0 Mon Sep 17 00:00:00 2001 From: smiley Date: Thu, 9 Oct 2025 21:31:41 +0200 Subject: [PATCH] :octocat: remove remaining instances of empty() --- src/Common/GenericGFPoly.php | 2 +- src/Decoder/DecoderResult.php | 2 +- src/Detector/Detector.php | 2 +- src/Output/QREps.php | 2 +- src/Output/QRMarkupSVG.php | 4 ++-- src/Output/QRStringJSON.php | 2 +- src/QRCode.php | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Common/GenericGFPoly.php b/src/Common/GenericGFPoly.php index 5f8160958..5c0b63b87 100644 --- a/src/Common/GenericGFPoly.php +++ b/src/Common/GenericGFPoly.php @@ -39,7 +39,7 @@ final class GenericGFPoly{ public function __construct(array $coefficients, int|null $degree = null){ $degree ??= 0; - if(empty($coefficients)){ + if($coefficients === []){ throw new QRCodeException('arg $coefficients is empty'); } diff --git a/src/Decoder/DecoderResult.php b/src/Decoder/DecoderResult.php index a683b5029..d7117d435 100644 --- a/src/Decoder/DecoderResult.php +++ b/src/Decoder/DecoderResult.php @@ -49,7 +49,7 @@ final class DecoderResult{ */ public function __construct(iterable|null $properties = null){ - if(!empty($properties)){ + if($properties !== null){ foreach($properties as $property => $value){ diff --git a/src/Detector/Detector.php b/src/Detector/Detector.php index e0aa5d0ab..e66fe398c 100644 --- a/src/Detector/Detector.php +++ b/src/Detector/Detector.php @@ -57,7 +57,7 @@ final class Detector{ $alignmentPattern = null; // Anything above version 1 has an alignment pattern - if(!empty($provisionalVersion->getAlignmentPattern())){ + if($provisionalVersion->getAlignmentPattern() !== []){ // Guess where a "bottom right" finder pattern would have been $bottomRightX = ($topRight->getX() - $topLeft->getX() + $bottomLeft->getX()); $bottomRightY = ($topRight->getY() - $topLeft->getY() + $bottomLeft->getY()); diff --git a/src/Output/QREps.php b/src/Output/QREps.php index 4ad93f4cd..e5aed9785 100644 --- a/src/Output/QREps.php +++ b/src/Output/QREps.php @@ -148,7 +148,7 @@ class QREps extends QROutputAbstract{ foreach($paths as $M_TYPE => $path){ - if(empty($path)){ + if($path === []){ continue; } diff --git a/src/Output/QRMarkupSVG.php b/src/Output/QRMarkupSVG.php index 9d14cff7a..d1bbfeff8 100644 --- a/src/Output/QRMarkupSVG.php +++ b/src/Output/QRMarkupSVG.php @@ -66,7 +66,7 @@ class QRMarkupSVG extends QRMarkup{ protected function createMarkup(bool $saveToFile):string{ $svg = $this->header(); - if(!empty($this->options->svgDefs)){ + if($this->options->svgDefs !== ''){ $svg .= sprintf('%1$s%2$s%2$s', $this->options->svgDefs, $this->eol); } @@ -131,7 +131,7 @@ class QRMarkupSVG extends QRMarkup{ $path = implode($this->eol, $chonks); - if(empty($path)){ + if($path === ''){ continue; } diff --git a/src/Output/QRStringJSON.php b/src/Output/QRStringJSON.php index 35d24ad60..a0274ef03 100644 --- a/src/Output/QRStringJSON.php +++ b/src/Output/QRStringJSON.php @@ -99,7 +99,7 @@ class QRStringJSON extends QROutputAbstract{ } } - if(!empty($matrixRow['modules'])){ + if($matrixRow['modules'] !== []){ return $matrixRow; } diff --git a/src/QRCode.php b/src/QRCode.php index 4a0c1b95b..5e469fe72 100755 --- a/src/QRCode.php +++ b/src/QRCode.php @@ -152,7 +152,7 @@ class QRCode{ protected function initOutputInterface(QRMatrix $matrix):QROutputInterface{ $outputInterface = $this->options->outputInterface; - if(empty($outputInterface) || !class_exists($outputInterface)){ + if(!class_exists($outputInterface)){ throw new QRCodeOutputException('invalid output class'); }