From c7e01ca89c100eca95abc6f939f88172e974bdb2 Mon Sep 17 00:00:00 2001 From: Michael Babker Date: Tue, 25 Jun 2024 10:05:59 -0400 Subject: [PATCH] Restructure the SqlWalkerCompat trait to fix optimized autoloading --- CHANGELOG.md | 2 ++ src/Tool/ORM/Walker/SqlWalkerCompat.php | 26 ++++++++++++++++--- .../{orm-2.php => SqlWalkerCompatForOrm2.php} | 2 +- .../{orm-3.php => SqlWalkerCompatForOrm3.php} | 2 +- 4 files changed, 26 insertions(+), 6 deletions(-) rename src/Tool/ORM/Walker/{orm-2.php => SqlWalkerCompatForOrm2.php} (99%) rename src/Tool/ORM/Walker/{orm-3.php => SqlWalkerCompatForOrm3.php} (99%) diff --git a/CHANGELOG.md b/CHANGELOG.md index f924644f5e..f6b0930b0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ a release. --- ## [Unreleased] +### Fixed +- Restructure the SqlWalkerCompat trait to fix optimized autoloading ## [3.16.0] ### Added diff --git a/src/Tool/ORM/Walker/SqlWalkerCompat.php b/src/Tool/ORM/Walker/SqlWalkerCompat.php index 5dceefc019..24721d729a 100644 --- a/src/Tool/ORM/Walker/SqlWalkerCompat.php +++ b/src/Tool/ORM/Walker/SqlWalkerCompat.php @@ -12,9 +12,27 @@ use Doctrine\ORM\Query\SqlWalker; if ((new \ReflectionClass(SqlWalker::class))->getMethod('getExecutor')->hasReturnType()) { - // ORM 3.x - require_once __DIR__.'/orm-3.php'; + /** + * Helper trait to address compatibility issues between ORM 2.x and 3.x. + * + * @mixin SqlWalker + * + * @internal + */ + trait SqlWalkerCompat + { + use SqlWalkerCompatForOrm3; + } } else { - // ORM 2.x - require_once __DIR__.'/orm-2.php'; + /** + * Helper trait to address compatibility issues between ORM 2.x and 3.x. + * + * @mixin SqlWalker + * + * @internal + */ + trait SqlWalkerCompat + { + use SqlWalkerCompatForOrm2; + } } diff --git a/src/Tool/ORM/Walker/orm-2.php b/src/Tool/ORM/Walker/SqlWalkerCompatForOrm2.php similarity index 99% rename from src/Tool/ORM/Walker/orm-2.php rename to src/Tool/ORM/Walker/SqlWalkerCompatForOrm2.php index d8fd670790..e810c749be 100644 --- a/src/Tool/ORM/Walker/orm-2.php +++ b/src/Tool/ORM/Walker/SqlWalkerCompatForOrm2.php @@ -30,7 +30,7 @@ * * @internal */ -trait SqlWalkerCompat +trait SqlWalkerCompatForOrm2 { /** * Gets an executor that can be used to execute the result of this walker. diff --git a/src/Tool/ORM/Walker/orm-3.php b/src/Tool/ORM/Walker/SqlWalkerCompatForOrm3.php similarity index 99% rename from src/Tool/ORM/Walker/orm-3.php rename to src/Tool/ORM/Walker/SqlWalkerCompatForOrm3.php index 380d64ff5a..bb7b8289a9 100644 --- a/src/Tool/ORM/Walker/orm-3.php +++ b/src/Tool/ORM/Walker/SqlWalkerCompatForOrm3.php @@ -32,7 +32,7 @@ * * @internal */ -trait SqlWalkerCompat +trait SqlWalkerCompatForOrm3 { /** * Gets an executor that can be used to execute the result of this walker.