Skip to content

Commit eefa20a

Browse files
authored
Merge pull request #99 from ondrejmirtes/phpstan-0.12-fixes
Small PR for PHPStan 0.12 upgrade
2 parents f78fb38 + 71ce262 commit eefa20a

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

extension.neon

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ parameters:
1212
- profile
1313
- engine
1414
drupal:
15+
drupal_root: null
1516
entityTypeStorageMapping:
1617
node: Drupal\node\NodeStorage
1718
taxonomy_term: Drupal\taxonomy\TermStorage
1819
user: Drupal\user\UserStorage
1920
parametersSchema:
2021
drupal: structure([
21-
drupal_root: string()
22+
drupal_root: schema(string(), nullable())
2223
entityTypeStorageMapping: arrayOf(string())
2324
])
2425
rules:

phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ includes:
22
- vendor/phpstan/phpstan-strict-rules/rules.neon
33
- vendor/phpstan/phpstan-deprecation-rules/rules.neon
44
parameters:
5-
level: 7
5+
level: 8
66
checkGenericClassInNonGenericObjectType: false
77
checkMissingIterableValueType: false

src/Drupal/DrupalAutoloader.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,9 @@ class DrupalAutoloader
6363
public function register(Container $container): void
6464
{
6565
$startPath = null;
66-
$drupalParams = $container->hasParameter('drupal') ? $container->getParameter('drupal') : [
67-
'drupal_root' => null,
68-
'serviceMap' => [],
69-
'entityTypeStorageMapping' => [],
70-
];
71-
$drupalRoot = $drupalParams['drupal_root'];
72-
if (realpath($drupalRoot) !== false && is_dir($drupalRoot)) {
66+
$drupalParams = $container->getParameter('drupal');
67+
$drupalRoot = $drupalParams['drupal_root'] ?? null;
68+
if ($drupalRoot !== null && realpath($drupalRoot) !== false && is_dir($drupalRoot)) {
7369
$startPath = $drupalRoot;
7470
} else {
7571
$startPath = dirname($GLOBALS['autoloaderInWorkingDirectory']);

0 commit comments

Comments
 (0)