Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.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"
Expand Down
18 changes: 9 additions & 9 deletions tests/Reflection/EnumMethodsClassReflectionExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -28,7 +28,7 @@ class EnumMethodsClassReflectionExtensionTest extends TestCase

public function setUp(): void
{
$this->broker = $this->createBroker();
$this->reflectionProvider = $this->createReflectionProvider();
$this->reflectionExtension = new EnumMethodsClassReflectionExtension();
}

Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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());

Expand Down
12 changes: 6 additions & 6 deletions tests/Rule/EnumAlwaysUsedConstantsExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -25,7 +25,7 @@ class EnumAlwaysUsedConstantsExtensionTest extends TestCase

public function setUp(): void
{
$this->broker = $this->createBroker();
$this->reflectionProvider = $this->createReflectionProvider();
$this->constantsExtension = new EnumAlwaysUsedConstantsExtension();
}

Expand All @@ -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));
Expand Down