Skip to content

Commit 1bd31d0

Browse files
committed
fixed PHPStan errors
1 parent e180b9f commit 1bd31d0

3 files changed

Lines changed: 32 additions & 5 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"require-dev": {
2323
"nette/tester": "^2.6",
2424
"tracy/tracy": "^2.9",
25-
"phpstan/phpstan-nette": "^2.0@stable"
25+
"phpstan/phpstan": "^2.0@stable"
2626
},
2727
"autoload": {
2828
"classmap": ["src/"],

phpstan.neon

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,32 @@
11
parameters:
2-
level: 5
2+
level: 7
33

44
paths:
55
- src
6+
7+
checkMissingCallableSignature: true
8+
9+
ignoreErrors:
10+
-
11+
message: '#^Method Nette\\Loaders\\RobotLoader\:\:scanPhp\(\) should return list\<class\-string\> but returns list\<non\-falsy\-string\>\.$#'
12+
identifier: return.type
13+
count: 1
14+
path: src/RobotLoader/RobotLoader.php
15+
16+
-
17+
message: '#^Parameter \#1 \$code of static method PhpToken\:\:tokenize\(\) expects string, string\|false given\.$#'
18+
identifier: argument.type
19+
count: 1
20+
path: src/RobotLoader/RobotLoader.php
21+
22+
-
23+
message: '#^Unreachable statement \- code above always terminates\.$#'
24+
identifier: deadCode.unreachable
25+
count: 1
26+
path: src/RobotLoader/RobotLoader.php
27+
28+
-
29+
message: '#^Variable \$prevFile in isset\(\) always exists and is not nullable\.$#'
30+
identifier: isset.variable
31+
count: 2
32+
path: src/RobotLoader/RobotLoader.php

src/RobotLoader/RobotLoader.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function tryLoad(string $type): void
132132
*/
133133
public function addDirectory(string ...$paths): static
134134
{
135-
$this->scanPaths = array_merge($this->scanPaths, $paths);
135+
$this->scanPaths = array_merge($this->scanPaths, array_values($paths));
136136
return $this;
137137
}
138138

@@ -149,7 +149,7 @@ public function reportParseErrors(bool $state = true): static
149149
*/
150150
public function excludeDirectory(string ...$paths): static
151151
{
152-
$this->excludeDirs = array_merge($this->excludeDirs, $paths);
152+
$this->excludeDirs = array_merge($this->excludeDirs, array_values($paths));
153153
return $this;
154154
}
155155

@@ -301,7 +301,7 @@ private function updateFile(string $file): void
301301
));
302302
}
303303

304-
$this->classes[$class] = [$file, filemtime($file)];
304+
$this->classes[$class] = [$file, (int) filemtime($file)];
305305
}
306306
}
307307

0 commit comments

Comments
 (0)