Skip to content

Commit e0936cf

Browse files
committed
fixed PHPStan errors
1 parent 70b8285 commit e0936cf

5 files changed

Lines changed: 19 additions & 7 deletions

File tree

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
},
2626
"require-dev": {
2727
"nette/application": "^3.2",
28+
"nette/assets": "^1.0",
2829
"nette/caching": "^3.2",
2930
"nette/database": "^3.2",
3031
"nette/forms": "^3.2",

phpstan.neon

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
parameters:
2-
level: 5
2+
level: 8
33

44
paths:
55
- src
66

7-
includes:
8-
- vendor/phpstan/phpstan-nette/extension.neon
7+
excludePaths:
8+
- src/Configurator.php # backward compatibility shim
9+
10+
ignoreErrors:
11+
- # false positives guaranteed at runtime:
12+
# - InstalledVersions::getVersion() is non-null after isInstalled() check
13+
# - ClassLoader is always a user-land class with a file (2x)
14+
identifier: argument.type
15+
path: src/Bootstrap/Configurator.php
16+
count: 3
17+
- # ClassLoader is always a user-land class with a file
18+
identifier: method.nameCase
19+
path: src/Bootstrap/Configurator.php

src/Bootstrap/Configurator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ protected function getDefaultParameters(): array
188188
$loaderRc = class_exists(ClassLoader::class)
189189
? new \ReflectionClass(ClassLoader::class)
190190
: null;
191-
$rootDir = class_exists(InstalledVersions::class) && ($tmp = InstalledVersions::getRootPackage()['install_path'] ?? null)
192-
? rtrim(Nette\Utils\FileSystem::normalizePath($tmp), '\/')
191+
$rootDir = class_exists(InstalledVersions::class)
192+
? rtrim(Nette\Utils\FileSystem::normalizePath(InstalledVersions::getRootPackage()['install_path']), '\/')
193193
: null;
194194
$baseUrl = new Statement('trim($this->getByType(?)->getUrl()->getBaseUrl(), "/")', [Nette\Http\IRequest::class]);
195195
return [

src/Bootstrap/Extensions/ConstantsExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function getConfigSchema(): Nette\Schema\Schema
2727

2828
public function loadConfiguration(): void
2929
{
30-
foreach ($this->getConfig() as $name => $value) {
30+
foreach ((array) $this->config as $name => $value) {
3131
$this->initialization->addBody('define(?, ?);', [$name, $value]);
3232
}
3333
}

src/Bootstrap/Extensions/PhpExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function getConfigSchema(): Nette\Schema\Schema
2727

2828
public function loadConfiguration(): void
2929
{
30-
foreach ($this->getConfig() as $name => $value) {
30+
foreach ((array) $this->config as $name => $value) {
3131
if (!function_exists('ini_set')) {
3232
throw new Nette\NotSupportedException('Required function ini_set() is disabled.');
3333
}

0 commit comments

Comments
 (0)