Skip to content

Commit

Permalink
Merge branch '3.0' into 3.1
Browse files Browse the repository at this point in the history
* 3.0:
  fixed CS
  fixed CS
  fixed CS
  tweaked default CS fixer config
  [HttpKernel] Dont close the output stream in debug
  move HttpKernel component to require section
  Fixed oci and sqlsrv merge queries when emulation is disabled - fixes symfony#17284
  [Session] fix PDO transaction aborted under PostgreSQL
  [Console] Use InputInterface inherited doc as possible
  Mention generating absolute urls in UPGRADE files and CHANGELOG
  add docblock type elements to support newly added IteratorAggregate::getIterator PhpStorm support
  FormBuilderInterface: fix getForm() return type.
  Fixed typo in PHPDoc
  • Loading branch information
fabpot committed Jun 21, 2016
2 parents e7e9bef + be0b8f0 commit 9cbec2c
Show file tree
Hide file tree
Showing 32 changed files with 216 additions and 203 deletions.
7 changes: 7 additions & 0 deletions .php_cs
Expand Up @@ -3,6 +3,10 @@
return Symfony\CS\Config\Config::create()
->setUsingLinter(false)
->setUsingCache(true)
->fixers(array(
'long_array_syntax',
'php_unit_construct',
))
->finder(
Symfony\CS\Finder\DefaultFinder::create()
->in(__DIR__)
Expand All @@ -12,6 +16,9 @@ return Symfony\CS\Config\Config::create()
'src/Symfony/Component/Routing/Tests/Fixtures/dumper',
// fixture templates
'src/Symfony/Component/Templating/Tests/Fixtures/templates',
'src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom',
// generated fixtures
'src/Symfony/Component/VarDumper/Tests/Fixtures',
// resource templates
'src/Symfony/Bundle/FrameworkBundle/Resources/views/Form',
))
Expand Down
24 changes: 24 additions & 0 deletions UPGRADE-3.0.md
Expand Up @@ -939,6 +939,30 @@ UPGRADE FROM 2.x to 3.0
* The `getMatcherDumperInstance()` and `getGeneratorDumperInstance()` methods in the
`Symfony\Component\Routing\Router` have been changed from `public` to `protected`.

* Use the constants defined in the UrlGeneratorInterface for the $referenceType argument of the UrlGeneratorInterface::generate method.

Before:

```php
// url generated in controller
$this->generateUrl('blog_show', array('slug' => 'my-blog-post'), true);

// url generated in @router service
$router->generate('blog_show', array('slug' => 'my-blog-post'), true);
```

After:

```php
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;

// url generated in controller
$this->generateUrl('blog_show', array('slug' => 'my-blog-post'), UrlGeneratorInterface::ABSOLUTE_URL);

// url generated in @router service
$router->generate('blog_show', array('slug' => 'my-blog-post'), UrlGeneratorInterface::ABSOLUTE_URL);
```

### Security

* The `vote()` method from the `VoterInterface` was changed to now accept arbitrary
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bridge/Monolog/composer.json
Expand Up @@ -17,10 +17,10 @@
],
"require": {
"php": ">=5.5.9",
"monolog/monolog": "~1.11"
"monolog/monolog": "~1.11",
"symfony/http-kernel": "~2.8|~3.0"
},
"require-dev": {
"symfony/http-kernel": "~2.8|~3.0",
"symfony/console": "~2.8|~3.0",
"symfony/event-dispatcher": "~2.8|~3.0"
},
Expand Down
Expand Up @@ -32,7 +32,7 @@ protected function listBundles($output)
$rows = array();

