From dcf71d6d5bb0a9c9d49ef68ab812cedf1e7c1e7e Mon Sep 17 00:00:00 2001 From: smiley Date: Wed, 18 Mar 2026 19:15:48 +0100 Subject: [PATCH] :octocat: --- phpstan-baseline.neon | 106 ++++++++++++++++++++++--- phpstan.dist.neon | 2 +- src/Common/LuminanceSourceAbstract.php | 6 +- src/Output/QRMarkupSVG.php | 2 +- tests/QROptionsTest.php | 1 - 5 files changed, 98 insertions(+), 19 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 577eb68a9..5ffd83418 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -39,7 +39,13 @@ parameters: - rawMessage: 'Parameter #2 $dataSegments of class chillerlan\QRCode\Data\QRData constructor expects array, array given.' identifier: argument.type - count: 2 + count: 1 + path: benchmark/QRDataBenchmark.php + + - + rawMessage: 'Property chillerlan\QRCodeBenchmark\QRDataBenchmark::$dataMode (chillerlan\QRCode\Data\QRDataModeInterface) does not accept object.' + identifier: assign.propertyType + count: 1 path: benchmark/QRDataBenchmark.php - @@ -91,21 +97,11 @@ parameters: path: benchmark/parse-result.php - - rawMessage: ''' - Call to deprecated method getUri() of class chillerlan\Authenticator\Authenticator: - 5.3.0 The parameter `$omitSettings` will be removed in favor of `AuthenticatorOptions::$omitUriSettings` - in the next major version (6.x) - ''' - identifier: method.deprecated + rawMessage: Set hook for non-virtual property chillerlan\Settings\SettingsContainerAbstract@anonymous/examples/authenticator.php:22::$fpdfMeasureUnit does not always assign value to it. + identifier: propertySetHook.noAssign count: 1 path: examples/authenticator.php - - - rawMessage: 'Property chillerlan\QRCode\QROptions::$eccLevel (int) does not accept string.' - identifier: assign.propertyType - count: 1 - path: examples/custom_output.php - - rawMessage: 'Method QRGdRounded::__construct() has parameter $options with no value type specified in iterable type iterable.' identifier: missingType.iterableValue @@ -226,6 +222,12 @@ parameters: count: 1 path: src/Data/Byte.php + - + rawMessage: Cannot access property $level on chillerlan\QRCode\Common\EccLevel|null. + identifier: property.nonObject + count: 1 + path: src/Data/QRMatrix.php + - rawMessage: 'Parameter #1 $version of class chillerlan\QRCode\Data\ReedSolomonEncoder constructor expects chillerlan\QRCode\Common\Version, chillerlan\QRCode\Common\Version|null given.' identifier: argument.type @@ -238,6 +240,24 @@ parameters: count: 1 path: src/Data/QRMatrix.php + - + rawMessage: Access to an undefined property chillerlan\QRCode\Common\LuminanceSourceInterface::$height. + identifier: property.notFound + count: 1 + path: src/Decoder/Binarizer.php + + - + rawMessage: Access to an undefined property chillerlan\QRCode\Common\LuminanceSourceInterface::$luminances. + identifier: property.notFound + count: 1 + path: src/Decoder/Binarizer.php + + - + rawMessage: Access to an undefined property chillerlan\QRCode\Common\LuminanceSourceInterface::$width. + identifier: property.notFound + count: 1 + path: src/Decoder/Binarizer.php + - rawMessage: 'Parameter #1 $maskPattern of method chillerlan\QRCode\Data\QRMatrix::mask() expects chillerlan\QRCode\Common\MaskPattern, chillerlan\QRCode\Common\MaskPattern|null given.' identifier: argument.type @@ -262,6 +282,12 @@ parameters: count: 1 path: src/Decoder/BitMatrix.php + - + rawMessage: Cannot access property $versionNumber on chillerlan\QRCode\Common\Version|null. + identifier: property.nonObject + count: 1 + path: src/Decoder/Decoder.php + - rawMessage: 'Method chillerlan\QRCode\Decoder\Decoder::__construct() has parameter $options with no value type specified in iterable type iterable.' identifier: missingType.iterableValue @@ -334,6 +360,12 @@ parameters: count: 1 path: src/Output/QRInterventionImage.php + - + rawMessage: Cannot access property $currentPattern on chillerlan\QRCode\Common\MaskPattern|null. + identifier: property.nonObject + count: 1 + path: src/Output/QRMarkupXML.php + - rawMessage: 'Method chillerlan\QRCode\Output\QROutputAbstract::__construct() has parameter $options with no value type specified in iterable type iterable.' identifier: missingType.iterableValue @@ -346,6 +378,18 @@ parameters: count: 1 path: src/Output/QROutputAbstract.php + - + rawMessage: Cannot access property $currentPattern on chillerlan\QRCode\Common\MaskPattern|null. + identifier: property.nonObject + count: 1 + path: src/Output/QRStringJSON.php + + - + rawMessage: Cannot access property $versionNumber on chillerlan\QRCode\Common\Version|null. + identifier: property.nonObject + count: 1 + path: src/Output/QRStringJSON.php + - rawMessage: PHPDoc tag @var with type chillerlan\QRCode\Data\QRDataModeInterface is not subtype of native type 'chillerlan\\QRCode\\Data\\AlphaNum'|'chillerlan\\QRCode\\Data\\Byte'|'chillerlan\\QRCode\\Data\\Hanzi'|'chillerlan\\QRCode\\Data\\Kanji'|'chillerlan\\QRCode\\Data\\Number'. identifier: varTag.nativeType @@ -358,12 +402,24 @@ parameters: count: 1 path: src/QRCode.php + - + rawMessage: Set hook for non-virtual property chillerlan\QRCode\QROptions::$fpdfMeasureUnit does not always assign value to it. + identifier: propertySetHook.noAssign + count: 1 + path: src/QROptions.php + - rawMessage: 'Method chillerlan\QRCodeTest\Common\MaskPatternTest::maskPatternProvider() return type has no value type specified in iterable type array.' identifier: missingType.iterableValue count: 1 path: tests/Common/MaskPatternTest.php + - + rawMessage: Cannot access property $currentPattern on chillerlan\QRCode\Common\MaskPattern|null. + identifier: property.nonObject + count: 1 + path: tests/Data/DataInterfaceTestAbstract.php + - rawMessage: 'Method chillerlan\QRCodeTest\Data\DataInterfaceTestAbstract::maxLengthProvider() return type with generic class Generator does not specify its types: TKey, TValue, TSend, TReturn' identifier: missingType.generics @@ -406,18 +462,42 @@ parameters: count: 2 path: tests/Data/KanjiTest.php + - + rawMessage: Cannot access property $versionNumber on chillerlan\QRCode\Common\Version|null. + identifier: property.nonObject + count: 2 + path: tests/Data/QRDataTest.php + - rawMessage: 'Parameter #1 $blob of method chillerlan\QRCode\QRCode::readFromBlob() expects string, GdImage|string given.' identifier: argument.type count: 1 path: tests/Data/QRDataTest.php + - + rawMessage: Cannot access property $level on chillerlan\QRCode\Common\EccLevel|null. + identifier: property.nonObject + count: 1 + path: tests/Data/QRMatrixTest.php + + - + rawMessage: Cannot access property $versionNumber on chillerlan\QRCode\Common\Version|null. + identifier: property.nonObject + count: 4 + path: tests/Data/QRMatrixTest.php + - rawMessage: 'Method chillerlan\QRCodeTest\Data\QRMatrixTest::matrixProvider() return type with generic class Generator does not specify its types: TKey, TValue, TSend, TReturn' identifier: missingType.generics count: 1 path: tests/Data/QRMatrixTest.php + - + rawMessage: Cannot access property $versionNumber on chillerlan\QRCode\Common\Version|null. + identifier: property.nonObject + count: 1 + path: tests/QRCodeReaderTestAbstract.php + - rawMessage: 'Method chillerlan\QRCodeTest\QRCodeReaderTestAbstract::dataTestProvider() return type with generic class Generator does not specify its types: TKey, TValue, TSend, TReturn' identifier: missingType.generics diff --git a/phpstan.dist.neon b/phpstan.dist.neon index 445b277f5..c9d322fbf 100644 --- a/phpstan.dist.neon +++ b/phpstan.dist.neon @@ -14,7 +14,7 @@ parameters: ignoreErrors: # the only place where these instances *may* be null is in the Decoder\BitMatrix class - message: "#^Cannot call method [\\w]+\\(\\) on chillerlan\\\\QRCode\\\\Common\\\\EccLevel\\|null\\.$#" - - message: "#^Cannot call method [\\w]+\\(\\) on chillerlan\\\\QRCode\\\\Common\\\\MaskPattern\\|null\\.$#" +# - message: "#^Cannot call method [\\w]+\\(\\) on chillerlan\\\\QRCode\\\\Common\\\\MaskPattern\\|null\\.$#" - message: "#^Cannot call method [\\w]+\\(\\) on chillerlan\\\\QRCode\\\\Common\\\\Version\\|null\\.$#" diff --git a/src/Common/LuminanceSourceAbstract.php b/src/Common/LuminanceSourceAbstract.php index 26b8fae06..271563c5a 100644 --- a/src/Common/LuminanceSourceAbstract.php +++ b/src/Common/LuminanceSourceAbstract.php @@ -32,9 +32,9 @@ abstract class LuminanceSourceAbstract implements LuminanceSourceInterface{ * Fetches luminance data for the underlying bitmap. Values should be fetched using: * `int luminance = array[y * width + x] & 0xff` * - * @return int[] A row-major 2D array of luminance values. Do not use result $length as it may be - * larger than $width * $height bytes on some platforms. Do not modify the contents - * of the result. + * A row-major 2D array of luminance values. Do not use result $length as it may be + * larger than $width * $height bytes on some platforms. Do not modify the contents + * of the result. * * @var int[] */ diff --git a/src/Output/QRMarkupSVG.php b/src/Output/QRMarkupSVG.php index 0dc586f16..d119b538f 100644 --- a/src/Output/QRMarkupSVG.php +++ b/src/Output/QRMarkupSVG.php @@ -121,7 +121,7 @@ class QRMarkupSVG extends QRMarkup{ */ protected function paths():string{ $this->r = $this->options->circleRadius; - $this->d = $this->r * 2; + $this->d = ($this->r * 2); $paths = $this->collectModules(); $svg = []; diff --git a/tests/QROptionsTest.php b/tests/QROptionsTest.php index 8e8879261..296c97898 100644 --- a/tests/QROptionsTest.php +++ b/tests/QROptionsTest.php @@ -47,7 +47,6 @@ final class QROptionsTest extends TestCase{ $o = new QROptions(['eccLevel' => EccLevel::H]); $this::assertSame(EccLevel::H, $o->eccLevel); - /** @phpstan-ignore-next-line */ $o->eccLevel = 'q'; $this::assertSame(EccLevel::Q, $o->eccLevel);