Use annotations and autoconfiguration
Use the `AsCommand` annotation to automatically register commands as services and automatically add them to `./bin/console` instead of adding them manually.
This commit is contained in:
parent
bfc9a89842
commit
4ebfd9333a
17 changed files with 78 additions and 81 deletions
36
autoload_runtime.template
Normal file
36
autoload_runtime.template
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
// autoload_runtime.php @generated by Symfony Runtime
|
||||
|
||||
if (true === (require_once __DIR__.'/autoload.php') || empty($_SERVER['SCRIPT_FILENAME'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$pharPath = Phar::running();
|
||||
|
||||
if (strlen($pharPath) == 0) {
|
||||
$scriptFileName = $_SERVER['SCRIPT_FILENAME'];
|
||||
} else {
|
||||
$scriptFileName = $_SERVER['APP_SCRIPT_FILENAME'] ?? $_SERVER['SCRIPT_FILENAME'] ?? null;
|
||||
}
|
||||
|
||||
$app = require $scriptFileName;
|
||||
|
||||
if (!is_object($app)) {
|
||||
throw new TypeError(sprintf('Invalid return value: callable object expected, "%s" returned from "%s".', get_debug_type($app), $_SERVER['SCRIPT_FILENAME']));
|
||||
}
|
||||
|
||||
$runtime = $_SERVER['APP_RUNTIME'] ?? $_ENV['APP_RUNTIME'] ?? %runtime_class%;
|
||||
$runtime = new $runtime(($_SERVER['APP_RUNTIME_OPTIONS'] ?? $_ENV['APP_RUNTIME_OPTIONS'] ?? []) + %runtime_options%);
|
||||
|
||||
[$app, $args] = $runtime
|
||||
->getResolver($app)
|
||||
->resolve();
|
||||
|
||||
$app = $app(...$args);
|
||||
|
||||
exit(
|
||||
$runtime
|
||||
->getRunner($app)
|
||||
->run()
|
||||
);
|
Reference in a new issue