-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removed code references to Symfony Standard Distribution #3427
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,7 @@ Creating a basic Command | |
To make a console command that greets you from the command line, create ``GreetCommand.php`` | ||
and add the following to it:: | ||
|
||
namespace Acme\DemoBundle\Command; | ||
namespace Acme\Command; | ||
|
||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
|
@@ -86,9 +86,9 @@ an ``Application`` and adds commands to it:: | |
|
||
#!/usr/bin/env php | ||
<?php | ||
// app/console | ||
// application.php | ||
|
||
use Acme\DemoBundle\Command\GreetCommand; | ||
use Acme\Command\GreetCommand; | ||
use Symfony\Component\Console\Application; | ||
|
||
$application = new Application(); | ||
|
@@ -99,7 +99,7 @@ Test the new console command by running the following | |
|
||
.. code-block:: bash | ||
|
||
$ app/console demo:greet Fabien | ||
$ php application.php demo:greet Fabien | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Windows does not support the shebang, so you have to generate a bat file for that (or Composer does it for you). To make this example simple, I suggest doing it this way. |
||
|
||
This will print the following to the command line: | ||
|
||
|
@@ -111,7 +111,7 @@ You can also use the ``--yell`` option to make everything uppercase: | |
|
||
.. code-block:: bash | ||
|
||
$ app/console demo:greet Fabien --yell | ||
$ php application.php demo:greet Fabien --yell | ||
|
||
This prints:: | ||
|
||
|
@@ -232,8 +232,8 @@ The command can now be used in either of the following ways: | |
|
||
.. code-block:: bash | ||
|
||
$ app/console demo:greet Fabien | ||
$ app/console demo:greet Fabien Potencier | ||
$ php application.php demo:greet Fabien | ||
$ php application.php demo:greet Fabien Potencier | ||
|
||
It is also possible to let an argument take a list of values (imagine you want | ||
to greet all your friends). For this it must be specified at the end of the | ||
|
@@ -251,7 +251,7 @@ To use this, just specify as many names as you want: | |
|
||
.. code-block:: bash | ||
|
||
$ app/console demo:greet Fabien Ryan Bernhard | ||
$ php application.php demo:greet Fabien Ryan Bernhard | ||
|
||
You can access the ``names`` argument as an array:: | ||
|
||
|
@@ -321,8 +321,8 @@ flag: | |
|
||
.. code-block:: bash | ||
|
||
$ app/console demo:greet Fabien | ||
$ app/console demo:greet Fabien --iterations=5 | ||
$ php application.php demo:greet Fabien | ||
$ php application.php demo:greet Fabien --iterations=5 | ||
|
||
The first example will only print once, since ``iterations`` is empty and | ||
defaults to ``1`` (the last argument of ``addOption``). The second example | ||
|
@@ -333,8 +333,8 @@ will work: | |
|
||
.. code-block:: bash | ||
|
||
$ app/console demo:greet Fabien --iterations=5 --yell | ||
$ app/console demo:greet Fabien --yell --iterations=5 | ||
$ php application.php demo:greet Fabien --iterations=5 --yell | ||
$ php application.php demo:greet Fabien --yell --iterations=5 | ||
|
||
There are 4 option variants you can use: | ||
|
||
|
@@ -380,9 +380,9 @@ useful one is the :class:`Symfony\\Component\\Console\\Tester\\CommandTester` | |
class. It uses special input and output classes to ease testing without a real | ||
console:: | ||
|
||
use Acme\Command\GreetCommand; | ||
use Symfony\Component\Console\Application; | ||
use Symfony\Component\Console\Tester\CommandTester; | ||
use Acme\DemoBundle\Command\GreetCommand; | ||
|
||
class ListCommandTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
|
@@ -409,9 +409,9 @@ You can test sending arguments and options to the command by passing them | |
as an array to the :method:`Symfony\\Component\\Console\\Tester\\CommandTester::execute` | ||
method:: | ||
|
||
use Acme\Command\GreetCommand; | ||
use Symfony\Component\Console\Application; | ||
use Symfony\Component\Console\Tester\CommandTester; | ||
use Acme\DemoBundle\Command\GreetCommand; | ||
|
||
class ListCommandTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
|
@@ -491,6 +491,7 @@ Learn More! | |
|
||
* :doc:`/components/console/usage` | ||
* :doc:`/components/console/single_command_tool` | ||
* :doc:`/components/console/events` | ||
|
||
.. _Packagist: https://packagist.org/packages/symfony/console | ||
.. _ANSICON: https://github.com/adoxa/ansicon/downloads |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,6 +66,7 @@ You can also simplify how you execute the application:: | |
#!/usr/bin/env php | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the reason behind moving this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@weaverryan: basically what @wouterj said above There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But does the presence of this hurt Windows? From what I know (and I suck at Windows :P), if we have this, then shebang is possible on Unix (but not on Windows). Without this, shebang is not possible on either system. So even though we're not using the shebang syntax in this entry, having this still makes shebang possible, which seems like a good thing. Thanks Daniel :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, it doesn't hurt with Windows. The only problem is that you can't execute the code on Windows. That's why I suggested removing the shebang and using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it does not hurt on Windows. PHP is smart enough to avoid sending it to the output. It simply means that Windows users either need to
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @wouterj I suggest keeping the shebang while still calling PHP explicitly in the doc There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with @stof. If using the If you all agree I will revert the changes of the shebang? /cc @wouterj @weaverryan There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. well, if everyone likes it: let's do it! |
||
<?php | ||
// command.php | ||
|
||
use Acme\Tool\MyApplication; | ||
|
||
$application = new MyApplication(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should remove this tag too, it breaks highlighting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!