From 8d9bbb4366d44b48b694bbeb4dd47d632a3ddddb Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Mon, 30 Sep 2024 17:28:11 +0200 Subject: [PATCH] Fixes after PHPStan update --- .../Nette/HtmlClassReflectionExtensionTest.php | 14 +++++++------- .../NetteObjectClassReflectionExtensionTest.php | 9 +++++---- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/tests/Reflection/Nette/HtmlClassReflectionExtensionTest.php b/tests/Reflection/Nette/HtmlClassReflectionExtensionTest.php index 0c78873..9c217cb 100644 --- a/tests/Reflection/Nette/HtmlClassReflectionExtensionTest.php +++ b/tests/Reflection/Nette/HtmlClassReflectionExtensionTest.php @@ -3,7 +3,7 @@ namespace PHPStan\Reflection\Nette; use Nette\Utils\Html; -use PHPStan\Broker\Broker; +use PHPStan\Reflection\ReflectionProvider; use PHPStan\Testing\PHPStanTestCase; use PHPStan\Type\VerbosityLevel; use stdClass; @@ -11,13 +11,13 @@ class HtmlClassReflectionExtensionTest extends PHPStanTestCase { - private Broker $broker; + private ReflectionProvider $reflectionProvider; private HtmlClassReflectionExtension $extension; protected function setUp(): void { - $this->broker = $this->createBroker(); + $this->reflectionProvider = $this->createReflectionProvider(); $this->extension = new HtmlClassReflectionExtension(); } @@ -43,13 +43,13 @@ public function dataHasMethod(): array */ public function testHasMethod(string $className, bool $result): void { - $classReflection = $this->broker->getClass($className); + $classReflection = $this->reflectionProvider->getClass($className); self::assertSame($result, $this->extension->hasMethod($classReflection, 'href')); } public function testGetMethod(): void { - $classReflection = $this->broker->getClass(Html::class); + $classReflection = $this->reflectionProvider->getClass(Html::class); $methodReflection = $this->extension->getMethod($classReflection, 'href'); $parametersAcceptor = $methodReflection->getVariants()[0]; self::assertSame('href', $methodReflection->getName()); @@ -84,13 +84,13 @@ public function dataHasProperty(): array */ public function testHasProperty(string $className, bool $result): void { - $classReflection = $this->broker->getClass($className); + $classReflection = $this->reflectionProvider->getClass($className); self::assertSame($result, $this->extension->hasProperty($classReflection, 'href')); } public function testGetProperty(): void { - $classReflection = $this->broker->getClass(Html::class); + $classReflection = $this->reflectionProvider->getClass(Html::class); $propertyReflection = $this->extension->getProperty($classReflection, 'href'); self::assertSame($classReflection, $propertyReflection->getDeclaringClass()); self::assertFalse($propertyReflection->isStatic()); diff --git a/tests/Reflection/Nette/NetteObjectClassReflectionExtensionTest.php b/tests/Reflection/Nette/NetteObjectClassReflectionExtensionTest.php index 5d96d6e..df13cd4 100644 --- a/tests/Reflection/Nette/NetteObjectClassReflectionExtensionTest.php +++ b/tests/Reflection/Nette/NetteObjectClassReflectionExtensionTest.php @@ -3,6 +3,7 @@ namespace PHPStan\Reflection\Nette; use PHPStan\Broker\Broker; +use PHPStan\Reflection\ReflectionProvider; use PHPStan\SmartObjectChild; use PHPStan\Testing\PHPStanTestCase; use function class_exists; @@ -11,13 +12,13 @@ class NetteObjectClassReflectionExtensionTest extends PHPStanTestCase { - private Broker $broker; + private ReflectionProvider $reflectionProvider; private NetteObjectClassReflectionExtension $extension; protected function setUp(): void { - $this->broker = $this->createBroker(); + $this->reflectionProvider = $this->createReflectionProvider(); $this->extension = new NetteObjectClassReflectionExtension(); } @@ -58,7 +59,7 @@ public function testHasMethod(string $className, string $method, bool $result): if (!class_exists('Nette\LegacyObject')) { self::markTestSkipped(sprintf('%s does not exist.', $className)); } - $classReflection = $this->broker->getClass($className); + $classReflection = $this->reflectionProvider->getClass($className); self::assertSame($result, $this->extension->hasMethod($classReflection, $method)); } @@ -100,7 +101,7 @@ public function testHasProperty(string $className, string $property, bool $resul if (!class_exists('Nette\LegacyObject')) { self::markTestSkipped(sprintf('%s does not exist.', $className)); } - $classReflection = $this->broker->getClass($className); + $classReflection = $this->reflectionProvider->getClass($className); self::assertSame($result, $this->extension->hasProperty($classReflection, $property)); }