Skip to content

Commit

Permalink
minor #30319 [Console] Doc Block: More intuitive usage example in Arr…
Browse files Browse the repository at this point in the history
…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 eb7a612
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Symfony/Component/Console/Input/ArrayInput.php
Expand Up @@ -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>
*/
Expand Down

0 comments on commit eb7a612

Please sign in to comment.