2024-05-06 20:40:05 +00:00
|
|
|
---
|
2024-10-29 18:27:12 +00:00
|
|
|
date: 2020-11-16
|
2024-05-06 20:40:05 +00:00
|
|
|
id: d12ff13e-e12d-4bf3-86d3-eef661e4dc1d
|
|
|
|
title: "Command::ERROR"
|
|
|
|
---
|
|
|
|
|
|
|
|
# Description
|
|
|
|
|
|
|
|
ERROR constant to be used as command exit code
|
|
|
|
|
|
|
|
# Syntax
|
|
|
|
|
|
|
|
``` php
|
|
|
|
// src/Command/CreateUserCommand.php
|
|
|
|
namespace App\Command;
|
|
|
|
|
|
|
|
use Symfony\Component\Console\Command\Command;
|
|
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
|
|
|
|
class CreateUserCommand extends Command
|
|
|
|
{
|
|
|
|
protected static $defaultName = 'app:create-user';
|
|
|
|
|
|
|
|
// ...
|
|
|
|
|
|
|
|
protected function execute(InputInterface $input, OutputInterface $output)
|
|
|
|
{
|
|
|
|
// ...
|
|
|
|
|
|
|
|
// Before
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
// After
|
|
|
|
return Command::ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|