@@ -15,12 +15,13 @@ class DependencyChecker
15
15
/**
16
16
* @var PackageInfo
17
17
*/
18
- protected $ packageInfo ;
18
+ private $ packageInfo ;
19
19
20
20
/**
21
21
* @var ModuleList
22
22
*/
23
23
private $ list ;
24
+
24
25
/**
25
26
* @var ModuleList\Loader
26
27
*/
@@ -46,6 +47,7 @@ public function __construct(ModuleList $list, ModuleList\Loader $loader, Package
46
47
* @param string[] $toBeDisabledModules
47
48
* @param string[] $currentlyEnabledModules
48
49
* @return array
50
+ * @throws \Magento\Framework\Exception\LocalizedException
49
51
*/
50
52
public function checkDependenciesWhenDisableModules ($ toBeDisabledModules , $ currentlyEnabledModules = null )
51
53
{
@@ -61,8 +63,9 @@ public function checkDependenciesWhenDisableModules($toBeDisabledModules, $curre
61
63
* @param string[] $toBeEnabledModules
62
64
* @param string[] $currentlyEnabledModules
63
65
* @return array
66
+ * @throws \Magento\Framework\Exception\LocalizedException
64
67
*/
65
- public function checkDependenciesWhenEnableModules ($ toBeEnabledModules , $ currentlyEnabledModules = null )
68
+ public function checkDependenciesWhenEnableModules (array $ toBeEnabledModules , array $ currentlyEnabledModules = null )
66
69
{
67
70
$ masterList = $ currentlyEnabledModules ?? $ this ->list ->getNames ();
68
71
// assume enable succeeds: union of currently enabled modules and to-be-enabled modules
@@ -79,19 +82,19 @@ public function checkDependenciesWhenEnableModules($toBeEnabledModules, $current
79
82
* @return array
80
83
* @throws \Magento\Framework\Exception\LocalizedException
81
84
*/
82
- private function checkDependencyGraph ($ isEnable , $ moduleNames , $ enabledModules )
85
+ private function checkDependencyGraph (bool $ isEnable , array $ moduleNames , array $ enabledModules )
83
86
{
84
87
$ fullModuleList = $ this ->loader ->load ();
85
88
$ graph = $ this ->createGraph ($ fullModuleList );
86
89
$ dependenciesMissingAll = [];
87
90
$ graphMode = $ isEnable ? Graph::DIRECTIONAL : Graph::INVERSE ;
91
+ $ modules = array_merge (
92
+ array_keys ($ fullModuleList ),
93
+ $ this ->packageInfo ->getNonExistingDependencies ()
94
+ );
88
95
foreach ($ moduleNames as $ moduleName ) {
89
96
$ dependenciesMissing = [];
90
97
$ paths = $ graph ->findPathsToReachableNodes ($ moduleName , $ graphMode );
91
- $ modules = array_merge (
92
- array_keys ($ fullModuleList ),
93
- $ this ->packageInfo ->getNonExistingDependencies ()
94
- );
95
98
foreach ($ modules as $ module ) {
96
99
if (isset ($ paths [$ module ])) {
97
100
if ($ isEnable && !in_array ($ module , $ enabledModules )) {
@@ -112,7 +115,7 @@ private function checkDependencyGraph($isEnable, $moduleNames, $enabledModules)
112
115
* @param array $fullModuleList
113
116
* @return Graph
114
117
*/
115
- private function createGraph ($ fullModuleList )
118
+ private function createGraph (array $ fullModuleList ): Graph
116
119
{
117
120
$ nodes = [];
118
121
$ dependencies = [];
0 commit comments