:octocat: reintroducing phan because phpstan keeps making trouble

This commit is contained in:
smiley
2025-07-19 23:29:41 +02:00
parent 5477e121d3
commit bf34b46c57
21 changed files with 6853 additions and 13 deletions
+1 -1
View File
@@ -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,
+1
View File
@@ -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){
+2
View File
@@ -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;
+2
View File
@@ -6,6 +6,8 @@
* @author smiley <smiley@chillerlan.net>
* @copyright 2024 smiley
* @license MIT
*
* @phan-file-suppress PhanTypeMismatchDeclaredParamNullable
*/
declare(strict_types=1);
+3 -2
View File
@@ -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;
}
+1
View File
@@ -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){
+1 -1
View File
@@ -13,7 +13,7 @@ declare(strict_types=1);
namespace chillerlan\QRCode\Output;
use function imageavif, max, min;
use function imageavif;
/**
* GDImage avif output
+1 -1
View File
@@ -13,7 +13,7 @@ declare(strict_types=1);
namespace chillerlan\QRCode\Output;
use function imagejpeg, max, min;
use function imagejpeg;
/**
* GdImage jpeg output
+1 -1
View File
@@ -13,7 +13,7 @@ declare(strict_types=1);
namespace chillerlan\QRCode\Output;
use function imagewebp, max, min;
use function imagewebp;
/**
* GdImage webp output
+2 -2
View File
@@ -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;
+2
View File
@@ -6,6 +6,8 @@
* @author smiley <smiley@chillerlan.net>
* @copyright 2024 smiley
* @license MIT
*
* @phan-file-suppress PhanTypeMismatchDeclaredParamNullable
*/
declare(strict_types=1);