diff --git a/app/etc/di.xml b/app/etc/di.xml
index 4689a852578db..bc544f971cdec 100644
--- a/app/etc/di.xml
+++ b/app/etc/di.xml
@@ -471,6 +471,7 @@
- primary
- global
+ Magento\Framework\App\State::PARAM_MODE
diff --git a/lib/internal/Magento/Framework/Interception/PluginListGenerator.php b/lib/internal/Magento/Framework/Interception/PluginListGenerator.php
index 0c77360162227..0153ee92a8062 100644
--- a/lib/internal/Magento/Framework/Interception/PluginListGenerator.php
+++ b/lib/internal/Magento/Framework/Interception/PluginListGenerator.php
@@ -1,15 +1,18 @@
reader = $reader;
- $this->scopeConfig = $scopeConfig;
- $this->omConfig = $omConfig;
- $this->relations = $relations;
- $this->definitions = $definitions;
- $this->classDefinitions = $classDefinitions;
- $this->logger = $logger;
- $this->directoryList = $directoryList;
- $this->scopePriorityScheme = $scopePriorityScheme;
}
/**
@@ -245,10 +185,8 @@ public function loadScopedVirtualTypes($scopePriorityScheme, $loadedScopes, $plu
/**
* Returns class definitions
- *
- * @return array
*/
- private function getClassDefinitions()
+ private function getClassDefinitions(): array
{
return $this->classDefinitions->getClasses();
}
@@ -256,11 +194,12 @@ private function getClassDefinitions()
/**
* Whether scope code is current scope code
*
- * @param string $scopeCode
+ * @param string|null $scopeCode
* @return bool
*/
- private function isCurrentScope($scopeCode)
+ private function isCurrentScope(?string $scopeCode): bool
{
+ // ToDo: $scopeCode can be null in integration tests because of how scope is reset.
return $this->scopeConfig->getCurrentScope() === $scopeCode;
}
@@ -366,9 +305,12 @@ public function trimInstanceStartingBackslash(&$plugins)
public function filterPlugins(array &$plugins)
{
foreach ($plugins as $name => $plugin) {
- if (empty($plugin['instance'])) {
+ if (!isset($plugin['instance'])) {
unset($plugins[$name]);
- $this->logger->info("Reference to undeclared plugin with name '{$name}'.");
+ // Log the undeclared plugin when it is not disabled or when the app is in Developer mode.
+ if ($this->appMode === State::MODE_DEVELOPER || !($plugin['disabled'] ?? false)) {
+ $this->logger->debug("Reference to undeclared plugin with name '{$name}'.");
+ }
}
}
}
@@ -401,26 +343,23 @@ public function merge(array $config, $pluginData)
*
* @param string $key
* @param array $config
- * @return void
- * @throws \Magento\Framework\Exception\FileSystemException
+ * @throws FileSystemException
*/
- private function writeConfig(string $key, array $config)
+ private function writeConfig(string $key, array $config): void
{
$this->initialize();
- $configuration = sprintf('directoryList->getPath(DirectoryList::GENERATED_METADATA) . '/' . $key . '.php',
- $configuration
+ sprintf('directoryList->getPath(DirectoryList::GENERATED_METADATA))) {
mkdir($this->directoryList->getPath(DirectoryList::GENERATED_METADATA));