Skip to content

Commit ff58572

Browse files
committed
phpstan error fixes
1 parent 7efd6fb commit ff58572

3 files changed

Lines changed: 7 additions & 13 deletions

File tree

‎composer.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"symplify/phpstan-rules": "^14.12.3",
5757
"tomasvotruba/class-leak": "^2.1",
5858
"tomasvotruba/fast-unit": "^0.1",
59-
"tomasvotruba/type-coverage": "^2.3",
59+
"tomasvotruba/type-coverage": "^2.3.5",
6060
"tomasvotruba/unused-public": "^2.2",
6161
"tracy/tracy": "^2.12"
6262
},

‎phpstan.neon‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -425,15 +425,10 @@ parameters:
425425
message: '#Parameters should have "PhpParser\\Node\\Stmt\\ClassMethod" types as the only types passed to this method#'
426426
path: src/Reflection/ClassModifierChecker.php
427427

428-
# false positive - should be fixed
429-
-
430-
identifier: typePerfect.narrowPublicClassMethodParamType
431-
message: '#Parameters should have "PhpParser\\Node\\Expr\\Closure" types as the only types passed to this method#'
432-
433-
-
434-
identifier: typePerfect.narrowPublicClassMethodParamType
435-
message: '#Parameters should have "PhpParser\\Node\\Stmt\\ClassMethod" types as the only types passed to this method#'
436-
path: src/VendorLocker/ParentClassMethodTypeOverrideGuard.php
428+
# -
429+
# identifier: typePerfect.narrowPublicClassMethodParamType
430+
# message: '#Parameters should have "PhpParser\\Node\\Stmt\\ClassMethod" types as the only types passed to this method#'
431+
# path: src/VendorLocker/ParentClassMethodTypeOverrideGuard.php
437432

438433
-
439434
identifier: typePerfect.narrowReturnObjectType

‎src/VendorLocker/ParentClassMethodTypeOverrideGuard.php‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace Rector\VendorLocker;
66

77
use PhpParser\Node;
8-
use PhpParser\Node\Stmt\ClassLike;
98
use PhpParser\Node\Stmt\ClassMethod;
109
use PHPStan\Reflection\ClassReflection;
1110
use PHPStan\Reflection\MethodReflection;
@@ -39,7 +38,7 @@ public function __construct(
3938
* classes, so type-declaration rules must leave it untouched. Final classes are never guarded,
4039
* as they cannot be extended.
4140
*/
42-
public function isTypeGuardedClass(ClassLike|ClassMethod $node): bool
41+
public function isTypeGuardedClass(Node\Stmt\Class_|Node\Stmt\Interface_|ClassMethod $node): bool
4342
{
4443
$guardedClasses = SimpleParameterProvider::provideArrayParameter(Option::TYPE_GUARDED_CLASSES);
4544
if ($guardedClasses === []) {
@@ -63,7 +62,7 @@ public function isTypeGuardedClass(ClassLike|ClassMethod $node): bool
6362
);
6463
}
6564

66-
public function hasParentClassMethod(ClassMethod|MethodReflection $classMethod): bool
65+
public function hasParentClassMethod(ClassMethod $classMethod): bool
6766
{
6867
try {
6968
$parentClassMethod = $this->resolveParentClassMethod($classMethod);

0 commit comments

Comments
 (0)