Merge pull request #919 from mr-feek/unregister-custom-autoloader

fix: unregister meta command custom autoloader when it is no longer needed
This commit is contained in:
Barry vd. Heuvel
2020-04-20 18:22:59 +02:00
committed by GitHub
+12
View File
@@ -103,6 +103,8 @@ class MetaCommand extends Command
} }
} }
$this->unregisterClassAutoloadExceptions();
$content = $this->view->make('meta', [ $content = $this->view->make('meta', [
'bindings' => $bindings, 'bindings' => $bindings,
'methods' => $this->methods, 'methods' => $this->methods,
@@ -159,4 +161,14 @@ class MetaCommand extends Command
array('filename', 'F', InputOption::VALUE_OPTIONAL, 'The path to the meta file', $filename), array('filename', 'F', InputOption::VALUE_OPTIONAL, 'The path to the meta file', $filename),
); );
} }
/**
* Remove our custom autoloader that we pushed onto the autoload stack
*/
private function unregisterClassAutoloadExceptions()
{
$autoloadFunctions = spl_autoload_functions();
$ourAutoloader = array_pop($autoloadFunctions);
spl_autoload_unregister($ourAutoloader);
}
} }