CachedBundleDependenciesResolver.php
protected function cacheBuiltBundleStack(
        array $bundleStack,
        string $cacheFile
    ) {
        foreach ($bundleStack as $bundle) {
            if (is_object($bundle)) {
                $kernelNamespace = get_class($this);
                $bundleNamespace = get_class($bundle);
                throw new BundleStackNotCacheableException(
                    $kernelNamespace,
                    $bundleNamespace
                );
            }
        }

        file_put_contents(
            $cacheFile,
            '<?php return ' . var_export($bundleStack, true) . ';'
        );
    }
protected function cacheBuiltBundleStack(
        array $bundleStack,
        string $cacheFile
    ) {
        foreach ($bundleStack as $bundle) {
            if (is_object($bundle)) {
                $kernelNamespace = get_class($this);
                $bundleNamespace = get_class($bundle);
                throw new BundleStackNotCacheableException(
                    $kernelNamespace,
                    $bundleNamespace
                );
            }
        }

        file_put_contents(
            $cacheFile,
            '<?php return ' . var_export($bundleStack, true) . ';'
        );
    }
protected function cacheBuiltBundleStack ( array $ bundleStack , string $ cacheFile ) { foreach ( $ bundleStack as $ bundle ) { if ( is_object ( $ bundle ) ) { $ kernelNamespace = get_class ( $ this ) ; $ bundleNamespace = get_class ( $ bundle ) ; throw new BundleStackNotCacheableException ( $ kernelNamespace , $ bundleNamespace ) ; } } file_put_contents ( $ cacheFile , '<?php return ' . var_export ( $ bundleStack , true ) . ';' ) ; }
Cache the built bundles stack.
Only bundles stack with string definitions are allowed to be cached.
Otherwise, will throw an exception.

@param Bundle[]|string[] $bundleStack
@param string            $cacheFile

@throws BundleStackNotCacheableException Bundles not cacheable
Cache the built bundles stack . Only bundles stack with string definitions are allowed to be cached . Otherwise will throw an exception .