Skip to content

Commit 22e6c4b

Browse files
committed
🔥 phan v6-dev
1 parent 21b47ff commit 22e6c4b

File tree

4 files changed

+17
-16
lines changed

4 files changed

+17
-16
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- "8.2"
3333
- "8.3"
3434
- "8.4"
35-
# - "8.5"
35+
- "8.5"
3636

3737
steps:
3838
- name: "Checkout"

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"ext-fileinfo": "*",
5656
"chillerlan/php-authenticator": "^5.2.1",
5757
"intervention/image": "^3.11",
58-
"phan/phan": "^5.5.2",
58+
"phan/phan": "v6.x-dev",
5959
"phpbench/phpbench": "^1.4",
6060
"phpunit/phpunit": "^11.5",
6161
"phpmd/phpmd": "^2.15",

examples/qrcode-interactive.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ function sendResponse(array $response):never{
2323
exit;
2424
}
2525

26+
function parseHexValue(string $v):array|string|null{
27+
if(preg_match('/[a-f\d]{6}/i', $v) === 1){
28+
return in_array($_POST['output_type'], ['png', 'jpg', 'gif'], true)
29+
? array_map('hexdec', str_split($v, 2))
30+
: '#'.$v ;
31+
}
32+
return null;
33+
}
34+
2635
try{
2736

2837
$moduleValues = [
@@ -55,16 +64,6 @@ function sendResponse(array $response):never{
5564
QRMatrix::M_LOGO => $_POST['m_logo_light'],
5665
];
5766

58-
$moduleValues = array_map(function($v){
59-
if(preg_match('/[a-f\d]{6}/i', $v) === 1){
60-
return in_array($_POST['output_type'], ['png', 'jpg', 'gif'], true)
61-
? array_map('hexdec', str_split($v, 2))
62-
: '#'.$v ;
63-
}
64-
return null;
65-
}, $moduleValues);
66-
67-
6867
$ecc = in_array($_POST['ecc'], ['L', 'M', 'Q', 'H'], true) ? $_POST['ecc'] : 'L';
6968

7069
$options = new QROptions([
@@ -73,7 +72,8 @@ function sendResponse(array $response):never{
7372
'maskPattern' => (int)$_POST['maskpattern'],
7473
'addQuietzone' => isset($_POST['quietzone']),
7574
'quietzoneSize' => (int)$_POST['quietzonesize'],
76-
'moduleValues' => $moduleValues,
75+
/** @phan-suppress-next-line PhanTypeMismatchArgument (false positive) */
76+
'moduleValues' => array_map(parseHexValue(...), $moduleValues),
7777
'outputType' => $_POST['output_type'],
7878
'scale' => (int)$_POST['scale'],
7979
'outputBase64' => true,

tests/QRCodeReaderTestAbstract.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,15 @@ public function testReadData(Version $version, EccLevel $ecc, string $expected):
172172
$qrcode = new QRCode($this->options);
173173
$imagedata = $qrcode->render($expected);
174174
$result = $qrcode->readFromBlob($imagedata);
175+
176+
$this::assertSame($expected, $result->data);
177+
$this::assertSame($version->getVersionNumber(), $result->version->getVersionNumber());
178+
$this::assertSame($ecc->getLevel(), $result->eccLevel->getLevel());
175179
}
176180
catch(Exception $e){
177181
$this::markTestSkipped(sprintf('skipped version %s%s: %s', $version, $ecc, $e->getMessage()));
178182
}
179183

180-
$this::assertSame($expected, $result->data);
181-
$this::assertSame($version->getVersionNumber(), $result->version->getVersionNumber());
182-
$this::assertSame($ecc->getLevel(), $result->eccLevel->getLevel());
183184
}
184185

185186
}

0 commit comments

Comments
 (0)