Skip to content
Permalink
Browse files

minor #30319 [Console] Doc Block: More intuitive usage example in Arr…

…ayInput. (mattjanssen)

This PR was merged into the 3.4 branch.

Discussion
----------

[Console] Doc Block: More intuitive usage example in ArrayInput.

Make the ArrayInput doc block example more self-explanatory and less misleading. Show the common use case of having `command`, and replace the confusing `name` argument with something more arbitrary.

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

The current doc block example for `ArrayInput` seems to imply that the command name goes in as `name`, but this is actually just a random argument, named "name", in this case.
```php
new ArrayInput(['name' => 'foo', '--bar' => 'foobar']);
```

It might be more helpful to provide an example that works with Symfony's `Console` component out of the box, as that is a common use case:
```php
new ArrayInput(['command' => 'foo:bar', 'foo' => 'bar', '--bar' => 'foobar']);
```

Commits
-------

0c8d311 Update usage example in ArrayInput doc block.
  • Loading branch information...
fabpot committed Feb 21, 2019
2 parents a67441a + 0c8d311 commit eb7a612763c1dbc227e2a7178783dd6587c43841
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/Symfony/Component/Console/Input/ArrayInput.php
@@ -19,7 +19,7 @@
*
* Usage:
*
* $input = new ArrayInput(['name' => 'foo', '--bar' => 'foobar']);
* $input = new ArrayInput(['command' => 'foo:bar', 'foo' => 'bar', '--bar' => 'foobar']);
*
* @author Fabien Potencier <fabien@symfony.com>
*/

0 comments on commit eb7a612

Please sign in to comment.
You can’t perform that action at this time.