public function saveAsScript(string $filename): void
    {
        $config = clone $this;
        unset($config->i__loader);

        $export = str_replace('stdClass::__set_state', '(object)', var_export($config, true));
        $script = "<?php\nreturn $export;";

        $success = file_put_contents($filename, $script, str_contains($filename, ':') ? 0 : LOCK_EX);

        if ($success && function_exists('opcache_compile_file')) {
            // @codeCoverageIgnoreStart
            opcache_compile_file($filename);
            // @codeCoverageIgnoreEnd
        }
    }
public function saveAsScript(string $filename): void
    {
        $config = clone $this;
        unset($config->i__loader);

        $export = str_replace('stdClass::__set_state', '(object)', var_export($config, true));
        $script = "<?php\nreturn $export;";

        $success = file_put_contents($filename, $script, str_contains($filename, ':') ? 0 : LOCK_EX);

        if ($success && function_exists('opcache_compile_file')) {
            // @codeCoverageIgnoreStart
            opcache_compile_file($filename);
            // @codeCoverageIgnoreEnd
        }
    }
public function saveAsScript ( string $ filename ) : void { $ config = clone $ this ; unset ( $ config -> i__loader ) ; $ export = str_replace ( 'stdClass::__set_state' , '(object)' , var_export ( $ config , true ) ) ; $ script = "<?php\nreturn $export;" ; $ success = file_put_contents ( $ filename , $ script , str_contains ( $ filename , ':' ) ? 0 : LOCK_EX ) ; if ( $ success && function_exists ( 'opcache_compile_file' ) ) { // @codeCoverageIgnoreStart opcache_compile_file ( $ filename ) ; // @codeCoverageIgnoreEnd } }
Save configuration as PHP script.
This will speed up loading the configuration.

@param string $filename
@return void
Save configuration as PHP script . This will speed up loading the configuration .