forked from https://github.com/symfony/symfony
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Console] Explicitly passed options without value (or empty) should remain empty
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #21215 https://github.com/symfony/symfony/issues/11572 https://github.com/symfony/symfony/pull/12773
| License | MIT
| Doc PR | n/a (maybe look at updating the existing one)
This conserves empty values for options instead of returning their default values.
Code:
```php
// cli.php
$application = new Application();
$application
->register('echo')
->addOption('prefix', null, InputOption::VALUE_OPTIONAL, null, 'my-default')
->addArgument('value', InputArgument::REQUIRED)
->setCode(function ($input, $output) {
var_dump($input->getOption('prefix'));
});
$application->run();
```
Before:
![before](http://image.prntscr.com/image/157d9c6c054240da8b0dce54c9ce24d6.png)
After:
![after](http://image.prntscr.com/image/4aeded77f8084d3c985687fc8cc7b54e.png)
Commits
-------
|
||
---|---|---|
.composer | ||
.github | ||
src/Symfony | ||
.editorconfig | ||
.gitignore | ||
.php_cs.dist | ||
.travis.yml | ||
CHANGELOG-3.0.md | ||
CHANGELOG-3.1.md | ||
CHANGELOG-3.2.md | ||
CONTRIBUTING.md | ||
CONTRIBUTORS.md | ||
LICENSE | ||
README.md | ||
UPGRADE-3.0.md | ||
UPGRADE-3.1.md | ||
UPGRADE-3.2.md | ||
UPGRADE-3.3.md | ||
UPGRADE-4.0.md | ||
appveyor.yml | ||
composer.json | ||
phpunit | ||
phpunit.xml.dist |
README.md
Symfony is a PHP framework for web applications and a set of reusable PHP components. Symfony is used by thousands of web applications (including BlaBlaCar.com and Spotify.com) and most of the popular PHP projects (including Drupal and Magento).
Installation
- Install Symfony with Composer or with our own installer (see requirements details).
- Symfony follows the semantic versioning strictly, publishes "Long Term Support" (LTS) versions and has a release process that is predictable and business-friendly.
Documentation
- Read the Getting Started guide if you are new to Symfony.
- Try the Symfony Demo application to learn Symfony in practice.
- Master Symfony with the Guides and Tutorials, the Components docs and the Best Practices reference.
Community
- Join the Symfony Community and meet other members at the Symfony events.
- Get Symfony support on StackOverflow, Slack, IRC, etc.
- Follow us on GitHub, Twitter and Facebook.
Contributing
Symfony is an Open Source, community-driven project with thousands of contributors. Join them contributing code or contributing documentation.
Security Issues
If you discover a security vulnerability within Symfony, please follow our disclosure procedure.
About Us
Symfony development is sponsored by SensioLabs, lead by the Symfony Core Team and supported by Symfony contributors.