webignition / symfony-console-typed-input
Symfony InputInterface providing type-specific getters for options and arguments
Installs: 1 828 629
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 1
Open Issues: 1
pkg:composer/webignition/symfony-console-typed-input
Requires
- php: ^8.3
- symfony/console: ^6
Requires (Dev)
- mockery/mockery: ^1.6
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.1
- phpstan/phpstan-mockery: ^2.0
- phpunit/phpunit: ^11
- squizlabs/php_codesniffer: ^4.0
This package is auto-updated.
Last update: 2025-11-04 17:33:18 UTC
README
A wrapper for Symfony\Component\Console\Input\InputInterface adding integer- and boolean-specific
argument and option getters.
For fans of strongly-typed PHP, or just those tired of battling with phpstan
--level max when analysing Symfony console commands.
Methods
public function getIntegerArgument(string $name): int; public function getIntegerOption(string $name): int; public function getBooleanArgument(string $name): bool; public function getBooleanOption(string $name): bool;
All other InputInterface method calls are proxied to the wrapped InputInterface instance.
Usage
use webignition\SymfonyConsole\TypedInput\TypedInput; // Assuming we're in a console command and $input is an InputInterface instance $typedInput = new TypedInput($input); // Guaranteed to return an integer $integerArgument = $typedInput->getIntegerArgument('integer-argument-name'); $integerOption = $typedInput->getIntegerOption('integer-option-name'); // Guaranteed to return a boolean $booleanArgument = $typedInput->getBooleanArgument('boolean-argument-name'); $booleanOption = $typedInput->getBooleanOption('boolean-option-name');