Skip to content

Commit 565e11d

Browse files
committed
Fix test
1 parent b30c243 commit 565e11d

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

tests/Rules/DeadCode/UnusedPrivatePropertyRuleTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@ public function testRule(): void
3333

3434
$this->analyse([__DIR__ . '/data/unused-private-property.php'], [
3535
[
36-
'Property UnusedPrivateProperty\EntityWithAGeneratedId::$unused is never written, only read.',
36+
'Property PHPStan\Rules\Doctrine\ORM\UnusedPrivateProperty\EntityWithAGeneratedId::$unused is never written, only read.',
3737
23,
3838
'See: https://phpstan.org/developing-extensions/always-read-written-properties',
3939
],
4040
[
41-
'Property UnusedPrivateProperty\EntityWithAGeneratedId::$unused2 is unused.',
41+
'Property PHPStan\Rules\Doctrine\ORM\UnusedPrivateProperty\EntityWithAGeneratedId::$unused2 is unused.',
4242
25,
4343
'See: https://phpstan.org/developing-extensions/always-read-written-properties',
4444
],
4545
[
46-
'Property UnusedPrivateProperty\ReadOnlyEntityWithConstructor::$id is never written, only read.',
46+
'Property PHPStan\Rules\Doctrine\ORM\UnusedPrivateProperty\ReadOnlyEntityWithConstructor::$id is never written, only read.',
4747
53,
4848
'See: https://phpstan.org/developing-extensions/always-read-written-properties',
4949
],

tests/Rules/DeadCode/data/unused-private-property.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php // lint >= 7.4
22

3-
namespace UnusedPrivateProperty;
3+
namespace PHPStan\Rules\Doctrine\ORM\UnusedPrivateProperty;
44

55
use Doctrine\ORM\Mapping as ORM;
66

tests/Rules/DeadCode/entity-manager.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<?php declare(strict_types = 1);
22

3+
use Doctrine\Common\Annotations\AnnotationReader;
34
use Doctrine\ORM\Configuration;
45
use Doctrine\ORM\EntityManager;
6+
use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
57
use Doctrine\ORM\Mapping\Driver\AttributeDriver;
68
use Doctrine\Persistence\Mapping\Driver\MappingDriverChain;
79
use Symfony\Component\Cache\Adapter\ArrayAdapter;
@@ -13,6 +15,10 @@
1315
$config->setMetadataCacheImpl(new DoctrineProvider(new ArrayAdapter()));
1416

1517
$metadataDriver = new MappingDriverChain();
18+
$metadataDriver->addDriver(new AnnotationDriver(
19+
new AnnotationReader(),
20+
[__DIR__ . '/data']
21+
), 'PHPStan\\Rules\\Doctrine\\ORM\\');
1622
if (PHP_VERSION_ID >= 80100) {
1723
$metadataDriver->addDriver(
1824
new AttributeDriver([__DIR__ . '/data']),

0 commit comments

Comments
 (0)