我正在开发 Symfony 4 命令,当它完成时,我想返回成功或失败代码。
Here是文档。
它说:
// return this if there was no problem running the command
// (it's equivalent to returning int(0))
return Command::SUCCESS;
使用Symfony\Component\Console\Command\Command
。
我检查了该文件,没有 SUCCESS
常量。
我错过了什么吗?
最佳答案
对于 Symfony 4.4,您可以直接使用整数。
Symfony 5.1
return Command::SUCCESS;
Symfony 4.4
return 0;
Symfony 5.1
return Command::FAILURE;
Symfony 4.4
return 1;
关于symfony4 - Command 类中没有 SUCCESS 常量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64533737/