diff --git a/composer.json b/composer.json index 18e748f..0072630 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ "require": { "php": "~7.1|^8.0", "myclabs/php-enum": "^1.2", - "phpstan/phpstan": "^0.12.84" + "phpstan/phpstan": "^1.0" }, "require-dev": { "phpunit/phpunit": "^7.0|^9.0" diff --git a/tests/Reflection/EnumMethodsClassReflectionExtensionTest.php b/tests/Reflection/EnumMethodsClassReflectionExtensionTest.php index b3afb1d..70cb63e 100644 --- a/tests/Reflection/EnumMethodsClassReflectionExtensionTest.php +++ b/tests/Reflection/EnumMethodsClassReflectionExtensionTest.php @@ -5,7 +5,7 @@ namespace Timeweb\Tests\PHPStan\Reflection; use PHPStan\Reflection\ParametersAcceptorSelector; -use PHPStan\Testing\TestCase; +use PHPStan\Testing\PHPStanTestCase; use PHPStan\Type\VerbosityLevel; use Timeweb\PHPStan\Reflection\EnumMethodReflection; use Timeweb\PHPStan\Reflection\EnumMethodsClassReflectionExtension; @@ -14,12 +14,12 @@ /** * @coversDefaultClass \Timeweb\PHPStan\Reflection\EnumMethodsClassReflectionExtension */ -class EnumMethodsClassReflectionExtensionTest extends TestCase +class EnumMethodsClassReflectionExtensionTest extends PHPStanTestCase { /** - * @var \PHPStan\Broker\Broker + * @var \PHPStan\Reflection\ReflectionProvider */ - protected $broker; + protected $reflectionProvider; /** * @var EnumMethodsClassReflectionExtension @@ -28,7 +28,7 @@ class EnumMethodsClassReflectionExtensionTest extends TestCase public function setUp(): void { - $this->broker = $this->createBroker(); + $this->reflectionProvider = $this->createReflectionProvider(); $this->reflectionExtension = new EnumMethodsClassReflectionExtension(); } @@ -38,7 +38,7 @@ public function setUp(): void */ public function testEnumMethodsCanBeFoundInEnumSubclasses(bool $expected, string $methodName): void { - $classReflection = $this->broker->getClass(EnumFixture::class); + $classReflection = $this->reflectionProvider->getClass(EnumFixture::class); $hasMethod = $this->reflectionExtension->hasMethod($classReflection, $methodName); $this->assertEquals($expected, $hasMethod); @@ -60,7 +60,7 @@ public function methodNameDataProvider(): array */ public function testEnumMethodsCannotBeFoundInNonEnumSubclasses(): void { - $classReflection = $this->broker->getClass(EnumFixture::class); + $classReflection = $this->reflectionProvider->getClass(EnumFixture::class); $hasMethod = $this->reflectionExtension->hasMethod($classReflection, 'SOME_NAME'); $this->assertFalse($hasMethod); @@ -72,7 +72,7 @@ public function testEnumMethodsCannotBeFoundInNonEnumSubclasses(): void */ public function testEnumMethodReflectionCanBeObtained(): void { - $classReflection = $this->broker->getClass(EnumFixture::class); + $classReflection = $this->reflectionProvider->getClass(EnumFixture::class); $methodReflection = $this->reflectionExtension->getMethod($classReflection, 'SOME_NAME'); $this->assertInstanceOf(EnumMethodReflection::class, $methodReflection); @@ -91,7 +91,7 @@ public function testEnumMethodReflectionCanBeObtained(): void */ public function testEnumMethodProperties(string $propertyName): void { - $classReflection = $this->broker->getClass(EnumFixture::class); + $classReflection = $this->reflectionProvider->getClass(EnumFixture::class); $methodReflection = $this->reflectionExtension->getMethod($classReflection, $propertyName); $parametersAcceptor = ParametersAcceptorSelector::selectSingle($methodReflection->getVariants()); diff --git a/tests/Rule/EnumAlwaysUsedConstantsExtensionTest.php b/tests/Rule/EnumAlwaysUsedConstantsExtensionTest.php index 0fcfcb9..ea046ee 100644 --- a/tests/Rule/EnumAlwaysUsedConstantsExtensionTest.php +++ b/tests/Rule/EnumAlwaysUsedConstantsExtensionTest.php @@ -4,19 +4,19 @@ namespace Timeweb\Tests\PHPStan\Rule; -use PHPStan\Testing\TestCase; +use PHPStan\Testing\PHPStanTestCase; use Timeweb\PHPStan\Rule\EnumAlwaysUsedConstantsExtension; use Timeweb\Tests\PHPStan\Fixture\EnumFixture; /** * @coversDefaultClass \Timeweb\PHPStan\Rule\EnumAlwaysUsedConstantsExtension */ -class EnumAlwaysUsedConstantsExtensionTest extends TestCase +class EnumAlwaysUsedConstantsExtensionTest extends PHPStanTestCase { /** - * @var \PHPStan\Broker\Broker + * @var \PHPStan\Reflection\ReflectionProvider */ - protected $broker; + protected $reflectionProvider; /** * @var EnumAlwaysUsedConstantsExtension @@ -25,7 +25,7 @@ class EnumAlwaysUsedConstantsExtensionTest extends TestCase public function setUp(): void { - $this->broker = $this->createBroker(); + $this->reflectionProvider = $this->createReflectionProvider(); $this->constantsExtension = new EnumAlwaysUsedConstantsExtension(); } @@ -35,7 +35,7 @@ public function setUp(): void */ public function testEnumConstantsAreConsideredAsAlwaysUsed(string $constantName): void { - $classReflection = $this->broker->getClass(EnumFixture::class); + $classReflection = $this->reflectionProvider->getClass(EnumFixture::class); $constantReflection = $classReflection->getConstant($constantName); $this->assertTrue($this->constantsExtension->isAlwaysUsed($constantReflection));