Skip to content

Commit 84c45e4

Browse files
committed
Make noise on DI compile failure
1 parent d3a8b3f commit 84c45e4

File tree

1 file changed

+8
-3
lines changed
  • setup/src/Magento/Setup/Module/Di/Compiler/Config

1 file changed

+8
-3
lines changed

setup/src/Magento/Setup/Module/Di/Compiler/Config/Reader.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,16 @@ public function generateCachePerScope(
118118
}
119119

120120
if (!$definitionsCollection->hasInstance($preference)) {
121-
// Removing this preference, because its class has been excluded intentionally.
122121
// See 'excludePatterns' in Magento\Setup\Module\Di\Code\Reader\ClassesScanner,
123122
// populated via Magento\Setup\Console\Command\DiCompileCommand
124-
// TODO: add logging here so developers get useful messaging.
125-
continue;
123+
throw new LocalizedException(new Phrase(
124+
'Preference declared for "%instanceName" as "%preference", but the latter'
125+
. ' has not been included in dependency injection compilation.',
126+
[
127+
'instanceName' => $instanceName,
128+
'preference' => $preference,
129+
]
130+
));
126131
}
127132

128133
$config['preferences'][$instanceName] = $preference;

0 commit comments

Comments
 (0)