@@ -211,29 +211,32 @@ private function isAreaCompatible(string $sourceArea, string $targetArea): bool
211211 *
212212 * @param string $compatModuleName
213213 * @return string|null
214+ * @phpcs:disable Magento2.PHP.LiteralNamespaces.LiteralClassUsage
214215 */
215216 private function getOriginalModuleFromCompatRegistry (string $ compatModuleName ): ?string
216217 {
218+ $ registryClass = 'Hyva\CompatModuleFallback\Model\CompatModuleRegistry ' ;
219+ //phpcs:enable
220+
217221 // 1. Try Registry (via Emulated Area)
218- if (!class_exists (\ Hyva \ CompatModuleFallback \ Model \CompatModuleRegistry::class )) {
222+ if (!class_exists ($ registryClass )) {
219223 return $ this ->parseCompatModuleXml ($ compatModuleName );
220224 }
221225
222226 try {
223227 // Emulate frontend area to load proper DI configuration for CompatModuleRegistry
224228 // as CLI commands run in global scope where frontend/di.xml is ignored.
225- /** @var \Hyva\CompatModuleFallback\Model\CompatModuleRegistry|null $registry */
229+ /** @var mixed| \Hyva\CompatModuleFallback\Model\CompatModuleRegistry|null $registry */
226230 $ registry = $ this ->appState ->emulateAreaCode (
227231 Area::AREA_FRONTEND ,
228- function () {
232+ function () use ( $ registryClass ) {
229233 // Use create() to ensure we get a fresh instance with the emulated configuration.
230234 // get() might return a cached instance from global scope (empty).
231- return $ this ->objectManager ->create (\ Hyva \ CompatModuleFallback \ Model \CompatModuleRegistry::class );
235+ return $ this ->objectManager ->create ($ registryClass );
232236 }
233237 );
234238
235239 if ($ registry ) {
236- /** @var \Hyva\CompatModuleFallback\Model\CompatModuleRegistry $registry */
237240 return $ this ->findOriginalModuleInRegistry ($ registry , $ compatModuleName );
238241 }
239242 } catch (\Throwable $ e ) {
@@ -248,7 +251,7 @@ function () {
248251 /**
249252 * Find original module in registry
250253 *
251- * @param \ Hyva\CompatModuleFallback\Model\CompatModuleRegistry $registry
254+ * @param mixed $registry Hyva\CompatModuleFallback\Model\CompatModuleRegistry
252255 * @param string $compatModuleName
253256 * @return string|null
254257 */
@@ -366,6 +369,8 @@ private function parseDiFileForCompatModule(string $diPath, string $moduleName):
366369 }
367370
368371 /**
372+ * Find original module in XML items
373+ *
369374 * @param \DOMNodeList<\DOMNode> $items
370375 * @param \DOMXPath $xpath
371376 * @param string $moduleName
0 commit comments