Skip to content

Commit 3d6b340

Browse files
committed
Phpstan fixed to level 2
1 parent 326792a commit 3d6b340

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

.github/workflows/phpstan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ jobs:
2222
run: composer install --prefer-dist --no-progress --no-interaction
2323

2424
- name: Run analysis
25-
run: vendor/bin/phpstan analyse src --level 1
25+
run: vendor/bin/phpstan analyse src --level 2

src/Types/TypeIntelligentMailBarcode.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -378,11 +378,11 @@ public function getBarcodeData(string $code): Barcode
378378
// convert codewords to characters
379379
$characters = [];
380380
$bitmask = 512;
381-
foreach ($codewords as $k => $val) {
381+
foreach ($codewords as $val) {
382382
if ($val <= 1286) {
383-
$chrcode = $table5of13[$val];
383+
$chrcode = (int)$table5of13[$val];
384384
} else {
385-
$chrcode = $table2of13[($val - 1287)];
385+
$chrcode = (int)$table2of13[($val - 1287)];
386386
}
387387
if (($fcs & $bitmask) > 0) {
388388
// bitwise invert
@@ -517,7 +517,7 @@ protected function hex_to_dec($hex)
517517
* @return array requested table
518518
* @protected
519519
*/
520-
protected function imb_tables($n, $size)
520+
protected function imb_tables(int $n, int $size): array
521521
{
522522
$table = [];
523523
$lli = 0; // LUT lower index

src/Types/TypeUpcExtension2.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,20 @@ public function getBarcodeData(string $code): Barcode
2020
{
2121
$len = $this->length;
2222

23-
//Padding
23+
// Padding
2424
$code = str_pad($code, $len, '0', STR_PAD_LEFT);
2525

26-
// calculate check digit
26+
// Calculate check digit
2727
if ($len == 2) {
2828
$r = $code % 4;
2929
} elseif ($len == 5) {
30-
$r = (3 * ($code[0] + $code[2] + $code[4])) + (9 * ($code[1] + $code[3]));
30+
$r = (3 * intval($code[0] . $code[2] . $code[4])) + (9 * intval($code[1] . $code[3]));
3131
$r %= 10;
3232
} else {
3333
throw new InvalidCheckDigitException();
3434
}
3535

36-
//Convert digits to bars
36+
// Convert digits to bars
3737
$codes = [
3838
'A' => [ // left odd parity
3939
'0' => '0001101',

0 commit comments

Comments
 (0)