【发布时间】:2019-11-06 13:26:02
【问题描述】:
我将 Sympfony 控制台用作独立组件。
假设我有一个如下定义的命令:
class Box extends Command
{
public function __construct() {
// removed for simplicity of this example
}
protected function configure() {
// removed for simplicity of this example
}
protected function execute(InputInterface $input, OutputInterface $output) {
if (!$data=\file_get_contents($input->getOption('inputfile'))) { return false;}
// rest of code removed for simplicity of this example
}
}
显然使用return false; 很可能不正确那么正确的方法是什么,我似乎无法在文档中找到参考或示例?我能找到的最接近的东西是对ConsoleEvents::TERMINATE 的引用,但使用事件来实现我的目标似乎有点矫枉过正?
【问题讨论】:
-
只是返回,不需要我认为的布尔值
标签: php symfony symfony-console