mirror of
https://github.com/alrayyes/wiki.git
synced 2024-12-01 15:26:23 +00:00
38 lines
684 B
Markdown
38 lines
684 B
Markdown
|
---
|
||
|
id: 3986ef03-94bc-4a90-9f15-e8a3e6a69824
|
||
|
title: "Command::SUCCESS"
|
||
|
---
|
||
|
|
||
|
# Description
|
||
|
|
||
|
SUCCESS 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::SUCCESS;
|
||
|
}
|
||
|
}
|
||
|
```
|