Skip to content

Commit 92a9a9a

Browse files
committed
Fix PHPStan issues
1 parent a7c047c commit 92a9a9a

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

phpstan.neon

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@ parameters:
1313
-
1414
message: '~is not covered by backward compatibility promise.~'
1515
path: src/bitExpert/PHPStan/Magento/Autoload/FactoryAutoloader.php
16-
-
17-
message: '~Call to an undefined method ReflectionType::getName~'
18-
path: src/bitExpert/PHPStan/Magento/Autoload/ProxyAutoloader.php
19-
-
20-
message: '~Parameter #1 \$argument of class ReflectionClass constructor expects~'
21-
path: src/bitExpert/PHPStan/Magento/Autoload/ProxyAutoloader.php
2216
-
2317
message: '~is not covered by backward compatibility promise.~'
2418
path: src/bitExpert/PHPStan/Magento/Autoload/ProxyAutoloader.php

src/bitExpert/PHPStan/Magento/Autoload/ExtensionAutoloader.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ public function autoload(string $class): void
6969
*/
7070
public function getFileContents(string $className): string
7171
{
72+
/** @var class-string $sourceInterface */
7273
$sourceInterface = rtrim(substr($className, 0, -1 * strlen('Extension')), '\\') . 'ExtensionInterface';
74+
/** @var class-string $attrInterface */
7375
$attrInterface = rtrim(substr($sourceInterface, 0, -1 * strlen('ExtensionInterface')), '\\') . 'Interface';
7476

7577
$generator = new ClassGenerator();

src/bitExpert/PHPStan/Magento/Autoload/ProxyAutoloader.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,13 @@ protected function getFileContents(string $class): string
6363
$proxyInterface = ['\Magento\Framework\ObjectManager\NoninterceptableInterface'];
6464
$methods = '';
6565

66+
/** @var class-string $originalClassname */
6667
$reflectionClass = new \ReflectionClass($originalClassname);
6768
if ($reflectionClass->isInterface()) {
6869
$proxyInterface[] = '\\' . $originalClassname;
6970
foreach ($reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) {
7071
$returnType = $method->getReturnType();
71-
if ($returnType instanceof \ReflectionType) {
72+
if ($returnType instanceof \ReflectionNamedType) {
7273
$returnType = ': ' . $returnType->getName();
7374
} else {
7475
$returnType = '';
@@ -77,7 +78,7 @@ protected function getFileContents(string $class): string
7778
$params = [];
7879
foreach ($method->getParameters() as $parameter) {
7980
$paramType = $parameter->getType();
80-
if ($paramType instanceof \ReflectionType) {
81+
if ($paramType instanceof \ReflectionNamedType) {
8182
if ($paramType->isBuiltin()) {
8283
$paramType = $paramType->getName() . ' ';
8384
} else {

0 commit comments

Comments
 (0)