Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3dbb999

Browse files
Fix DoctrineSelectableClassReflectionExtension
1 parent 8d660e9 commit 3dbb999

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

‎src/Reflection/Doctrine/DoctrineSelectableClassReflectionExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class DoctrineSelectableClassReflectionExtension implements MethodsClassReflecti
1313
/** @var ReflectionProvider */
1414
private $reflectionProvider;
1515

16-
public function setBroker(ReflectionProvider $reflectionProvider): void
16+
public function __construct(ReflectionProvider $reflectionProvider)
1717
{
1818
$this->reflectionProvider = $reflectionProvider;
1919
}

‎tests/Reflection/Doctrine/DoctrineSelectableClassReflectionExtensionTest.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,22 @@
33
namespace PHPStan\Reflection\Doctrine;
44

55
use Doctrine\Common\Collections\Collection;
6-
use PHPStan\Broker\Broker;
6+
use PHPStan\Reflection\ReflectionProvider;
77
use PHPStan\Testing\PHPStanTestCase;
88

99
final class DoctrineSelectableClassReflectionExtensionTest extends PHPStanTestCase
1010
{
1111

12-
/** @var Broker */
13-
private $broker;
12+
/** @var ReflectionProvider */
13+
private $reflectionProvider;
1414

1515
/** @var DoctrineSelectableClassReflectionExtension */
1616
private $extension;
1717

1818
protected function setUp(): void
1919
{
20-
$this->broker = $this->createBroker();
21-
22-
$this->extension = new DoctrineSelectableClassReflectionExtension();
23-
$this->extension->setBroker($this->broker);
20+
$this->reflectionProvider = $this->createReflectionProvider();
21+
$this->extension = new DoctrineSelectableClassReflectionExtension($this->reflectionProvider);
2422
}
2523

2624
/**
@@ -39,13 +37,13 @@ public function dataHasMethod(): array
3937
*/
4038
public function testHasMethod(string $className, string $method, bool $expectedResult): void
4139
{
42-
$classReflection = $this->broker->getClass($className);
40+
$classReflection = $this->reflectionProvider->getClass($className);
4341
self::assertSame($expectedResult, $this->extension->hasMethod($classReflection, $method));
4442
}
4543

4644
public function testGetMethod(): void
4745
{
48-
$classReflection = $this->broker->getClass(Collection::class);
46+
$classReflection = $this->reflectionProvider->getClass(Collection::class);
4947
$methodReflection = $this->extension->getMethod($classReflection, 'matching');
5048
self::assertSame('matching', $methodReflection->getName());
5149
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /