mirror of
https://github.com/symfony/console.git
synced 2026-03-24 09:22:12 +01:00
36 lines
999 B
PHP
36 lines
999 B
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of the Symfony package.
|
|
*
|
|
* (c) Fabien Potencier <fabien@symfony.com>
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Symfony\Component\Console\Tests\Fixtures;
|
|
|
|
use Symfony\Component\Console\Attribute\Argument;
|
|
use Symfony\Component\Console\Attribute\AsCommand;
|
|
use Symfony\Component\Console\Attribute\Ask;
|
|
use Symfony\Component\Console\Command\Command;
|
|
use Symfony\Component\Console\Input\File\InputFile;
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
#[AsCommand(name: 'app:input-file')]
|
|
class InvokableWithInputFileTestCommand
|
|
{
|
|
public function __invoke(
|
|
OutputInterface $output,
|
|
#[Argument]
|
|
#[Ask('Provide a file:')]
|
|
InputFile $file,
|
|
): int {
|
|
$output->writeln('Filename: '.$file->getFilename());
|
|
$output->writeln('Valid: '.($file->isValid() ? 'yes' : 'no'));
|
|
|
|
return Command::SUCCESS;
|
|
}
|
|
}
|