Skip to content

Commit

Permalink
Require PHPStan 1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed May 2, 2022
1 parent 85efe4b commit b26373f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 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.5"
"phpstan/phpstan": "^1.7"
},
"conflict": {
"nette/application": "<2.3.0",
Expand Down
13 changes: 7 additions & 6 deletions src/Reflection/Nette/NetteObjectClassReflectionExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

namespace PHPStan\Reflection\Nette;

use PHPStan\BetterReflection\Reflection\Adapter\ReflectionClass;
use PHPStan\BetterReflection\Reflection\Adapter\ReflectionEnum;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\MethodReflection;
use PHPStan\Reflection\MethodsClassReflectionExtension;
use PHPStan\Reflection\ParametersAcceptorSelector;
use PHPStan\Reflection\PropertiesClassReflectionExtension;
use PHPStan\Reflection\PropertyReflection;
use ReflectionClass;
use function array_merge;
use function array_unique;
use function array_values;
Expand Down Expand Up @@ -75,10 +76,10 @@ public function getMethod(ClassReflection $classReflection, string $methodName):
}

/**
* @param ReflectionClass<object> $class
* @param ReflectionClass|ReflectionEnum $class
* @return string[]
*/
private function getTraitNames(ReflectionClass $class): array
private function getTraitNames($class): array
{
$traitNames = $class->getTraitNames();
while ($class->getParentClass() !== false) {
Expand All @@ -90,13 +91,13 @@ private function getTraitNames(ReflectionClass $class): array
}

/**
* @param ReflectionClass<object> $class
* @param ReflectionClass|ReflectionEnum $class
*/
private function inheritsFromNetteObject(ReflectionClass $class): bool
private function inheritsFromNetteObject($class): bool
{
$class = $class->getParentClass();
while ($class !== false) {
if (in_array($class->getName(), [
if (in_array($class->getName(), [ // @phpstan-ignore-line
'Nette\Object',
'Nette\LegacyObject',
], true)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Rule/Nette/DoNotExtendNetteObjectRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function processNode(Node $node, Scope $scope): array

$classReflection = $this->broker->getClass($className);
$parentClass = $classReflection->getNativeReflection()->getParentClass();
if ($parentClass !== false && in_array($parentClass->getName(), [
if ($parentClass !== false && in_array($parentClass->getName(), [ // @phpstan-ignore-line
'Nette\Object',
'Nette\LegacyObject',
], true)) {
Expand Down

0 comments on commit b26373f

Please sign in to comment.