Jelajahi Sumber

:octocat: remove remaining instances of empty()

smiley 2 bulan lalu
induk
melakukan
2b7c9b7020

+ 1 - 1
src/Common/GenericGFPoly.php

@@ -39,7 +39,7 @@ final class GenericGFPoly{
 	public function __construct(array $coefficients, int|null $degree = null){
 	public function __construct(array $coefficients, int|null $degree = null){
 		$degree ??= 0;
 		$degree ??= 0;
 
 
-		if(empty($coefficients)){
+		if($coefficients === []){
 			throw new QRCodeException('arg $coefficients is empty');
 			throw new QRCodeException('arg $coefficients is empty');
 		}
 		}
 
 

+ 1 - 1
src/Decoder/DecoderResult.php

@@ -49,7 +49,7 @@ final class DecoderResult{
 	 */
 	 */
 	public function __construct(iterable|null $properties = null){
 	public function __construct(iterable|null $properties = null){
 
 
-		if(!empty($properties)){
+		if($properties !== null){
 
 
 			foreach($properties as $property => $value){
 			foreach($properties as $property => $value){
 
 

+ 1 - 1
src/Detector/Detector.php

@@ -57,7 +57,7 @@ final class Detector{
 		$alignmentPattern   = null;
 		$alignmentPattern   = null;
 
 
 		// Anything above version 1 has an alignment pattern
 		// 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
 			// Guess where a "bottom right" finder pattern would have been
 			$bottomRightX = ($topRight->getX() - $topLeft->getX() + $bottomLeft->getX());
 			$bottomRightX = ($topRight->getX() - $topLeft->getX() + $bottomLeft->getX());
 			$bottomRightY = ($topRight->getY() - $topLeft->getY() + $bottomLeft->getY());
 			$bottomRightY = ($topRight->getY() - $topLeft->getY() + $bottomLeft->getY());

+ 1 - 1
src/Output/QREps.php

@@ -148,7 +148,7 @@ class QREps extends QROutputAbstract{
 
 
 		foreach($paths as $M_TYPE => $path){
 		foreach($paths as $M_TYPE => $path){
 
 
-			if(empty($path)){
+			if($path === []){
 				continue;
 				continue;
 			}
 			}
 
 

+ 2 - 2
src/Output/QRMarkupSVG.php

@@ -66,7 +66,7 @@ class QRMarkupSVG extends QRMarkup{
 	protected function createMarkup(bool $saveToFile):string{
 	protected function createMarkup(bool $saveToFile):string{
 		$svg = $this->header();
 		$svg = $this->header();
 
 
-		if(!empty($this->options->svgDefs)){
+		if($this->options->svgDefs !== ''){
 			$svg .= sprintf('<defs>%1$s%2$s</defs>%2$s', $this->options->svgDefs, $this->eol);
 			$svg .= sprintf('<defs>%1$s%2$s</defs>%2$s', $this->options->svgDefs, $this->eol);
 		}
 		}
 
 
@@ -131,7 +131,7 @@ class QRMarkupSVG extends QRMarkup{
 
 
 			$path = implode($this->eol, $chonks);
 			$path = implode($this->eol, $chonks);
 
 
-			if(empty($path)){
+			if($path === ''){
 				continue;
 				continue;
 			}
 			}
 
 

+ 1 - 1
src/Output/QRStringJSON.php

@@ -99,7 +99,7 @@ class QRStringJSON extends QROutputAbstract{
 			}
 			}
 		}
 		}
 
 
-		if(!empty($matrixRow['modules'])){
+		if($matrixRow['modules'] !== []){
 			return $matrixRow;
 			return $matrixRow;
 		}
 		}
 
 

+ 1 - 1
src/QRCode.php

@@ -152,7 +152,7 @@ class QRCode{
 	protected function initOutputInterface(QRMatrix $matrix):QROutputInterface{
 	protected function initOutputInterface(QRMatrix $matrix):QROutputInterface{
 		$outputInterface = $this->options->outputInterface;
 		$outputInterface = $this->options->outputInterface;
 
 
-		if(empty($outputInterface) || !class_exists($outputInterface)){
+		if(!class_exists($outputInterface)){
 			throw new QRCodeOutputException('invalid output class');
 			throw new QRCodeOutputException('invalid output class');
 		}
 		}