10 Commits

Author SHA1 Message Date
HypeMC
32c3794a26 [Console] Simplify using invokable commands when the component is used standalone 2025-06-09 17:40:54 +02:00
Alexandre Daubois
de74db6d7c Remove always true/false occurrences 2024-10-23 08:56:12 +02:00
Nicolas Grekas
3540f0686b Merge branch '5.4' into 6.3
* 5.4:
  Fix implicitly-required parameters
  List CS fix in .git-blame-ignore-revs
  Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_null_value
  [Messenger][AmazonSqs] Allow async-aws/sqs version 2
2024-01-23 15:35:58 +01:00
Nicolas Grekas
de9a8d9180 Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_null_value 2024-01-23 14:51:25 +01:00
Nicolas Grekas
38c5cec0b8 Fix return types 2021-09-09 14:56:10 +02:00
Nicolas Grekas
aaec152efd Merge branch '5.4' into 6.0
* 5.4:
  [DoctrineBridge] Remove dead code
  [Lock] Remove unused variable
  [DoctrineBridge] Replace string with FQCN resolution in EntityType
  Add missing `@return $this` annotations
  [Notifier] Add missing types to SmscTransport
2021-09-09 14:52:47 +02:00
Nicolas Grekas
e4ad988449 Add missing @return $this annotations 2021-09-09 10:06:01 +02:00
Alexander M. Turek
ce7d4dab6d [Console] Add types to private properties
Signed-off-by: Alexander M. Turek <me@derrabus.de>
2021-08-27 12:20:39 +02:00
Robin Chalas
9021842408 [Console] Allow disabling auto-exit for single command apps 2020-08-03 17:23:43 +02:00
Grégoire Pineau
61a4afd5f8 [Console] Add SingleCommandApplication to ease creation of Single Command Application
```
<?php

require __DIR__.'/vendor/autoload.php';

use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\SingleCommandApplication;

(new SingleCommandApplication())
    ->setName('My Super Command') // Optional
    ->setVersion('1.0.0') // Optional
    ->setProcessTitle('my_proc_title') // Optional
    ->addArgument('who', InputArgument::OPTIONAL, 'Who', 'World')  // Optional
    ->setCode(function(InputInterface $input, OutputInterface $output): int {
        $output->writeln(sprintf('Hello %s!', $input->getArgument('who')));

        return 0;
    })
    ->run()
;

```
2020-01-08 12:40:31 +01:00