Skip to content

Commit

Permalink
Require PHPStan 1.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed May 2, 2022
1 parent c0b61e2 commit 4855249
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
],
"require": {
"php": "^7.2 || ^8.0",
"phpstan/phpstan": "^1.6.3"
"phpstan/phpstan": "^1.7.0"
},
"require-dev": {
"nikic/php-parser": "^4.13.0",
Expand Down
10 changes: 0 additions & 10 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,6 @@ parameters:
count: 1
path: src/Rules/Classes/RequireParentConstructCallRule.php

-
message: "#^Method PHPStan\\\\Rules\\\\Classes\\\\RequireParentConstructCallRule\\:\\:getParentConstructorClass\\(\\) has parameter \\$classReflection with generic class ReflectionClass but does not specify its types\\: T$#"
count: 1
path: src/Rules/Classes/RequireParentConstructCallRule.php

-
message: "#^Method PHPStan\\\\Rules\\\\Classes\\\\RequireParentConstructCallRule\\:\\:getParentConstructorClass\\(\\) return type with generic class ReflectionClass does not specify its types\\: T$#"
count: 1
path: src/Rules/Classes/RequireParentConstructCallRule.php

-
message: "#^Class PHPStan\\\\Rules\\\\DisallowedConstructs\\\\DisallowedBacktickRule implements generic interface PHPStan\\\\Rules\\\\Rule but does not specify its types\\: TNodeType$#"
count: 1
Expand Down
6 changes: 4 additions & 2 deletions src/Rules/Classes/RequireParentConstructCallRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
use PhpParser\Node\Name;
use PhpParser\Node\Stmt\ClassMethod;
use PHPStan\Analyser\Scope;
use PHPStan\BetterReflection\Reflection\Adapter\ReflectionClass;
use PHPStan\BetterReflection\Reflection\Adapter\ReflectionEnum;
use PHPStan\Rules\Rule;
use PHPStan\ShouldNotHappenException;
use ReflectionClass;
use function property_exists;
use function sprintf;

Expand Down Expand Up @@ -114,9 +115,10 @@ private function callsParentConstruct(Node $parserNode): bool
}

/**
* @param ReflectionClass|ReflectionEnum $classReflection
* @return ReflectionClass|false
*/
private function getParentConstructorClass(ReflectionClass $classReflection)
private function getParentConstructorClass($classReflection)
{
while ($classReflection->getParentClass() !== false) {
$constructor = $classReflection->getParentClass()->hasMethod('__construct') ? $classReflection->getParentClass()->getMethod('__construct') : null;
Expand Down

0 comments on commit 4855249

Please sign in to comment.