Option
in package
Attributes
- #[Attribute]
- \Attribute::TARGET_PARAMETER | \Attribute::TARGET_PROPERTY
Table of Contents
Constants
- ALLOWED_TYPES = ['string', 'bool', 'int', 'float', 'array']
- ALLOWED_UNION_TYPES = ['bool|string', 'bool|int', 'bool|float']
Properties
- $description : string
- $name : string
- $shortcut : array<string|int, mixed>|string|null
- $allowNull : bool
- $default : string|bool|int|float|array<string|int, mixed>|null
- $memberName : string
- $mode : int|null
- $sourceName : string
- $suggestedValues : array<string|int, mixed>|Closure
- $typeName : string|BackedEnum>
Methods
- __construct() : mixed
- Represents a console command --option definition.
- handleUnion() : self
Constants
ALLOWED_TYPES
private
mixed
ALLOWED_TYPES
= ['string', 'bool', 'int', 'float', 'array']
ALLOWED_UNION_TYPES
private
mixed
ALLOWED_UNION_TYPES
= ['bool|string', 'bool|int', 'bool|float']
Properties
$description
public
string
$description
= ''
$name
public
string
$name
= ''
$shortcut
public
array<string|int, mixed>|string|null
$shortcut
= null
$allowNull
private
bool
$allowNull
= false
$default
private
string|bool|int|float|array<string|int, mixed>|null
$default
= null
$memberName
private
string
$memberName
= ''
$mode
private
int|null
$mode
= null
$sourceName
private
string
$sourceName
= ''
$suggestedValues
private
array<string|int, mixed>|Closure
$suggestedValues
$typeName
private
string|BackedEnum>
$typeName
= ''
Methods
__construct()
Represents a console command --option definition.
public
__construct([string $description = '' ][, string $name = '' ][, array<string|int, mixed>|string|null $shortcut = null ][, array<string|int, string|Suggestion>|callable(CompletionInput): array<int, string|Suggestion> $suggestedValues = [] ]) : mixed
If unset, the name value will be inferred from the parameter definition.
Parameters
- $description : string = ''
- $name : string = ''
- $shortcut : array<string|int, mixed>|string|null = null
-
The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
- $suggestedValues : array<string|int, string|Suggestion>|callable(CompletionInput): array<int, string|Suggestion> = []
-
The values used for input completion
handleUnion()
private
handleUnion(ReflectionUnionType $type) : self
Parameters
- $type : ReflectionUnionType