mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-28 02:57:57 +00:00
🚒 phan happy
This commit is contained in:
@@ -47,7 +47,7 @@ final class BitMatrixParser{
|
||||
* {@link #readVersion()}. Before proceeding with {@link #readCodewords()} the
|
||||
* {@link #mirror()} method should be called.
|
||||
*
|
||||
* @param bool mirror Whether to read version and format information mirrored.
|
||||
* @param bool $mirror Whether to read version and format information mirrored.
|
||||
*/
|
||||
public function setMirror(bool $mirror):void{
|
||||
$this->parsedVersion = null;
|
||||
@@ -203,8 +203,8 @@ final class BitMatrixParser{
|
||||
* @param int $maskedFormatInfo2 second copy of same info; both are checked at the same time
|
||||
* to establish best match
|
||||
*
|
||||
* @return \chillerlan\QRCode\Common\FormatInformation information about the format it specifies, or {@code null}
|
||||
* if doesn't seem to match any known pattern
|
||||
* @return \chillerlan\QRCode\Common\FormatInformation|null information about the format it specifies, or null
|
||||
* if doesn't seem to match any known pattern
|
||||
*/
|
||||
private function doDecodeFormatInformation(int $maskedFormatInfo1, int $maskedFormatInfo2):?FormatInformation{
|
||||
// Find the int in FORMAT_INFO_DECODE_LOOKUP with fewest bits differing
|
||||
@@ -298,6 +298,11 @@ final class BitMatrixParser{
|
||||
throw new RuntimeException('failed to read version');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $versionBits
|
||||
*
|
||||
* @return \chillerlan\QRCode\Common\Version|null
|
||||
*/
|
||||
private function decodeVersionInformation(int $versionBits):?Version{
|
||||
$bestDifference = PHP_INT_MAX;
|
||||
$bestVersion = 0;
|
||||
@@ -313,6 +318,7 @@ final class BitMatrixParser{
|
||||
|
||||
// Otherwise see if this is the closest to a real version info bit string
|
||||
// we have seen so far
|
||||
/** @phan-suppress-next-line PhanTypeMismatchArgumentNullable ($targetVersionPattern is never null here) */
|
||||
$bitsDifference = numBitsDiffering($versionBits, $targetVersionPattern);
|
||||
|
||||
if($bitsDifference < $bestDifference){
|
||||
|
||||
@@ -153,6 +153,7 @@ final class Decoder{
|
||||
|
||||
// All blocks have the same amount of data, except that the last n
|
||||
// (where n may be 0) have 1 more byte. Figure out where these start.
|
||||
/** @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset */
|
||||
$shorterBlocksTotalCodewords = count($result[0][1]);
|
||||
$longerBlocksStartAt = count($result) - 1;
|
||||
|
||||
@@ -185,6 +186,7 @@ final class Decoder{
|
||||
}
|
||||
|
||||
// Now add in error correction blocks
|
||||
/** @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset */
|
||||
$max = count($result[0][1]);
|
||||
|
||||
for($i = $shorterBlocksNumDataCodewords; $i < $max; $i++){
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* @copyright 2021 Smiley
|
||||
* @license Apache-2.0
|
||||
*
|
||||
* @noinspection PhpComposerExtensionStubsInspection
|
||||
* @noinspection PhpComposerExtensionStubsInspection
|
||||
*/
|
||||
|
||||
namespace chillerlan\QRCode\Decoder;
|
||||
@@ -39,11 +39,9 @@ final class GDLuminanceSource extends LuminanceSource{
|
||||
*/
|
||||
public function __construct($gdImage){
|
||||
|
||||
/**
|
||||
* @noinspection PhpElementIsNotAvailableInCurrentPhpVersionInspection
|
||||
* @phan-suppress PhanUndeclaredClassInstanceof
|
||||
*/
|
||||
/** @noinspection PhpElementIsNotAvailableInCurrentPhpVersionInspection, PhpFullyQualifiedNameUsageInspection */
|
||||
if(
|
||||
/** @phan-suppress-next-line PhanUndeclaredClassInstanceof */
|
||||
(PHP_MAJOR_VERSION >= 8 && !$gdImage instanceof \GdImage)
|
||||
|| (PHP_MAJOR_VERSION < 8 && (!is_resource($gdImage) || get_resource_type($gdImage) !== 'gd'))
|
||||
){
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
namespace chillerlan\QRCode\Decoder;
|
||||
|
||||
use Imagick, InvalidArgumentException;
|
||||
use Imagick;
|
||||
use function count;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user