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

Appearance settings

Commit cd8d4e6

Browse filesBrowse files
committed
bug #23345 [Console] fix description of INF default values (xabbuh)
This PR was merged into the 2.7 branch. Discussion ---------- [Console] fix description of INF default values | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #23267 | License | MIT | Doc PR | Commits ------- d8ba440 [Console] fix description of INF default values
2 parents 7acc345 + d8ba440 commit cd8d4e6
Copy full SHA for cd8d4e6

11 files changed

+56
-2
lines changed

‎src/Symfony/Component/Console/Descriptor/JsonDescriptor.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Descriptor/JsonDescriptor.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ private function getInputArgumentData(InputArgument $argument)
103103
'is_required' => $argument->isRequired(),
104104
'is_array' => $argument->isArray(),
105105
'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()),
106-
'default' => $argument->getDefault(),
106+
'default' => INF === $argument->getDefault() ? 'INF' : $argument->getDefault(),
107107
);
108108
}
109109

@@ -121,7 +121,7 @@ private function getInputOptionData(InputOption $option)
121121
'is_value_required' => $option->isValueRequired(),
122122
'is_multiple' => $option->isArray(),
123123
'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
124-
'default' => $option->getDefault(),
124+
'default' => INF === $option->getDefault() ? 'INF' : $option->getDefault(),
125125
);
126126
}
127127

‎src/Symfony/Component/Console/Descriptor/TextDescriptor.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Descriptor/TextDescriptor.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,10 @@ private function writeText($content, array $options = array())
237237
*/
238238
private function formatDefaultValue($default)
239239
{
240+
if (INF === $default) {
241+
return 'INF';
242+
}
243+
240244
if (is_string($default)) {
241245
$default = OutputFormatter::escape($default);
242246
} elseif (is_array($default)) {

‎src/Symfony/Component/Console/Tests/Descriptor/ObjectsProvider.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/Descriptor/ObjectsProvider.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public static function getInputArguments()
3232
'input_argument_3' => new InputArgument('argument_name', InputArgument::OPTIONAL, 'argument description', 'default_value'),
3333
'input_argument_4' => new InputArgument('argument_name', InputArgument::REQUIRED, "multiline\nargument description"),
3434
'input_argument_with_style' => new InputArgument('argument_name', InputArgument::OPTIONAL, 'argument description', '<comment>style</>'),
35+
'input_argument_with_default_inf_value' => new InputArgument('argument_name', InputArgument::OPTIONAL, 'argument description', INF),
3536
);
3637
}
3738

@@ -46,6 +47,7 @@ public static function getInputOptions()
4647
'input_option_6' => new InputOption('option_name', array('o', 'O'), InputOption::VALUE_REQUIRED, 'option with multiple shortcuts'),
4748
'input_option_with_style' => new InputOption('option_name', 'o', InputOption::VALUE_REQUIRED, 'option description', '<comment>style</>'),
4849
'input_option_with_style_array' => new InputOption('option_name', 'o', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'option description', array('<comment>Hello</comment>', '<info>world</info>')),
50+
'input_option_with_default_inf_value' => new InputOption('option_name', 'o', InputOption::VALUE_OPTIONAL, 'option description', INF),
4951
);
5052
}
5153

+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "argument_name",
3+
"is_required": false,
4+
"is_array": false,
5+
"description": "argument description",
6+
"default": "INF"
7+
}
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
**argument_name:**
2+
3+
* Name: argument_name
4+
* Is required: no
5+
* Is array: no
6+
* Description: argument description
7+
* Default: `INF`
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<info>argument_name</info> argument description<comment> [default: INF]</comment>
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<argument name="argument_name" is_required="0" is_array="0">
3+
<description>argument description</description>
4+
<defaults>
5+
<default>INF</default>
6+
</defaults>
7+
</argument>
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "--option_name",
3+
"shortcut": "-o",
4+
"accept_value": true,
5+
"is_value_required": false,
6+
"is_multiple": false,
7+
"description": "option description",
8+
"default": "INF"
9+
}
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
**option_name:**
2+
3+
* Name: `--option_name`
4+
* Shortcut: `-o`
5+
* Accept value: yes
6+
* Is value required: no
7+
* Is multiple: no
8+
* Description: option description
9+
* Default: `INF`
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<info>-o, --option_name[=OPTION_NAME]</info> option description<comment> [default: INF]</comment>
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<option name="--option_name" shortcut="-o" accept_value="1" is_value_required="0" is_multiple="0">
3+
<description>option description</description>
4+
<defaults>
5+
<default>INF</default>
6+
</defaults>
7+
</option>

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.