smiley 3 年 前
コミット
8c75d8b2dc

+ 4 - 3
src/Decoder/BitMatrix.php

@@ -223,9 +223,9 @@ final class BitMatrix{
 
 	/**
 	 * Prepare the parser for a mirrored operation.
-	 * This flag has effect only on the #readFormatInformation() and the
-	 * #readVersion(). Before proceeding with #readCodewords() the
-	 * #mirror() method should be called.
+	 * This flag has effect only on the readFormatInformation() and the
+	 * readVersion() methods. Before proceeding with readCodewords() the
+	 * mirror() method should be called.
 	 *
 	 * @param bool $mirror Whether to read version and format information mirrored.
 	 */
@@ -426,6 +426,7 @@ final class BitMatrix{
 	 * @return \chillerlan\QRCode\Common\Version                 encapsulating the QR Code's version
 	 * @throws \chillerlan\QRCode\Decoder\QRCodeDecoderException if both version information locations cannot be parsed as
 	 *                                                           the valid encoding of version information
+	 * @noinspection DuplicatedCode
 	 */
 	private function readVersion():Version{
 

+ 1 - 1
src/Decoder/GDLuminanceSource.php

@@ -44,7 +44,7 @@ class GDLuminanceSource extends LuminanceSourceAbstract{
 			(PHP_MAJOR_VERSION >= 8 && !$gdImage instanceof \GdImage)
 			|| (PHP_MAJOR_VERSION < 8 && (!is_resource($gdImage) || get_resource_type($gdImage) !== 'gd'))
 		){
-			throw new QRCodeDecoderException('Invalid GD image source.');
+			throw new QRCodeDecoderException('Invalid GD image source.'); // @codeCoverageIgnore
 		}
 
 		parent::__construct(imagesx($gdImage), imagesy($gdImage), $options);

+ 3 - 1
src/Detector/Detector.php

@@ -130,6 +130,8 @@ final class Detector{
 	 * See #sizeOfBlackWhiteBlackRun(int, int, int, int); computes the total width of
 	 * a finder pattern by looking for a black-white-black run from the center in the direction
 	 * of another po$(another finder pattern center), and in the opposite direction too.
+	 *
+	 * @noinspection DuplicatedCode
 	 */
 	private function sizeOfBlackWhiteBlackRunBothWays(float $fromX, float $fromY, float $toX, float $toY):float{
 		$result    = $this->sizeOfBlackWhiteBlackRun((int)$fromX, (int)$fromY, (int)$toX, (int)$toY);
@@ -176,7 +178,7 @@ final class Detector{
 	 */
 	private function sizeOfBlackWhiteBlackRun(int $fromX, int $fromY, int $toX, int $toY):float{
 		// Mild variant of Bresenham's algorithm;
-		// see http://en.wikipedia.org/wiki/Bresenham's_line_algorithm
+		// @see https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm
 		$steep = abs($toY - $fromY) > abs($toX - $fromX);
 
 		if($steep){

+ 2 - 0
src/Detector/GridSampler.php

@@ -152,6 +152,7 @@ final class GridSampler{
 					}
 				}
 			}
+			// @codeCoverageIgnoreStart
 			catch(Throwable $aioobe){//ArrayIndexOutOfBoundsException
 				// This feels wrong, but, sometimes if the finder patterns are misidentified, the resulting
 				// transform gets "twisted" such that it maps a straight line of points to a set of points
@@ -162,6 +163,7 @@ final class GridSampler{
 				// catching and wrapping ArrayIndexOutOfBoundsException.
 				throw new QRCodeDetectorException('ArrayIndexOutOfBoundsException');
 			}
+			// @codeCoverageIgnoreEnd
 
 		}
 

+ 2 - 0
src/Detector/PerspectiveTransform.php

@@ -149,6 +149,7 @@ final class PerspectiveTransform{
 	public function transformPoints(array &$xValues, array &$yValues = null):void{
 		$max = count($xValues);
 
+		// @codeCoverageIgnoreStart (unused)
 		if($yValues !== null){
 
 			for($i = 0; $i < $max; $i++){
@@ -161,6 +162,7 @@ final class PerspectiveTransform{
 
 			return;
 		}
+		// @codeCoverageIgnoreEnd
 
 		for($i = 0; $i < $max; $i += 2){
 			$x               = $xValues[$i];

+ 0 - 2
src/Output/QRMarkup.php

@@ -20,8 +20,6 @@ use function implode, is_string, ksort, sprintf, strip_tags, trim;
  */
 class QRMarkup extends QROutputAbstract{
 
-	protected string $defaultMode = QRCode::OUTPUT_MARKUP_SVG;
-
 	/**
 	 * @inheritDoc
 	 */

+ 0 - 2
src/Output/QRString.php

@@ -22,8 +22,6 @@ use function implode, is_string, json_encode;
  */
 class QRString extends QROutputAbstract{
 
-	protected string $defaultMode = QRCode::OUTPUT_STRING_TEXT;
-
 	/**
 	 * @inheritDoc
 	 */

+ 1 - 1
tests/Data/ByteTest.php

@@ -35,7 +35,7 @@ final class ByteTest extends DatainterfaceTestAbstract{
 	 * @inheritDoc
 	 */
 	public function testInvalidDataException():void{
-		$this::markTestSkipped('N/A');
+		$this::markTestSkipped('N/A (binary mode)');
 	}
 
 }

+ 2 - 2
tests/Output/QRStringJSONTest.php

@@ -24,7 +24,7 @@ final class QRStringJSONTest extends QRStringTestAbstract{
 	 * @inheritDoc
 	 */
 	protected function setUp():void{
-		// just in case someone's running this on some weird disto that's been compiled without ext-json
+		// just in case someone's running this on some weird distro that's been compiled without ext-json
 		if(!extension_loaded('json')){
 			$this::markTestSkipped('ext-json not loaded');
 		}
@@ -34,7 +34,7 @@ final class QRStringJSONTest extends QRStringTestAbstract{
 
 
 	public function testSetModuleValues():void{
-		$this::markTestSkipped('N/A');
+		$this::markTestSkipped('N/A (JSON test)');
 	}
 
 }