From 9e7b3479dcc0b8f18507ec6cb101c67f4020ad7e Mon Sep 17 00:00:00 2001 From: Thomas Landauer Date: Thu, 16 Jun 2016 20:42:35 +0200 Subject: [PATCH 01/13] Fixed typo in PHPDoc --- src/Symfony/Component/HttpFoundation/File/File.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/File/File.php b/src/Symfony/Component/HttpFoundation/File/File.php index f1b28b4b7d..4736b45c34 100644 --- a/src/Symfony/Component/HttpFoundation/File/File.php +++ b/src/Symfony/Component/HttpFoundation/File/File.php @@ -68,7 +68,7 @@ class File extends \SplFileInfo * mime_content_type() and the system binary "file" (in this order), depending on * which of those are available. * - * @return string|null The guessed mime type (i.e. "application/pdf") + * @return string|null The guessed mime type (e.g. "application/pdf") * * @see MimeTypeGuesser */ From 3fa081cc71fd9e04b952ae2ff37edeb41501f77d Mon Sep 17 00:00:00 2001 From: Sergio Santoro Date: Fri, 17 Jun 2016 13:17:04 +0200 Subject: [PATCH 02/13] FormBuilderInterface: fix getForm() return type. FormBuilderInterface->getForm() should depend on abstractions and not implementations as a return type. --- src/Symfony/Component/Form/FormBuilderInterface.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Form/FormBuilderInterface.php b/src/Symfony/Component/Form/FormBuilderInterface.php index 998d3ec0d3..8cf010774b 100644 --- a/src/Symfony/Component/Form/FormBuilderInterface.php +++ b/src/Symfony/Component/Form/FormBuilderInterface.php @@ -81,7 +81,7 @@ interface FormBuilderInterface extends \Traversable, \Countable, FormConfigBuild /** * Creates the form. * - * @return Form The form + * @return FormInterface The form */ public function getForm(); } From ede35568bfc44fc6a596ad8a6f645139a24f79a6 Mon Sep 17 00:00:00 2001 From: Daniel Espendiller Date: Sun, 12 Jun 2016 12:30:51 +0200 Subject: [PATCH 03/13] add docblock type elements to support newly added IteratorAggregate::getIterator PhpStorm support --- src/Symfony/Component/Console/Helper/HelperSet.php | 6 ++++++ src/Symfony/Component/Finder/Finder.php | 2 +- .../Component/Form/ChoiceList/View/ChoiceGroupView.php | 2 ++ src/Symfony/Component/Form/Form.php | 2 +- src/Symfony/Component/Form/FormBuilder.php | 2 ++ src/Symfony/Component/Form/FormView.php | 2 +- .../Component/Routing/Matcher/Dumper/DumperCollection.php | 6 +++--- src/Symfony/Component/Routing/RouteCollection.php | 2 +- src/Symfony/Component/Validator/ConstraintViolationList.php | 2 ++ 9 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Component/Console/Helper/HelperSet.php b/src/Symfony/Component/Console/Helper/HelperSet.php index 00354dd91f..9fe56062f0 100644 --- a/src/Symfony/Component/Console/Helper/HelperSet.php +++ b/src/Symfony/Component/Console/Helper/HelperSet.php @@ -20,6 +20,9 @@ use Symfony\Component\Console\Command\Command; */ class HelperSet implements \IteratorAggregate { + /** + * @var Helper[] + */ private $helpers = array(); private $command; @@ -109,6 +112,9 @@ class HelperSet implements \IteratorAggregate return $this->command; } + /** + * @return Helper[] + */ public function getIterator() { return new \ArrayIterator($this->helpers); diff --git a/src/Symfony/Component/Finder/Finder.php b/src/Symfony/Component/Finder/Finder.php index c83a024eab..90dcd20958 100644 --- a/src/Symfony/Component/Finder/Finder.php +++ b/src/Symfony/Component/Finder/Finder.php @@ -646,7 +646,7 @@ class Finder implements \IteratorAggregate, \Countable * * This method implements the IteratorAggregate interface. * - * @return \Iterator An iterator + * @return \Iterator|SplFileInfo[] An iterator * * @throws \LogicException if the in() method has not been called */ diff --git a/src/Symfony/Component/Form/ChoiceList/View/ChoiceGroupView.php b/src/Symfony/Component/Form/ChoiceList/View/ChoiceGroupView.php index 05d7533306..ce7989359a 100644 --- a/src/Symfony/Component/Form/ChoiceList/View/ChoiceGroupView.php +++ b/src/Symfony/Component/Form/ChoiceList/View/ChoiceGroupView.php @@ -47,6 +47,8 @@ class ChoiceGroupView implements \IteratorAggregate /** * {@inheritdoc} + * + * @return ChoiceGroupView[]|ChoiceView[] */ public function getIterator() { diff --git a/src/Symfony/Component/Form/Form.php b/src/Symfony/Component/Form/Form.php index a395f42708..94271cf821 100644 --- a/src/Symfony/Component/Form/Form.php +++ b/src/Symfony/Component/Form/Form.php @@ -1022,7 +1022,7 @@ class Form implements \IteratorAggregate, FormInterface /** * Returns the iterator for this group. * - * @return \Traversable + * @return \Traversable|FormInterface[] */ public function getIterator() { diff --git a/src/Symfony/Component/Form/FormBuilder.php b/src/Symfony/Component/Form/FormBuilder.php index 81c9ad5f6d..44bc08951a 100644 --- a/src/Symfony/Component/Form/FormBuilder.php +++ b/src/Symfony/Component/Form/FormBuilder.php @@ -231,6 +231,8 @@ class FormBuilder extends FormConfigBuilder implements \IteratorAggregate, FormB /** * {@inheritdoc} + * + * @return FormBuilderInterface[] */ public function getIterator() { diff --git a/src/Symfony/Component/Form/FormView.php b/src/Symfony/Component/Form/FormView.php index ac50dc336f..e424b3c773 100644 --- a/src/Symfony/Component/Form/FormView.php +++ b/src/Symfony/Component/Form/FormView.php @@ -143,7 +143,7 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable /** * Returns an iterator to iterate over children (implements \IteratorAggregate). * - * @return \ArrayIterator The iterator + * @return \ArrayIterator|FormView[] The iterator */ public function getIterator() { diff --git a/src/Symfony/Component/Routing/Matcher/Dumper/DumperCollection.php b/src/Symfony/Component/Routing/Matcher/Dumper/DumperCollection.php index e7dea88ed3..0f2815b73e 100644 --- a/src/Symfony/Component/Routing/Matcher/Dumper/DumperCollection.php +++ b/src/Symfony/Component/Routing/Matcher/Dumper/DumperCollection.php @@ -26,7 +26,7 @@ class DumperCollection implements \IteratorAggregate private $parent; /** - * @var (DumperCollection|DumperRoute)[] + * @var DumperCollection[]|DumperRoute[] */ private $children = array(); @@ -38,7 +38,7 @@ class DumperCollection implements \IteratorAggregate /** * Returns the children routes and collections. * - * @return (DumperCollection|DumperRoute)[] Array of DumperCollection|DumperRoute + * @return DumperCollection[]|DumperRoute[] Array of DumperCollection|DumperRoute */ public function all() { @@ -76,7 +76,7 @@ class DumperCollection implements \IteratorAggregate /** * Returns an iterator over the children. * - * @return \Iterator The iterator + * @return \Iterator|DumperCollection[]|DumperRoute[] The iterator */ public function getIterator() { diff --git a/src/Symfony/Component/Routing/RouteCollection.php b/src/Symfony/Component/Routing/RouteCollection.php index d6ac840ca6..2ccb90f3b0 100644 --- a/src/Symfony/Component/Routing/RouteCollection.php +++ b/src/Symfony/Component/Routing/RouteCollection.php @@ -49,7 +49,7 @@ class RouteCollection implements \IteratorAggregate, \Countable * * @see all() * - * @return \ArrayIterator An \ArrayIterator object for iterating over routes + * @return \ArrayIterator|Route[] An \ArrayIterator object for iterating over routes */ public function getIterator() { diff --git a/src/Symfony/Component/Validator/ConstraintViolationList.php b/src/Symfony/Component/Validator/ConstraintViolationList.php index cccfa86aea..d43d5431dd 100644 --- a/src/Symfony/Component/Validator/ConstraintViolationList.php +++ b/src/Symfony/Component/Validator/ConstraintViolationList.php @@ -107,6 +107,8 @@ class ConstraintViolationList implements \IteratorAggregate, ConstraintViolation /** * {@inheritdoc} + * + * @return \ArrayIterator|ConstraintViolationInterface[] */ public function getIterator() { From 5f506d96ffaf99a5324bdc50276e7eca7564bdd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zdene=CC=8Ck=20Drahos=CC=8C?= Date: Fri, 17 Jun 2016 10:10:27 +0200 Subject: [PATCH 04/13] Mention generating absolute urls in UPGRADE files and CHANGELOG --- UPGRADE-2.8.md | 28 ++++++++++++++++++++++ UPGRADE-3.0.md | 24 +++++++++++++++++++ src/Symfony/Component/Routing/CHANGELOG.md | 16 +++++++++++++ 3 files changed, 68 insertions(+) diff --git a/UPGRADE-2.8.md b/UPGRADE-2.8.md index 990382602b..957f35b505 100644 --- a/UPGRADE-2.8.md +++ b/UPGRADE-2.8.md @@ -630,3 +630,31 @@ HttpFoundation ```php $request->query->get('foo')[bar]; ``` + +Routing +------- + + * Deprecated the hardcoded value for the `$referenceType` argument of the `UrlGeneratorInterface::generate` method. + Use the constants defined in the `UrlGeneratorInterface` instead. + + 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); + ``` \ No newline at end of file diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md index 08796bd419..b8b4a96223 100644 --- a/UPGRADE-3.0.md +++ b/UPGRADE-3.0.md @@ -899,6 +899,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 `Resources/` directory was moved to `Core/Resources/` diff --git a/src/Symfony/Component/Routing/CHANGELOG.md b/src/Symfony/Component/Routing/CHANGELOG.md index 7f5d9f0ec0..04ac1d3198 100644 --- a/src/Symfony/Component/Routing/CHANGELOG.md +++ b/src/Symfony/Component/Routing/CHANGELOG.md @@ -7,6 +7,22 @@ CHANGELOG * allowed specifying a directory to recursively load all routing configuration files it contains * Added ObjectRouteLoader and ServiceRouteLoader that allow routes to be loaded by calling a method on an object/service. + * [DEPRECATION] Deprecated the hardcoded value for the `$referenceType` argument of the `UrlGeneratorInterface::generate` method. + Use the constants defined in the `UrlGeneratorInterface` instead. + + Before: + + ```php + $router->generate('blog_show', array('slug' => 'my-blog-post'), true); + ``` + + After: + + ```php + use Symfony\Component\Routing\Generator\UrlGeneratorInterface; + + $router->generate('blog_show', array('slug' => 'my-blog-post'), UrlGeneratorInterface::ABSOLUTE_URL); + ``` 2.5.0 ----- From b604be708435e415d5191f6599fca4992d269d09 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Thu, 16 Jun 2016 21:02:21 +0200 Subject: [PATCH 05/13] [Console] Use InputInterface inherited doc as possible --- .../Component/Console/Input/ArgvInput.php | 29 ++------ .../Component/Console/Input/ArrayInput.php | 29 ++------ src/Symfony/Component/Console/Input/Input.php | 68 ++++--------------- .../Console/Input/InputInterface.php | 22 +++--- 4 files changed, 37 insertions(+), 111 deletions(-) diff --git a/src/Symfony/Component/Console/Input/ArgvInput.php b/src/Symfony/Component/Console/Input/ArgvInput.php index 43b28d5e7f..9291e9eaa6 100644 --- a/src/Symfony/Component/Console/Input/ArgvInput.php +++ b/src/Symfony/Component/Console/Input/ArgvInput.php @@ -44,8 +44,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) { @@ -67,7 +67,7 @@ class ArgvInput extends Input } /** - * Processes command line arguments. + * {@inheritdoc} */ protected function parse() { @@ -251,9 +251,7 @@ class ArgvInput extends Input } /** - * 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() { @@ -267,14 +265,7 @@ class ArgvInput extends Input } /** - * 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) - * - * @return bool true if the value is contained in the raw parameters + * {@inheritdoc} */ public function hasParameterOption($values) { @@ -292,15 +283,7 @@ class ArgvInput extends Input } /** - * 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 - * - * @return mixed The option value + * {@inheritdoc} */ public function getParameterOption($values, $default = false) { diff --git a/src/Symfony/Component/Console/Input/ArrayInput.php b/src/Symfony/Component/Console/Input/ArrayInput.php index 99c9788421..e9d4f8e842 100644 --- a/src/Symfony/Component/Console/Input/ArrayInput.php +++ b/src/Symfony/Component/Console/Input/ArrayInput.php @@ -27,8 +27,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) { @@ -38,9 +38,7 @@ class ArrayInput extends Input } /** - * 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() { @@ -54,14 +52,7 @@ class ArrayInput extends Input } /** - * 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) - * - * @return bool true if the value is contained in the raw parameters + * {@inheritdoc} */ public function hasParameterOption($values) { @@ -81,15 +72,7 @@ class ArrayInput extends Input } /** - * 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 - * - * @return mixed The option value + * {@inheritdoc} */ public function getParameterOption($values, $default = false) { @@ -128,7 +111,7 @@ class ArrayInput extends Input } /** - * Processes command line arguments. + * {@inheritdoc} */ protected function parse() { diff --git a/src/Symfony/Component/Console/Input/Input.php b/src/Symfony/Component/Console/Input/Input.php index e26fcc186f..2251b16cb9 100644 --- a/src/Symfony/Component/Console/Input/Input.php +++ b/src/Symfony/Component/Console/Input/Input.php @@ -35,7 +35,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) { @@ -48,9 +48,7 @@ abstract class Input implements InputInterface } /** - * Binds the current Input instance with the given arguments and options. - * - * @param InputDefinition $definition A InputDefinition instance + * {@inheritdoc} */ public function bind(InputDefinition $definition) { @@ -67,9 +65,7 @@ abstract class Input implements InputInterface abstract protected function parse(); /** - * Validates the input. - * - * @throws \RuntimeException When not enough arguments are given + * {@inheritdoc} */ public function validate() { @@ -86,9 +82,7 @@ abstract class Input implements InputInterface } /** - * Checks if the input is interactive. - * - * @return bool Returns true if the input is interactive + * {@inheritdoc} */ public function isInteractive() { @@ -96,9 +90,7 @@ abstract class Input implements InputInterface } /** - * Sets the input interactivity. - * - * @param bool $interactive If the input should be interactive + * {@inheritdoc} */ public function setInteractive($interactive) { @@ -106,9 +98,7 @@ abstract class Input implements InputInterface } /** - * Returns the argument values. - * - * @return array An array of argument values + * {@inheritdoc} */ public function getArguments() { @@ -116,13 +106,7 @@ abstract class Input implements InputInterface } /** - * 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) { @@ -134,12 +118,7 @@ abstract class Input implements InputInterface } /** - * 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) { @@ -151,11 +130,7 @@ abstract class Input implements InputInterface } /** - * 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) { @@ -163,9 +138,7 @@ abstract class Input implements InputInterface } /** - * Returns the options values. - * - * @return array An array of option values + * {@inheritdoc} */ public function getOptions() { @@ -173,13 +146,7 @@ abstract class Input implements InputInterface } /** - * 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) { @@ -191,12 +158,7 @@ abstract class Input implements InputInterface } /** - * 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) { @@ -208,11 +170,7 @@ abstract class Input implements InputInterface } /** - * 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) { diff --git a/src/Symfony/Component/Console/Input/InputInterface.php b/src/Symfony/Component/Console/Input/InputInterface.php index 6ef2f264fd..5ba1604048 100644 --- a/src/Symfony/Component/Console/Input/InputInterface.php +++ b/src/Symfony/Component/Console/Input/InputInterface.php @@ -58,11 +58,9 @@ interface InputInterface public function bind(InputDefinition $definition); /** - * Validates if arguments given are correct. + * Validates the input. * - * Throws an exception when not enough arguments are given. - * - * @throws \RuntimeException + * @throws \RuntimeException When not enough arguments are given */ public function validate(); @@ -74,11 +72,13 @@ interface InputInterface public function getArguments(); /** - * Gets argument by name. + * Returns the argument value for a given argument name. * - * @param string $name The name of the argument + * @param string $name The argument name * - * @return mixed + * @return mixed The argument value + * + * @throws \InvalidArgumentException When argument given doesn't exist */ public function getArgument($name); @@ -109,11 +109,13 @@ interface InputInterface public function getOptions(); /** - * Gets an option by name. + * Returns the option value for a given option name. * - * @param string $name The name of the option + * @param string $name The option name * - * @return mixed + * @return mixed The option value + * + * @throws \InvalidArgumentException When option given doesn't exist */ public function getOption($name); From f8eefa0748de512fa12ae1059844282a25dedd6a Mon Sep 17 00:00:00 2001 From: Tobias Schultze Date: Sat, 18 Jun 2016 18:41:57 +0200 Subject: [PATCH 06/13] [Session] fix PDO transaction aborted under PostgreSQL --- .../Storage/Handler/PdoSessionHandler.php | 77 +++++++++---------- .../Storage/Handler/PdoSessionHandlerTest.php | 4 + 2 files changed, 41 insertions(+), 40 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php index 54d94f7c05..daee396dd7 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php @@ -510,54 +510,51 @@ class PdoSessionHandler implements \SessionHandlerInterface $selectSql = $this->getSelectSql(); $selectStmt = $this->pdo->prepare($selectSql); $selectStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); - $selectStmt->execute(); - $sessionRows = $selectStmt->fetchAll(\PDO::FETCH_NUM); + do { + $selectStmt->execute(); + $sessionRows = $selectStmt->fetchAll(\PDO::FETCH_NUM); - if ($sessionRows) { - if ($sessionRows[0][1] + $sessionRows[0][2] < time()) { - $this->sessionExpired = true; - - return ''; - } - - return is_resource($sessionRows[0][0]) ? stream_get_contents($sessionRows[0][0]) : $sessionRows[0][0]; - } - - if (self::LOCK_TRANSACTIONAL === $this->lockMode && 'sqlite' !== $this->driver) { - // Exclusive-reading of non-existent rows does not block, so we need to do an insert to block - // until other connections to the session are committed. - try { - $insertStmt = $this->pdo->prepare( - "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time)" - ); - $insertStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); - $insertStmt->bindValue(':data', '', \PDO::PARAM_LOB); - $insertStmt->bindValue(':lifetime', 0, \PDO::PARAM_INT); - $insertStmt->bindValue(':time', time(), \PDO::PARAM_INT); - $insertStmt->execute(); - } catch (\PDOException $e) { - // Catch duplicate key error because other connection created the session already. - // It would only not be the case when the other connection destroyed the session. - if (0 === strpos($e->getCode(), '23')) { - // Retrieve finished session data written by concurrent connection. SELECT - // FOR UPDATE is necessary to avoid deadlock of connection that starts reading - // before we write (transform intention to real lock). - $selectStmt->execute(); - $sessionRows = $selectStmt->fetchAll(\PDO::FETCH_NUM); - - if ($sessionRows) { - return is_resource($sessionRows[0][0]) ? stream_get_contents($sessionRows[0][0]) : $sessionRows[0][0]; - } + if ($sessionRows) { + if ($sessionRows[0][1] + $sessionRows[0][2] < time()) { + $this->sessionExpired = true; return ''; } - throw $e; + return is_resource($sessionRows[0][0]) ? stream_get_contents($sessionRows[0][0]) : $sessionRows[0][0]; } - } - return ''; + if (self::LOCK_TRANSACTIONAL === $this->lockMode && 'sqlite' !== $this->driver) { + // Exclusive-reading of non-existent rows does not block, so we need to do an insert to block + // until other connections to the session are committed. + try { + $insertStmt = $this->pdo->prepare( + "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time)" + ); + $insertStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); + $insertStmt->bindValue(':data', '', \PDO::PARAM_LOB); + $insertStmt->bindValue(':lifetime', 0, \PDO::PARAM_INT); + $insertStmt->bindValue(':time', time(), \PDO::PARAM_INT); + $insertStmt->execute(); + } catch (\PDOException $e) { + // Catch duplicate key error because other connection created the session already. + // It would only not be the case when the other connection destroyed the session. + if (0 === strpos($e->getCode(), '23')) { + // Retrieve finished session data written by concurrent connection by restarting the loop. + // We have to start a new transaction as a failed query will mark the current transaction as + // aborted in PostgreSQL and disallow further queries within it. + $this->rollback(); + $this->beginTransaction(); + continue; + } + + throw $e; + } + } + + return ''; + } while (true); } /** diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php index 9612320976..1f88d00d8f 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php @@ -362,4 +362,8 @@ class MockPdo extends \PDO public function beginTransaction() { } + + public function rollBack() + { + } } From ebf3a2ffc8e778b255bb4786f19dba8ae4100575 Mon Sep 17 00:00:00 2001 From: hjkl Date: Sun, 10 Apr 2016 19:40:50 +0100 Subject: [PATCH 07/13] Fixed oci and sqlsrv merge queries when emulation is disabled - fixes #17284 --- .../Storage/Handler/PdoSessionHandler.php | 67 +++++++++++++------ 1 file changed, 47 insertions(+), 20 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php index 54d94f7c05..32602c7a4f 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php @@ -325,14 +325,8 @@ class PdoSessionHandler implements \SessionHandlerInterface try { // We use a single MERGE SQL query when supported by the database. - $mergeSql = $this->getMergeSql(); - - if (null !== $mergeSql) { - $mergeStmt = $this->pdo->prepare($mergeSql); - $mergeStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); - $mergeStmt->bindParam(':data', $data, \PDO::PARAM_LOB); - $mergeStmt->bindParam(':lifetime', $maxlifetime, \PDO::PARAM_INT); - $mergeStmt->bindValue(':time', time(), \PDO::PARAM_INT); + $mergeStmt = $this->getMergeStatement($sessionId, $data, $maxlifetime); + if (null !== $mergeStmt) { $mergeStmt->execute(); return true; @@ -653,32 +647,65 @@ class PdoSessionHandler implements \SessionHandlerInterface } /** - * Returns a merge/upsert (i.e. insert or update) SQL query when supported by the database for writing session data. + * Returns a merge/upsert (i.e. insert or update) statement when supported by the database for writing session data. * - * @return string|null The SQL string or null when not supported + * @param string $sessionId Session ID + * @param string $data Encoded session data + * @param int $maxlifetime session.gc_maxlifetime + * + * @return \PDOStatement|null The merge statement or null when not supported */ - private function getMergeSql() + private function getMergeStatement($sessionId, $data, $maxlifetime) { + $mergeSql = null; switch (true) { case 'mysql' === $this->driver: - return "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time) ". + $mergeSql = "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time) ". "ON DUPLICATE KEY UPDATE $this->dataCol = VALUES($this->dataCol), $this->lifetimeCol = VALUES($this->lifetimeCol), $this->timeCol = VALUES($this->timeCol)"; + break; case 'oci' === $this->driver: // DUAL is Oracle specific dummy table - return "MERGE INTO $this->table USING DUAL ON ($this->idCol = :id) ". - "WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time) ". - "WHEN MATCHED THEN UPDATE SET $this->dataCol = :data, $this->lifetimeCol = :lifetime, $this->timeCol = :time"; + $mergeSql = "MERGE INTO $this->table USING DUAL ON ($this->idCol = ?) ". + "WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (?, ?, ?, ?) ". + "WHEN MATCHED THEN UPDATE SET $this->dataCol = ?, $this->lifetimeCol = ?, $this->timeCol = ?"; + break; case 'sqlsrv' === $this->driver && version_compare($this->pdo->getAttribute(\PDO::ATTR_SERVER_VERSION), '10', '>='): // MERGE is only available since SQL Server 2008 and must be terminated by semicolon // It also requires HOLDLOCK according to http://weblogs.sqlteam.com/dang/archive/2009/01/31/UPSERT-Race-Condition-With-MERGE.aspx - return "MERGE INTO $this->table WITH (HOLDLOCK) USING (SELECT 1 AS dummy) AS src ON ($this->idCol = :id) ". - "WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time) ". - "WHEN MATCHED THEN UPDATE SET $this->dataCol = :data, $this->lifetimeCol = :lifetime, $this->timeCol = :time;"; + $mergeSql = "MERGE INTO $this->table WITH (HOLDLOCK) USING (SELECT 1 AS dummy) AS src ON ($this->idCol = ?) ". + "WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (?, ?, ?, ?) ". + "WHEN MATCHED THEN UPDATE SET $this->dataCol = ?, $this->lifetimeCol = ?, $this->timeCol = ?;"; + break; case 'sqlite' === $this->driver: - return "INSERT OR REPLACE INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time)"; + $mergeSql = "INSERT OR REPLACE INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time)"; + break; case 'pgsql' === $this->driver && version_compare($this->pdo->getAttribute(\PDO::ATTR_SERVER_VERSION), '9.5', '>='): - return "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time) ". + $mergeSql = "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time) ". "ON CONFLICT ($this->idCol) DO UPDATE SET ($this->dataCol, $this->lifetimeCol, $this->timeCol) = (EXCLUDED.$this->dataCol, EXCLUDED.$this->lifetimeCol, EXCLUDED.$this->timeCol)"; + break; + } + + if (null !== $mergeSql) { + $mergeStmt = $this->pdo->prepare($mergeSql); + + if ('sqlsrv' === $this->driver || 'oci' === $this->driver) { + $mergeStmt->bindParam(1, $sessionId, \PDO::PARAM_STR); + $mergeStmt->bindParam(2, $sessionId, \PDO::PARAM_STR); + $mergeStmt->bindParam(3, $data, \PDO::PARAM_LOB); + $mergeStmt->bindParam(4, $maxlifetime, \PDO::PARAM_INT); + $mergeStmt->bindValue(5, time(), \PDO::PARAM_INT); + $mergeStmt->bindParam(6, $data, \PDO::PARAM_LOB); + $mergeStmt->bindParam(7, $maxlifetime, \PDO::PARAM_INT); + $mergeStmt->bindValue(8, time(), \PDO::PARAM_INT); + } + else { + $mergeStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); + $mergeStmt->bindParam(':data', $data, \PDO::PARAM_LOB); + $mergeStmt->bindParam(':lifetime', $maxlifetime, \PDO::PARAM_INT); + $mergeStmt->bindValue(':time', time(), \PDO::PARAM_INT); + } + + return $mergeStmt; } } From 138d0cb493e3c36160c11ba9b6321c3e91f7d643 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 20 Jun 2016 09:57:16 +0200 Subject: [PATCH 08/13] move HttpKernel component to require section --- src/Symfony/Bridge/Monolog/composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bridge/Monolog/composer.json b/src/Symfony/Bridge/Monolog/composer.json index 9f7bd44444..5bf272afe7 100644 --- a/src/Symfony/Bridge/Monolog/composer.json +++ b/src/Symfony/Bridge/Monolog/composer.json @@ -17,10 +17,10 @@ ], "require": { "php": ">=5.3.9", - "monolog/monolog": "~1.11" + "monolog/monolog": "~1.11", + "symfony/http-kernel": "~2.4" }, "require-dev": { - "symfony/http-kernel": "~2.4", "symfony/console": "~2.4", "symfony/event-dispatcher": "~2.2" }, From 2fbc2008e55039000067a36622ef8f90686b3d81 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 20 Jun 2016 10:11:03 +0200 Subject: [PATCH 09/13] [HttpKernel] Dont close the output stream in debug --- src/Symfony/Component/HttpFoundation/Response.php | 6 ------ src/Symfony/Component/HttpKernel/Kernel.php | 8 ++++++++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Response.php b/src/Symfony/Component/HttpFoundation/Response.php index 62b67cce85..2f77858a47 100644 --- a/src/Symfony/Component/HttpFoundation/Response.php +++ b/src/Symfony/Component/HttpFoundation/Response.php @@ -373,12 +373,6 @@ class Response $this->sendHeaders(); $this->sendContent(); - if (function_exists('fastcgi_finish_request')) { - fastcgi_finish_request(); - } elseif ('cli' !== PHP_SAPI) { - static::closeOutputBuffers(0, true); - } - return $this; } diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 8213df5cb8..26a6813e49 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -149,6 +149,14 @@ abstract class Kernel implements KernelInterface, TerminableInterface } if ($this->getHttpKernel() instanceof TerminableInterface) { + if (!$this->debug) { + if (function_exists('fastcgi_finish_request')) { + fastcgi_finish_request(); + } elseif ('cli' !== PHP_SAPI) { + Response::closeOutputBuffers(0, true); + } + } + $this->getHttpKernel()->terminate($request, $response); } } From fdef8041f898d1ba0c44e71ed9ec6c7c6920f422 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 20 Jun 2016 18:23:25 +0200 Subject: [PATCH 10/13] tweaked default CS fixer config --- .php_cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.php_cs b/.php_cs index 290e9bf5fb..6043614819 100644 --- a/.php_cs +++ b/.php_cs @@ -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__) @@ -12,6 +16,7 @@ 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', // resource templates 'src/Symfony/Bundle/FrameworkBundle/Resources/views/Form', )) From 7cc3ca59d0a3f829a0a7c40e120e8f371ac207f4 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 20 Jun 2016 18:47:20 +0200 Subject: [PATCH 11/13] fixed CS --- .../FrameworkBundle/Command/AbstractConfigCommand.php | 2 +- .../Compiler/ReplaceAliasByActualDefinitionPass.php | 1 - .../Core/DataTransformer/ChoicesToValuesTransformerTest.php | 2 +- .../Session/Storage/Handler/PdoSessionHandler.php | 3 +-- src/Symfony/Component/Process/Tests/ProcessTest.php | 6 ++++-- .../Component/Routing/Loader/AnnotationDirectoryLoader.php | 2 +- .../Component/Serializer/Tests/Encoder/XmlEncoderTest.php | 4 ++-- .../Tests/Normalizer/GetSetMethodNormalizerTest.php | 2 +- src/Symfony/Component/Translation/Tests/TranslatorTest.php | 6 +++--- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php index d1e0f9c771..aceaa0cbdc 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php @@ -32,7 +32,7 @@ abstract class AbstractConfigCommand extends ContainerDebugCommand $rows = array(); $bundles = $this->getContainer()->get('kernel')->getBundles(); - usort($bundles, function($bundleA, $bundleB) { + usort($bundles, function ($bundleA, $bundleB) { return strcmp($bundleA->getName(), $bundleB->getName()); }); diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php index e80d3ccbf7..5c58656a52 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php @@ -139,7 +139,6 @@ class ReplaceAliasByActualDefinitionPass implements CompilerPassInterface $factory[0] = new Reference($replacements[$referenceId], $factory[0]->getInvalidBehavior()); } - return $factory; } } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoicesToValuesTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoicesToValuesTransformerTest.php index d6fe4edd31..5eb01a2ccb 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoicesToValuesTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoicesToValuesTransformerTest.php @@ -68,7 +68,7 @@ class ChoicesToValuesTransformerTest extends \PHPUnit_Framework_TestCase $this->assertSame($out, $this->transformer->reverseTransform($in)); // values are expected to be valid choices and stay the same - $inWithNull = array('0','1','2','3'); + $inWithNull = array('0', '1', '2', '3'); $out[] = null; $this->assertSame($out, $this->transformerWithNull->reverseTransform($inWithNull)); diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php index 3e542f5c87..8909a5f401 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php @@ -694,8 +694,7 @@ class PdoSessionHandler implements \SessionHandlerInterface $mergeStmt->bindParam(6, $data, \PDO::PARAM_LOB); $mergeStmt->bindParam(7, $maxlifetime, \PDO::PARAM_INT); $mergeStmt->bindValue(8, time(), \PDO::PARAM_INT); - } - else { + } else { $mergeStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); $mergeStmt->bindParam(':data', $data, \PDO::PARAM_LOB); $mergeStmt->bindParam(':lifetime', $maxlifetime, \PDO::PARAM_INT); diff --git a/src/Symfony/Component/Process/Tests/ProcessTest.php b/src/Symfony/Component/Process/Tests/ProcessTest.php index bb7914603e..ce06f1c338 100644 --- a/src/Symfony/Component/Process/Tests/ProcessTest.php +++ b/src/Symfony/Component/Process/Tests/ProcessTest.php @@ -1180,7 +1180,8 @@ class ProcessTest extends \PHPUnit_Framework_TestCase /** * @dataProvider provideVariousIncrementals */ - public function testIncrementalOutputDoesNotRequireAnotherCall($stream, $method) { + public function testIncrementalOutputDoesNotRequireAnotherCall($stream, $method) + { $process = $this->getProcess(self::$phpBin.' -r '.escapeshellarg('$n = 0; while ($n < 3) { file_put_contents(\''.$stream.'\', $n, 1); $n++; usleep(1000); }'), null, null, null, null); $process->start(); $result = ''; @@ -1195,7 +1196,8 @@ class ProcessTest extends \PHPUnit_Framework_TestCase $process->stop(); } - public function provideVariousIncrementals() { + public function provideVariousIncrementals() + { return array( array('php://stdout', 'getIncrementalOutput'), array('php://stderr', 'getIncrementalErrorOutput'), diff --git a/src/Symfony/Component/Routing/Loader/AnnotationDirectoryLoader.php b/src/Symfony/Component/Routing/Loader/AnnotationDirectoryLoader.php index f6b99a16ae..f66b928971 100644 --- a/src/Symfony/Component/Routing/Loader/AnnotationDirectoryLoader.php +++ b/src/Symfony/Component/Routing/Loader/AnnotationDirectoryLoader.php @@ -69,7 +69,7 @@ class AnnotationDirectoryLoader extends AnnotationFileLoader if (!is_string($resource)) { return false; } - + try { $path = $this->locator->locate($resource); } catch (\Exception $e) { diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php index 717004af05..5742b0c70a 100644 --- a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php +++ b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php @@ -249,7 +249,8 @@ XML; $this->assertEquals($expected, $serializer->serialize($array, 'xml', $options)); } - public function testEncodeTraversableWhenNormalizable() { + public function testEncodeTraversableWhenNormalizable() + { $this->encoder = new XmlEncoder(); $serializer = new Serializer(array(new CustomNormalizer()), array('xml' => new XmlEncoder())); $this->encoder->setSerializer($serializer); @@ -261,7 +262,6 @@ XML; XML; $this->assertEquals($expected, $serializer->serialize(new NormalizableTraversableDummy(), 'xml')); - } public function testDecode() diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php index d67c375430..9b0f0df1bd 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php @@ -654,7 +654,7 @@ class GetSetDummy protected function getPrivate() { - throw new \RuntimeException('Dummy::getPrivate() should not be called'); + throw new \RuntimeException('Dummy::getPrivate() should not be called'); } } diff --git a/src/Symfony/Component/Translation/Tests/TranslatorTest.php b/src/Symfony/Component/Translation/Tests/TranslatorTest.php index d2c8a65616..ac5aaf9ec1 100644 --- a/src/Symfony/Component/Translation/Tests/TranslatorTest.php +++ b/src/Symfony/Component/Translation/Tests/TranslatorTest.php @@ -285,12 +285,12 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase $resources = $translator->getCatalogue('en')->getResources(); $this->assertCount(1, $resources); - $this->assertContains( __DIR__.DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'resources.yml', $resources); + $this->assertContains(__DIR__.DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'resources.yml', $resources); $resources = $translator->getCatalogue('en_GB')->getResources(); $this->assertCount(2, $resources); - $this->assertContains( __DIR__.DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'empty.yml', $resources); - $this->assertContains( __DIR__.DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'resources.yml', $resources); + $this->assertContains(__DIR__.DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'empty.yml', $resources); + $this->assertContains(__DIR__.DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'resources.yml', $resources); } /** From 90151ef5c5502f87fa9bb361419855194ab630a5 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 21 Jun 2016 07:43:49 +0200 Subject: [PATCH 12/13] fixed CS --- .php_cs | 2 ++ .../Component/DependencyInjection/Compiler/AutowirePass.php | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.php_cs b/.php_cs index 6043614819..02d15784e6 100644 --- a/.php_cs +++ b/.php_cs @@ -17,6 +17,8 @@ return Symfony\CS\Config\Config::create() // 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', )) diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php index 5065ed1880..cd5b61b290 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php @@ -229,7 +229,6 @@ class AutowirePass implements CompilerPassInterface $matchingServices = implode(', ', $this->types[$typeHint->name]); throw new RuntimeException(sprintf('Unable to autowire argument of type "%s" for the service "%s". Multiple services exist for this %s (%s).', $typeHint->name, $id, $classOrInterface, $matchingServices)); - } if (!$typeHint->isInstantiable()) { From be0b8f088fb393afa92b1cdb69818800f09d8e97 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 21 Jun 2016 07:58:59 +0200 Subject: [PATCH 13/13] fixed CS --- .../Tests/Templating/Helper/AssetsHelperTest.php | 2 +- .../DependencyInjection/Tests/ContainerBuilderTest.php | 1 - .../Tests/Extension/Validator/Constraints/FormValidatorTest.php | 1 - .../Form/Tests/Extension/Validator/ValidatorExtensionTest.php | 1 - 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/AssetsHelperTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/AssetsHelperTest.php index 7e9a25313c..659f463adb 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/AssetsHelperTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/AssetsHelperTest.php @@ -25,7 +25,7 @@ class AssetsHelperTest extends \PHPUnit_Framework_TestCase $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); } diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php index 98b2aa956e..25c4cb12c0 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php @@ -21,7 +21,6 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Exception\RuntimeException; -use Symfony\Component\DependencyInjection\Exception\InactiveScopeException; use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; use Symfony\Component\DependencyInjection\Loader\ClosureLoader; diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php index 8f796bc8f4..abc6597bc1 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php @@ -21,7 +21,6 @@ use Symfony\Component\Form\SubmitButtonBuilder; use Symfony\Component\Validator\Constraints\NotNull; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\Valid; -use Symfony\Component\Validator\ExecutionContextInterface; use Symfony\Component\Validator\Tests\Constraints\AbstractConstraintValidatorTest; /** diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/ValidatorExtensionTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/ValidatorExtensionTest.php index ffb1a1e0c3..c60b390602 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Validator/ValidatorExtensionTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Validator/ValidatorExtensionTest.php @@ -12,7 +12,6 @@ namespace Symfony\Component\Form\Tests\Extension\Validator; use Symfony\Component\Form\Extension\Validator\ValidatorExtension; -use Symfony\Component\Validator\ValidatorInterface; class ValidatorExtensionTest extends \PHPUnit_Framework_TestCase {