Skip to content

Commit 5373c40

Browse files
committed
Move classes requiring PHP 8.4 outside of the Documents directory, as its scanned by several tests
1 parent 20ac541 commit 5373c40

File tree

8 files changed

+11
-9
lines changed

8 files changed

+11
-9
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
"Doctrine\\ODM\\MongoDB\\Tests\\": "tests/Doctrine/ODM/MongoDB/Tests",
6969
"Documentation\\": "tests/Documentation",
7070
"Documents\\": "tests/Documents",
71+
"Documents84\\": "tests/Documents84",
7172
"Stubs\\": "tests/Stubs",
7273
"TestDocuments\\" :"tests/Doctrine/ODM/MongoDB/Tests/Mapping/Driver/fixtures"
7374
}

lib/Doctrine/ODM/MongoDB/DocumentManager.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,6 @@ public function getReference(string $documentName, $identifier): object
626626
return $document;
627627
}
628628

629-
/** @var T $document */
630629
$document = $this->proxyFactory->getProxy($class, $identifier);
631630
$this->unitOfWork->registerManaged($document, $identifier, []);
632631

tests/Doctrine/ODM/MongoDB/Tests/BaseTestCase.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use MongoDB\Model\DatabaseInfo;
2121
use PHPUnit\Framework\TestCase;
2222
use ProxyManager\Proxy\LazyLoadingInterface;
23+
use ReflectionClass;
2324

2425
use function array_key_exists;
2526
use function array_map;
@@ -39,6 +40,7 @@
3940

4041
use const DOCTRINE_MONGODB_DATABASE;
4142
use const DOCTRINE_MONGODB_SERVER;
43+
use const PHP_VERSION_ID;
4244

4345
abstract class BaseTestCase extends TestCase
4446
{
@@ -135,7 +137,7 @@ public static function assertArraySubset(array $subset, array $array, bool $chec
135137

136138
public static function isLazyObject(object $document): bool
137139
{
138-
if (PHP_VERSION_ID >= 80400 && (new \ReflectionClass($document))->getLazyInitializer($document)) {
140+
if (PHP_VERSION_ID >= 80400 && (new ReflectionClass($document))->getLazyInitializer($document)) {
139141
return true;
140142
}
141143

tests/Doctrine/ODM/MongoDB/Tests/Functional/PropertyHooksTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
use Doctrine\ODM\MongoDB\Mapping\MappingException;
88
use Doctrine\ODM\MongoDB\Tests\BaseTestCase;
9-
use Documents\PropertyHooks\MappingVirtualProperty;
10-
use Documents\PropertyHooks\User;
9+
use Documents84\PropertyHooks\MappingVirtualProperty;
10+
use Documents84\PropertyHooks\User;
1111
use PHPUnit\Framework\Attributes\RequiresPhp;
1212

1313
#[RequiresPhp('>= 8.4.0')]

tests/Doctrine/ODM/MongoDB/Tests/Mapping/AbstractAnnotationDriverTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use stdClass;
1717

1818
use function assert;
19+
use function class_exists;
1920

2021
abstract class AbstractAnnotationDriverTestCase extends AbstractMappingDriverTestCase
2122
{
@@ -96,8 +97,6 @@ public function testGetAllClassNamesIsIdempotent(): void
9697
{
9798
$annotationDriver = $this->loadDriverForCMSDocuments();
9899
$original = $annotationDriver->getAllClassNames();
99-
100-
$annotationDriver = $this->loadDriverForCMSDocuments();
101100
$afterTestReset = $annotationDriver->getAllClassNames();
102101

103102
self::assertEquals($original, $afterTestReset);
@@ -118,6 +117,7 @@ public function testGetAllClassNamesIsIdempotentEvenWithDifferentDriverInstances
118117
/** @group DDC-318 */
119118
public function testGetAllClassNamesReturnsAlreadyLoadedClassesIfAppropriate(): void
120119
{
120+
self::assertTrue(class_exists(CmsUser::class), 'Pre-load the class');
121121
$annotationDriver = $this->loadDriverForCMSDocuments();
122122
$classes = $annotationDriver->getAllClassNames();
123123

tests/Doctrine/ODM/MongoDB/Tests/Mapping/PropertyAccessors/RawValuePropertyAccessorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use Doctrine\ODM\MongoDB\Mapping\PropertyAccessors\RawValuePropertyAccessor;
88
use Doctrine\ODM\MongoDB\Tests\BaseTestCase;
9-
use Documents\PropertyHooks\User;
9+
use Documents84\PropertyHooks\User;
1010
use PHPUnit\Framework\Attributes\RequiresPhp;
1111
use ReflectionObject;
1212

tests/Documents/PropertyHooks/MappingVirtualProperty.php renamed to tests/Documents84/PropertyHooks/MappingVirtualProperty.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php // phpcs:ignoreFile
22

3-
namespace Documents\PropertyHooks;
3+
namespace Documents84\PropertyHooks;
44

55
use Doctrine\ODM\MongoDB\Mapping\Annotations\Document;
66
use Doctrine\ODM\MongoDB\Mapping\Annotations\Field;

tests/Documents/PropertyHooks/User.php renamed to tests/Documents84/PropertyHooks/User.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php // phpcs:ignoreFile
22

3-
namespace Documents\PropertyHooks;
3+
namespace Documents84\PropertyHooks;
44

55
use Doctrine\ODM\MongoDB\Mapping\Annotations\Document;
66
use Doctrine\ODM\MongoDB\Mapping\Annotations\Field;

0 commit comments

Comments
 (0)