mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-28 11:07:25 +00:00
:octocat: reintroducing phan because phpstan keeps making trouble
This commit is contained in:
+1
-1
@@ -59,7 +59,7 @@ final class Mode{
|
||||
/**
|
||||
* Map of data mode => interface (detection order)
|
||||
*
|
||||
* @var array<int, (\chillerlan\QRCode\Data\QRDataModeInterface|string)>
|
||||
* @var array<int, string>
|
||||
*/
|
||||
public const INTERFACES = [
|
||||
self::NUMBER => Number::class,
|
||||
|
||||
@@ -100,6 +100,7 @@ final class AlphaNum extends QRDataModeAbstract{
|
||||
* @throws \chillerlan\QRCode\Data\QRCodeDataException
|
||||
*/
|
||||
private function ord(string $chr):int{
|
||||
/** @phan-suppress-next-line PhanParamSuspiciousOrder */
|
||||
$ord = strpos(self::CHAR_MAP, $chr);
|
||||
|
||||
if($ord === false){
|
||||
|
||||
@@ -186,6 +186,7 @@ class QRMatrix{
|
||||
* Returns a boolean representation of the data matrix
|
||||
*
|
||||
* @return bool[][]
|
||||
* @phan-suppress PhanTypeMismatchReturn
|
||||
*/
|
||||
public function getBooleanMatrix():array{
|
||||
$matrix = $this->matrix;
|
||||
@@ -594,6 +595,7 @@ class QRMatrix{
|
||||
* Rotates the matrix by 90 degrees clock wise
|
||||
*/
|
||||
public function rotate90():static{
|
||||
/** @phan-suppress-next-line PhanParamTooFewInternalUnpack */
|
||||
$this->matrix = array_map((fn(int ...$a):array => array_reverse($a)), ...$this->matrix);
|
||||
|
||||
return $this;
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
* @author smiley <smiley@chillerlan.net>
|
||||
* @copyright 2024 smiley
|
||||
* @license MIT
|
||||
*
|
||||
* @phan-file-suppress PhanTypeMismatchDeclaredParamNullable
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ class QRFpdf extends QROutputAbstract{
|
||||
|
||||
final public const MIME_TYPE = 'application/pdf';
|
||||
|
||||
/** @var int[] */
|
||||
/** @var int[]|null */
|
||||
protected array|null $prevColor = null;
|
||||
protected FPDF $fpdf;
|
||||
|
||||
@@ -70,7 +70,7 @@ class QRFpdf extends QROutputAbstract{
|
||||
if($this::moduleValueIsValid($this->options->bgColor)){
|
||||
$bgColor = $this->prepareModuleValue($this->options->bgColor);
|
||||
[$width, $height] = $this->getOutputDimensions();
|
||||
|
||||
/** @phan-suppress-next-line PhanParamTooFewUnpack */
|
||||
$this->fpdf->SetFillColor(...$bgColor);
|
||||
$this->fpdf->Rect(0, 0, $width, $height, 'F');
|
||||
}
|
||||
@@ -110,6 +110,7 @@ class QRFpdf extends QROutputAbstract{
|
||||
$color = $this->getModuleValue($M_TYPE);
|
||||
|
||||
if($color !== null && $color !== $this->prevColor){
|
||||
/** @phan-suppress-next-line PhanParamTooFewUnpack */
|
||||
$this->fpdf->SetFillColor(...$color);
|
||||
$this->prevColor = $color;
|
||||
}
|
||||
|
||||
@@ -121,6 +121,7 @@ abstract class QRGdImage extends QROutputAbstract{
|
||||
$values[] = max(0, min(255, intval($val)));
|
||||
}
|
||||
|
||||
/** @phan-suppress-next-line PhanParamTooFewInternalUnpack */
|
||||
$color = imagecolorallocate($this->image, ...$values);
|
||||
|
||||
if($color === false){
|
||||
|
||||
@@ -13,7 +13,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace chillerlan\QRCode\Output;
|
||||
|
||||
use function imageavif, max, min;
|
||||
use function imageavif;
|
||||
|
||||
/**
|
||||
* GDImage avif output
|
||||
|
||||
@@ -13,7 +13,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace chillerlan\QRCode\Output;
|
||||
|
||||
use function imagejpeg, max, min;
|
||||
use function imagejpeg;
|
||||
|
||||
/**
|
||||
* GdImage jpeg output
|
||||
|
||||
@@ -13,7 +13,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace chillerlan\QRCode\Output;
|
||||
|
||||
use function imagewebp, max, min;
|
||||
use function imagewebp;
|
||||
|
||||
/**
|
||||
* GdImage webp output
|
||||
|
||||
@@ -23,7 +23,7 @@ class QRStringText extends QROutputAbstract{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*
|
||||
* @param string $value
|
||||
* @param string|mixed $value
|
||||
*/
|
||||
public static function moduleValueIsValid(mixed $value):bool{
|
||||
return is_string($value);
|
||||
@@ -32,7 +32,7 @@ class QRStringText extends QROutputAbstract{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*
|
||||
* @param string $value
|
||||
* @param string|mixed $value
|
||||
*/
|
||||
protected function prepareModuleValue(mixed $value):string{
|
||||
return $value;
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
* @author smiley <smiley@chillerlan.net>
|
||||
* @copyright 2024 smiley
|
||||
* @license MIT
|
||||
*
|
||||
* @phan-file-suppress PhanTypeMismatchDeclaredParamNullable
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user