Skip to content

Commit

Permalink
Fix compatibility with PHP 7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
xificurk authored and ondrejmirtes committed Jul 28, 2017
1 parent d991af4 commit a8f79aa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/Reflection/Nette/NetteObjectClassReflectionExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace PHPStan\Reflection\Nette;

use Nette\Object;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\MethodReflection;
use PHPStan\Reflection\MethodsClassReflectionExtension;
Expand All @@ -14,7 +13,7 @@ class NetteObjectClassReflectionExtension implements MethodsClassReflectionExten

public function hasProperty(ClassReflection $classReflection, string $propertyName): bool
{
if (!$classReflection->isSubclassOf(Object::class)) {
if (!$classReflection->isSubclassOf('Nette\Object')) {
return false;
}

Expand Down Expand Up @@ -58,7 +57,7 @@ public function getProperty(ClassReflection $classReflection, string $propertyNa
public function hasMethod(ClassReflection $classReflection, string $methodName): bool
{
$traitNames = $this->getTraitNames($classReflection->getNativeReflection());
if (!$classReflection->isSubclassOf(Object::class) && !in_array(\Nette\SmartObject::class, $traitNames, true)) {
if (!$classReflection->isSubclassOf('Nette\Object') && !in_array(\Nette\SmartObject::class, $traitNames, true)) {
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Rule/Nette/DoNotExtendNetteObjectRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ public function processNode(Node $node, Scope $scope): array
}

$classReflection = $this->broker->getClass($className);
if ($classReflection->isSubclassOf(\Nette\Object::class)) {
if ($classReflection->isSubclassOf('Nette\Object')) {
return [
sprintf(
"Class %s extends %s - it's better to use %s trait.",
$className,
\Nette\Object::class,
'Nette\Object',
\Nette\SmartObject::class
),
];
Expand Down

0 comments on commit a8f79aa

Please sign in to comment.