$bundles = $this->getContainer()->get('kernel')->getBundles();
usort($bundles, function($bundleA, $bundleB) {
usort($bundles, function ($bundleA, $bundleB) {
return strcmp($bundleA->getName(), $bundleB->getName());
});

Expand Down
Expand Up @@ -25,7 +25,7 @@ protected function setUp()
$fooPackage = new Package(new StaticVersionStrategy('42', '%s?v=%s'));
$barPackage = new Package(new StaticVersionStrategy('22', '%s?%s'));

$packages = new Packages($fooPackage, ['bar' => $barPackage]);
$packages = new Packages($fooPackage, array('bar' => $barPackage));

$this->helper = new AssetsHelper($packages);
}
Expand Down
6 changes: 6 additions & 0 deletions src/Symfony/Component/Console/Helper/HelperSet.php
Expand Up @@ -21,6 +21,9 @@
*/
class HelperSet implements \IteratorAggregate
{
/**
* @var Helper[]
*/
private $helpers = array();
private $command;

Expand Down Expand Up @@ -102,6 +105,9 @@ public function getCommand()
return $this->command;
}

/**
* @return Helper[]
*/
public function getIterator()
{
return new \ArrayIterator($this->helpers);
Expand Down
31 changes: 6 additions & 25 deletions src/Symfony/Component/Console/Input/ArgvInput.php
Expand Up @@ -46,8 +46,8 @@ class ArgvInput extends Input
/**
* Constructor.
*
* @param array $argv An array of parameters from the CLI (in the argv format)
* @param InputDefinition $definition A InputDefinition instance
* @param array|null $argv An array of parameters from the CLI (in the argv format)
* @param InputDefinition|null $definition A InputDefinition instance
*/
public function __construct(array $argv = null, InputDefinition $definition = null)
{
Expand All @@ -69,7 +69,7 @@ protected function setTokens(array $tokens)
}

/**
* Processes command line arguments.
* {@inheritdoc}
*/
protected function parse()
{
Expand Down Expand Up @@ -253,9 +253,7 @@ private function addLongOption($name, $value)
}

/**
* Returns the first argument from the raw parameters (not parsed).
*
* @return string The value of the first argument or null otherwise
* {@inheritdoc}
*/
public function getFirstArgument()
{
Expand All @@ -269,15 +267,7 @@ public function getFirstArgument()
}

/**
* Returns true if the raw parameters (not parsed) contain a value.
*
* This method is to be used to introspect the input parameters
* before they have been validated. It must be used carefully.
*
* @param string|array $values The value(s) to look for in the raw parameters (can be an array)
* @param bool $onlyParams Only check real parameters, skip those following an end of options (--) signal
*
* @return bool true if the value is contained in the raw parameters
* {@inheritdoc}
*/
public function hasParameterOption($values, $onlyParams = false)
{
Expand All @@ -298,16 +288,7 @@ public function hasParameterOption($values, $onlyParams = false)
}

/**
* Returns the value of a raw option (not parsed).
*
* This method is to be used to introspect the input parameters
* before they have been validated. It must be used carefully.
*
* @param string|array $values The value(s) to look for in the raw parameters (can be an array)
* @param mixed $default The default value to return if no result is found
* @param bool $onlyParams Only check real parameters, skip those following an end of options (--) signal
*
* @return mixed The option value
* {@inheritdoc}
*/
public function getParameterOption($values, $default = false, $onlyParams = false)
{
Expand Down
31 changes: 6 additions & 25 deletions src/Symfony/Component/Console/Input/ArrayInput.php
Expand Up @@ -30,8 +30,8 @@ class ArrayInput extends Input
/**
* Constructor.
*
* @param array $parameters An array of parameters
* @param InputDefinition $definition A InputDefinition instance
* @param array $parameters An array of parameters
* @param InputDefinition|null $definition A InputDefinition instance
*/
public function __construct(array $parameters, InputDefinition $definition = null)
{
Expand All @@ -41,9 +41,7 @@ public function __construct(array $parameters, InputDefinition $definition = nul
}

/**
* Returns the first argument from the raw parameters (not parsed).
*
* @return string The value of the first argument or null otherwise
* {@inheritdoc}
*/
public function getFirstArgument()
{
Expand All @@ -57,15 +55,7 @@ public function getFirstArgument()
}

/**
* Returns true if the raw parameters (not parsed) contain a value.
*
* This method is to be used to introspect the input parameters
* before they have been validated. It must be used carefully.
*
* @param string|array $values The values to look for in the raw parameters (can be an array)
* @param bool $onlyParams Only check real parameters, skip those following an end of options (--) signal
*
* @return bool true if the value is contained in the raw parameters
* {@inheritdoc}
*/
public function hasParameterOption($values, $onlyParams = false)
{
Expand All @@ -89,16 +79,7 @@ public function hasParameterOption($values, $onlyParams = false)
}

/**
* Returns the value of a raw option (not parsed).
*
* This method is to be used to introspect the input parameters
* before they have been validated. It must be used carefully.
*
* @param string|array $values The value(s) to look for in the raw parameters (can be an array)
* @param mixed $default The default value to return if no result is found
* @param bool $onlyParams Only check real parameters, skip those following an end of options (--) signal
*
* @return mixed The option value
* {@inheritdoc}
*/
public function getParameterOption($values, $default = false, $onlyParams = false)
{
Expand Down Expand Up @@ -141,7 +122,7 @@ public function __toString()
}

/**
* Processes command line arguments.
* {@inheritdoc}
*/
protected function parse()
{
Expand Down
68 changes: 13 additions & 55 deletions src/Symfony/Component/Console/Input/Input.php
Expand Up @@ -38,7 +38,7 @@ abstract class Input implements InputInterface
/**
* Constructor.
*
* @param InputDefinition $definition A InputDefinition instance
* @param InputDefinition|null $definition A InputDefinition instance
*/
public function __construct(InputDefinition $definition = null)
{
Expand All @@ -51,9 +51,7 @@ public function __construct(InputDefinition $definition = null)
}

/**
* Binds the current Input instance with the given arguments and options.
*
* @param InputDefinition $definition A InputDefinition instance
* {@inheritdoc}
*/
public function bind(InputDefinition $definition)
{
Expand All @@ -70,9 +68,7 @@ public function bind(InputDefinition $definition)
abstract protected function parse();

/**
* Validates the input.
*
* @throws RuntimeException When not enough arguments are given
* {@inheritdoc}
*/
public function validate()
{
Expand All @@ -89,43 +85,31 @@ public function validate()
}

/**
* Checks if the input is interactive.
*
* @return bool Returns true if the input is interactive
* {@inheritdoc}
*/
public function isInteractive()
{
return $this->interactive;
}

/**
* Sets the input interactivity.
*
* @param bool $interactive If the input should be interactive
* {@inheritdoc}
*/
public function setInteractive($interactive)
{
$this->interactive = (bool) $interactive;
}

/**
* Returns the argument values.
*
* @return array An array of argument values
* {@inheritdoc}
*/
public function getArguments()
{
return array_merge($this->definition->getArgumentDefaults(), $this->arguments);
}

/**
* Returns the argument value for a given argument name.
*
* @param string $name The argument name
*
* @return mixed The argument value
*
* @throws InvalidArgumentException When argument given doesn't exist
* {@inheritdoc}
*/
public function getArgument($name)
{
Expand All @@ -137,12 +121,7 @@ public function getArgument($name)
}

/**
* Sets an argument value by name.
*
* @param string $name The argument name
* @param string $value The argument value
*
* @throws InvalidArgumentException When argument given doesn't exist
* {@inheritdoc}
*/
public function setArgument($name, $value)
{
Expand All @@ -154,35 +133,23 @@ public function setArgument($name, $value)
}

/**
* Returns true if an InputArgument object exists by name or position.
*
* @param string|int $name The InputArgument name or position
*
* @return bool true if the InputArgument object exists, false otherwise
* {@inheritdoc}
*/
public function hasArgument($name)
{
return $this->definition->hasArgument($name);
}

/**
* Returns the options values.
*
* @return array An array of option values
* {@inheritdoc}
*/
public function getOptions()
{
return array_merge($this->definition->getOptionDefaults(), $this->options);
}

/**
* Returns the option value for a given option name.
*
* @param string $name The option name
*
* @return mixed The option value
*
* @throws InvalidArgumentException When option given doesn't exist
* {@inheritdoc}
*/
public function getOption($name)
{
Expand All @@ -194,12 +161,7 @@ public function getOption($name)
}

/**
* Sets an option value by name.
*
* @param string $name The option name
* @param string|bool $value The option value
*
* @throws InvalidArgumentException When option given doesn't exist
* {@inheritdoc}
*/
public function setOption($name, $value)
{
Expand All @@ -211,11 +173,7 @@ public function setOption($name, $value)
}

/**
* Returns true if an InputOption object exists by name.
*
* @param string $name The InputOption name
*
* @return bool true if the InputOption object exists, false otherwise
* {@inheritdoc}
*/
public function hasOption($name)
{
Expand Down

0 comments on commit 9cbec2c

Please sign in to comment.