Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc4d65b3

Browse files
committed
Rename to & restrict type
1 parenta098ff8 commitc4d65b3

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

‎src/Symfony/Component/Console/Command/Command.php‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -322,9 +322,9 @@ public function complete(CompletionInput $input, CompletionSuggestions $suggesti
322322
$definition =$this->getDefinition();
323323
$values =null;
324324
if (CompletionInput::TYPE_OPTION_VALUE ===$input->getCompletionType() &&$definition->hasOption($input->getCompletionName())) {
325-
$values =$definition->getOption($input->getCompletionName())->getValues();
325+
$values =$definition->getOption($input->getCompletionName())->getCompletionValues();
326326
}elseif (CompletionInput::TYPE_ARGUMENT_VALUE ===$input->getCompletionType() &&$definition->hasArgument($input->getCompletionName())) {
327-
$values =$definition->getArgument($input->getCompletionName())->getValues();
327+
$values =$definition->getArgument($input->getCompletionName())->getCompletionValues();
328328
}
329329
if (null ===$values) {
330330
return;
@@ -334,12 +334,12 @@ public function complete(CompletionInput $input, CompletionSuggestions $suggesti
334334
if (null ===$values) {
335335
return;
336336
}
337-
if (!is_iterable($values)) {
338-
thrownewLogicException(sprintf('Callable for "%s" "%s" must return aniterable or null. Got "%s".',$input->getCompletionType(),$input->getCompletionName(),get_debug_type($values)));
337+
if (!\is_array($values)) {
338+
thrownewLogicException(sprintf('Closure for "%s" "%s" must return anarray or null. Got "%s".',$input->getCompletionType(),$input->getCompletionName(),get_debug_type($values)));
339339
}
340340
}
341341

342-
$suggestions->suggestValues(\is_array($values) ?$values :iterator_to_array($values));
342+
$suggestions->suggestValues($values);
343343
}
344344

345345
/**
@@ -472,8 +472,8 @@ public function addArgument(string $name, int $mode = null, string $description
472472
*/
473473
publicfunctionsetArgumentValues(string$name,\Closure|iterable|null$values):static
474474
{
475-
$this->definition->getArgument($name)->setValues($values);
476-
$this->fullDefinition?->getArgument($name)->setValues($values);
475+
$this->definition->getArgument($name)->setCompletionValues($values);
476+
$this->fullDefinition?->getArgument($name)->setCompletionValues($values);
477477

478478
return$this;
479479
}

‎src/Symfony/Component/Console/Input/InputArgument.php‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class InputArgument
2828
privatestring$name;
2929
privateint$mode;
3030
privatestring|int|bool|array|null|float$default;
31-
private\Closure|iterable|null$values;
31+
privatearray|\Closure|null$completionValues;
3232
privatestring$description;
3333

3434
/**
@@ -39,7 +39,7 @@ class InputArgument
3939
*
4040
* @throws InvalidArgumentException When argument mode is not valid
4141
*/
42-
publicfunction__construct(string$name,int$mode =null,string$description ='',string|bool|int|float|array$default =null,\Closure|iterable|null$values =null)
42+
publicfunction__construct(string$name,int$mode =null,string$description ='',string|bool|int|float|array$default =null,\Closure|array$completionValues =null)
4343
{
4444
if (null ===$mode) {
4545
$mode =self::OPTIONAL;
@@ -52,7 +52,7 @@ public function __construct(string $name, int $mode = null, string $description
5252
$this->description =$description;
5353

5454
$this->setDefault($default);
55-
$this->setValues($values);
55+
$this->setCompletionValues($completionValues);
5656
}
5757

5858
/**
@@ -113,17 +113,17 @@ public function getDefault(): string|bool|int|float|array|null
113113
return$this->default;
114114
}
115115

116-
publicfunctionsetValues(\Closure|iterable|null$values =null)
116+
publicfunctionsetCompletionValues(array|\Closure$completionValues =null)
117117
{
118-
$this->values =$values;
118+
$this->completionValues =$completionValues;
119119
}
120120

121121
/**
122-
* Returnssuggestion values for input completion.
122+
* Returnssuggestions for input completion.
123123
*/
124-
publicfunctiongetValues():\Closure|iterable|null
124+
publicfunctiongetCompletionValues():array|\Closure|null
125125
{
126-
return$this->values;
126+
return$this->completionValues;
127127
}
128128

129129
/**

‎src/Symfony/Component/Console/Input/InputOption.php‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class InputOption
5050
privatestring|array|null$shortcut;
5151
privateint$mode;
5252
privatestring|int|bool|array|null|float$default;
53-
private\Closure|iterable|null$values;
53+
private\Closure|iterable|null$completionValues;
5454
privatestring$description;
5555

5656
/**
@@ -60,7 +60,7 @@ class InputOption
6060
*
6161
* @throws InvalidArgumentException If option mode is invalid or incompatible
6262
*/
63-
publicfunction__construct(string$name,string|array$shortcut =null,int$mode =null,string$description ='',string|bool|int|float|array$default =null,\Closure|iterable|null$values =null)
63+
publicfunction__construct(string$name,string|array$shortcut =null,int$mode =null,string$description ='',string|bool|int|float|array$default =null,array|\Closure$completionValues =null)
6464
{
6565
if (str_starts_with($name,'--')) {
6666
$name =substr($name,2);
@@ -106,7 +106,7 @@ public function __construct(string $name, string|array $shortcut = null, int $mo
106106
}
107107

108108
$this->setDefault($default);
109-
$this->setValues($values);
109+
$this->setCompletionValues($completionValues);
110110
}
111111

112112
/**
@@ -195,21 +195,21 @@ public function getDefault(): string|bool|int|float|array|null
195195
return$this->default;
196196
}
197197

198-
publicfunctionsetValues(\Closure|iterable|null$values =null)
198+
publicfunctionsetCompletionValues(array|\Closure$completionValues =null):void
199199
{
200-
if (self::VALUE_NONE === (self::VALUE_NONE &$this->mode) &&null !==$values) {
200+
if (self::VALUE_NONE === (self::VALUE_NONE &$this->mode) &&null !==$completionValues) {
201201
thrownewLogicException('Cannot set a completion when using InputOption::VALUE_NONE mode.');
202202
}
203203

204-
$this->values =$values;
204+
$this->completionValues =$completionValues;
205205
}
206206

207207
/**
208208
* Returns suggestions for input completion.
209209
*/
210-
publicfunctiongetValues():\Closure|iterable|null
210+
publicfunctiongetCompletionValues():array|\Closure|null
211211
{
212-
return$this->values;
212+
return$this->completionValues;
213213
}
214214

215215
/**

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp