From e9d39681f617705492b609fc3fc58465ef88e8fd Mon Sep 17 00:00:00 2001 From: Casper Bakker Date: Wed, 18 Sep 2024 10:09:33 +0200 Subject: [PATCH] Fix phpstan errors --- src/Types/TypeCode128.php | 4 ++-- src/Types/TypeUpcExtension2.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Types/TypeCode128.php b/src/Types/TypeCode128.php index 38fc618..c8b8253 100644 --- a/src/Types/TypeCode128.php +++ b/src/Types/TypeCode128.php @@ -214,7 +214,7 @@ public function getBarcodeData(string $code): Barcode // get numeric sequences (if any) $numseq = []; preg_match_all('/([0-9]{4,})/', $code, $numseq, PREG_OFFSET_CAPTURE); - if (isset($numseq[1]) AND ! empty($numseq[1])) { + if (! empty($numseq[1])) { $end_offset = 0; foreach ($numseq[1] as $val) { $offset = $val[1]; @@ -390,7 +390,7 @@ protected function get128ABsequence($code) // get A sequences (if any) $numseq = []; preg_match_all('/([\x00-\x1f])/', $code, $numseq, PREG_OFFSET_CAPTURE); - if (isset($numseq[1]) AND ! empty($numseq[1])) { + if (empty($numseq[1])) { $end_offset = 0; foreach ($numseq[1] as $val) { $offset = $val[1]; diff --git a/src/Types/TypeUpcExtension2.php b/src/Types/TypeUpcExtension2.php index cebbfa8..f8416f0 100644 --- a/src/Types/TypeUpcExtension2.php +++ b/src/Types/TypeUpcExtension2.php @@ -25,7 +25,7 @@ public function getBarcodeData(string $code): Barcode // Calculate check digit if ($len == 2) { - $r = $code % 4; + $r = (int)$code % 4; } elseif ($len == 5) { $r = (3 * intval($code[0] . $code[2] . $code[4])) + (9 * intval($code[1] . $code[3])); $r %= 10;