BundleDependenciesResolver.php
private function resolveBundleDependencies(
        KernelInterface $kernel,
        array &$bundleStack,
        array &$visitedBundles,
        array $bundles
    ) {
        $bundles = array_reverse($bundles);

        foreach ($bundles as $bundle) {
            /*
             * Each visited node is prioritized and placed at the beginning.
             */
            $this
                ->prioritizeBundle(
                    $bundleStack,
                    $bundle
                );
        }

        foreach ($bundles as $bundle) {
            $bundleNamespace = $this->getBundleDefinitionNamespace($bundle);
            /*
             * If have already visited this bundle, continue. One bundle can be
             * processed once.
             */
            if (isset($visitedBundles[$bundleNamespace])) {
                continue;
            }

            $visitedBundles[$bundleNamespace] = true;
            $bundleNamespaceObj = new \ReflectionClass($bundleNamespace);
            if ($bundleNamespaceObj->implementsInterface(DependentBundleInterface::class)) {
                /**
                 * @var DependentBundleInterface
                 */
                $bundleDependencies = $bundleNamespace::getBundleDependencies($kernel);

                $this->resolveBundleDependencies(
                    $kernel,
                    $bundleStack,
                    $visitedBundles,
                    $bundleDependencies
                );
            }
        }
    }
private function resolveBundleDependencies(
        KernelInterface $kernel,
        array &$bundleStack,
        array &$visitedBundles,
        array $bundles
    ) {
        $bundles = array_reverse($bundles);

        foreach ($bundles as $bundle) {
            /*
             * Each visited node is prioritized and placed at the beginning.
             */
            $this
                ->prioritizeBundle(
                    $bundleStack,
                    $bundle
                );
        }

        foreach ($bundles as $bundle) {
            $bundleNamespace = $this->getBundleDefinitionNamespace($bundle);
            /*
             * If have already visited this bundle, continue. One bundle can be
             * processed once.
             */
            if (isset($visitedBundles[$bundleNamespace])) {
                continue;
            }

            $visitedBundles[$bundleNamespace] = true;
            $bundleNamespaceObj = new \ReflectionClass($bundleNamespace);
            if ($bundleNamespaceObj->implementsInterface(DependentBundleInterface::class)) {
                /**
                 * @var DependentBundleInterface
                 */
                $bundleDependencies = $bundleNamespace::getBundleDependencies($kernel);

                $this->resolveBundleDependencies(
                    $kernel,
                    $bundleStack,
                    $visitedBundles,
                    $bundleDependencies
                );
            }
        }
    }
private function resolveBundleDependencies ( KernelInterface $ kernel , array & $ bundleStack , array & $ visitedBundles , array $ bundles ) { $ bundles = array_reverse ( $ bundles ) ; foreach ( $ bundles as $ bundle ) { /*
             * Each visited node is prioritized and placed at the beginning.
             */ $ this -> prioritizeBundle ( $ bundleStack , $ bundle ) ; } foreach ( $ bundles as $ bundle ) { $ bundleNamespace = $ this -> getBundleDefinitionNamespace ( $ bundle ) ; /*
             * If have already visited this bundle, continue. One bundle can be
             * processed once.
             */ if ( isset ( $ visitedBundles [ $ bundleNamespace ] ) ) { continue ; } $ visitedBundles [ $ bundleNamespace ] = true ; $ bundleNamespaceObj = new \ ReflectionClass ( $ bundleNamespace ) ; if ( $ bundleNamespaceObj -> implementsInterface ( DependentBundleInterface :: class ) ) { /**
                 * @var DependentBundleInterface
                 */ $ bundleDependencies = $ bundleNamespace :: getBundleDependencies ( $ kernel ) ; $ this -> resolveBundleDependencies ( $ kernel , $ bundleStack , $ visitedBundles , $ bundleDependencies ) ; } } }
Resolve bundle dependencies.

Given a set of already loaded bundles and a set of new needed bundles,
build new dependencies and fill given array of loaded bundles.

@param KernelInterface $kernel
@param array           $bundleStack
@param array           $visitedBundles
@param array           $bundles
Resolve bundle dependencies .