Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/few-bees-drum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cambis/silverstan": minor
---

PHPStan 2.2 upgrade
2 changes: 1 addition & 1 deletion build/composer-php-74.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"php": "^7.4 || ^8.0",
"ext-tokenizer": "*",
"composer/class-map-generator": "^1.5",
"phpstan/phpstan": "^2.1.28",
"phpstan/phpstan": "^2.2.1",
"silverstripe/config": "^1.4 || ^2.0 || ^3.0"
},
"minimum-stability": "dev",
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"php": "^8.3",
"ext-tokenizer": "*",
"composer/class-map-generator": "^1.5",
"phpstan/phpstan": "^2.1.28",
"phpstan/phpstan": "^2.2.1",
"silverstripe/config": "^1.4 || ^2.0 || ^3.0"
},
"require-dev": {
Expand Down
6 changes: 5 additions & 1 deletion src/ConfigurationResolver/ConfigurationResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@ public function resolveExtensionClassName(string $extensionName): ?string
return null;
}

$resolved = $matches[1];
$resolved = $matches[1] ?? null;

if ($resolved === null || $resolved === '') {
return null;
}

if (!$this->reflectionProvider->hasClass($resolved)) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function resolve(ClassReflection $classReflection): array
}

/** @var array<class-string|null> $extensions */
$extensions = array_unique($extensions);
$extensions = array_unique($extensions); // @phpstan-ignore argument.type

foreach ($extensions as $extension) {
if ($extension === null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ public function processNode(Node $node, Scope $scope): array
'Return type of call to method ' . $methodName . ' contains unresolvable type.',
'%s of method ' . $methodName . ' contains unresolvable type.',
'Method ' . $methodName . " invoked with %s, but it's not allowed because of @no-named-arguments.",
'Constant %s is not allowed for %s of method ' . $methodName . ' constructor.',
'Constants %s cannot be combined for %s of method ' . $methodName . ' constructor.',
'Combining constants with | is not allowed for %s of method ' . $methodName . ' constructor.',
null,
);
}
}
Loading