From ad15a4dd77307028e1c24d7881ff47eda4c299c4 Mon Sep 17 00:00:00 2001 From: W0rma Date: Tue, 28 Oct 2025 09:00:44 +0100 Subject: [PATCH 1/2] Enable native lazy objects whenever possible. The LazyGhostTrait will be removed from symfony/var-exporter:8. --- .../unit/Codeception/Module/Doctrine2Test.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/unit/Codeception/Module/Doctrine2Test.php b/tests/unit/Codeception/Module/Doctrine2Test.php index ad09560..2bc9ccb 100644 --- a/tests/unit/Codeception/Module/Doctrine2Test.php +++ b/tests/unit/Codeception/Module/Doctrine2Test.php @@ -81,18 +81,18 @@ protected function _setUp() $connection = DriverManager::getConnection(['driver' => $sqliteDriver, 'memory' => true]); if (version_compare(InstalledVersions::getVersion('doctrine/orm'), '3', '>=')) { - $this->em = new EntityManager( - $connection, - ORMSetup::createAttributeMetadataConfiguration([$dir], true) - ); + $configuration = ORMSetup::createAttributeMetadataConfiguration([$dir], true); } else { - $this->em = new EntityManager( - $connection, - // @phpstan-ignore-next-line - ORMSetup::createAnnotationMetadataConfiguration([$dir], true) - ); + // @phpstan-ignore-next-line + $configuration = ORMSetup::createAnnotationMetadataConfiguration([$dir], true); } + if (PHP_VERSION_ID >= 80400 && method_exists($configuration, 'enableNativeLazyObjects')) { + $configuration->enableNativeLazyObjects(true); + } + + $this->em = new EntityManager($connection, $configuration); + (new SchemaTool($this->em))->createSchema([ $this->em->getClassMetadata(CompositePrimaryKeyEntity::class), $this->em->getClassMetadata(PlainEntity::class), From 3e6d1d7f13b2ca619342a8a908755c530c241236 Mon Sep 17 00:00:00 2001 From: W0rma Date: Tue, 28 Oct 2025 08:51:42 +0100 Subject: [PATCH 2/2] Fix usage of deprecated phpstan config option --- phpstan.neon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpstan.neon b/phpstan.neon index 1805e37..f0dad3e 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -8,7 +8,6 @@ parameters: - tests/data/doctrine_fixtures/TestFixture1.php - tests/data/doctrine_fixtures/TestFixture2.php - tests/_support/UnitTester.php - checkMissingIterableValueType: false reportUnmatchedIgnoredErrors: true ignoreErrors: - path: tests/ @@ -21,3 +20,4 @@ parameters: message: '#Method \S+ has no return type specified#' - path: tests/ message: '#(?:Method|Property) .+ with generic (?:interface|class) \S+ does not specify its types#' + - identifier: missingType.iterableValue