Skip to content

Commit e6b1ff0

Browse files
committed
:octocat: run phpstan on the benchmarks
1 parent 1617ed0 commit e6b1ff0

File tree

5 files changed

+54
-7
lines changed

5 files changed

+54
-7
lines changed

benchmark/QRDataBenchmark.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ public function initBitBuffer():void{
4848
#[Subject]
4949
#[BeforeMethods(['assignParams', 'generateTestData', 'initOptions'])]
5050
public function invocation():void{
51-
/** @phan-suppress-next-line PhanNoopNew */
5251
new QRData($this->options, [new $this->modeFQCN($this->testData)]);
5352
}
5453

benchmark/generate-html.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
* @author smiley <[email protected]>
77
* @copyright 2024 smiley
88
* @license MIT
9-
*
10-
* @phan-file-suppress PhanTypeArraySuspiciousNullable
119
*/
1210
declare(strict_types=1);
1311

benchmark/generate-markdown.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
* @author smiley <[email protected]>
77
* @copyright 2024 smiley
88
* @license MIT
9-
*
10-
* @phan-file-suppress PhanTypeArraySuspiciousNullable
119
*/
1210
declare(strict_types=1);
1311

@@ -30,10 +28,16 @@
3028
require_once __DIR__.'/parse-common.php';
3129

3230
if(!file_exists(FILE.'.json')){
33-
throw new RuntimeException('invalid benchmark report');
31+
throw new RuntimeException('invalid benchmark report [file_exists()]');
32+
}
33+
34+
$data = file_get_contents(FILE.'.json');
35+
36+
if($data === false){
37+
throw new RuntimeException('invalid benchmark report [file_get_contents()]');
3438
}
3539

36-
$json = json_decode(file_get_contents(FILE.'.json'), true);
40+
$json = json_decode($data, true);
3741
$markdown = [];
3842

3943
// General information/overview

phpstan-baseline.neon

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,50 @@
11
parameters:
22
ignoreErrors:
3+
-
4+
message: "#^Property chillerlan\\\\QRCodeBenchmark\\\\DecoderBenchmark\\:\\:\\$imageBlob \\(string\\) does not accept GdImage\\|string\\.$#"
5+
count: 1
6+
path: benchmark/DecoderBenchmark.php
7+
8+
-
9+
message: "#^Parameter \\#1 \\$segment of method chillerlan\\\\QRCode\\\\QRCode\\:\\:addSegment\\(\\) expects chillerlan\\\\QRCode\\\\Data\\\\QRDataModeInterface, object given\\.$#"
10+
count: 1
11+
path: benchmark/QRCodeBenchmark.php
12+
13+
-
14+
message: "#^Parameter \\#2 \\$dataSegments of class chillerlan\\\\QRCode\\\\Data\\\\QRData constructor expects array\\<chillerlan\\\\QRCode\\\\Data\\\\QRDataModeInterface\\>, array\\<int, object\\> given\\.$#"
15+
count: 2
16+
path: benchmark/QRDataBenchmark.php
17+
18+
-
19+
message: "#^Parameter \\#1 \\$string of function strtolower expects string, int\\|string given\\.$#"
20+
count: 1
21+
path: benchmark/generate-markdown.php
22+
23+
-
24+
message: "#^Offset 'name' does not exist on array\\<int, mixed\\>\\.$#"
25+
count: 1
26+
path: benchmark/parse-common.php
27+
28+
-
29+
message: "#^Offset 'results' does not exist on array\\<int, mixed\\>\\.$#"
30+
count: 1
31+
path: benchmark/parse-common.php
32+
33+
-
34+
message: "#^Offset 0 does not exist on array\\{\\}\\.$#"
35+
count: 1
36+
path: benchmark/parse-common.php
37+
38+
-
39+
message: "#^Function chillerlan\\\\QRCodeBenchmark\\\\parseLine\\(\\) return type has no value type specified in iterable type array\\.$#"
40+
count: 1
41+
path: benchmark/parse-result.php
42+
43+
-
44+
message: "#^Parameter \\#1 \\$string of function trim expects string, string\\|false given\\.$#"
45+
count: 1
46+
path: benchmark/parse-result.php
47+
348
-
449
message: "#^Property chillerlan\\\\QRCode\\\\QROptions\\:\\:\\$eccLevel \\(int\\) does not accept string\\.$#"
550
count: 1

phpstan.dist.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ parameters:
44
level: 8
55
tmpDir: .build/phpstan-cache
66
paths:
7+
- benchmark
78
- examples
89
- src
910
- tests

0 commit comments

Comments
 (0)