Skip to content

Commit

Permalink
Fixes after PHPStan update
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Sep 30, 2024
1 parent 5a256b6 commit 8d9bbb4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
14 changes: 7 additions & 7 deletions tests/Reflection/Nette/HtmlClassReflectionExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
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;

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();
}

Expand All @@ -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());
Expand Down Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}

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

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

Expand Down

0 comments on commit 8d9bbb4

Please sign in to comment.