From 52885f0ade390e2a657f3c5707b5aa467dcf4c71 Mon Sep 17 00:00:00 2001 From: Joseph Bielawski Date: Tue, 31 Mar 2015 10:41:35 +0200 Subject: [PATCH 1/6] [DoctrineBridge] Add missing variable declaration in testcase --- .../Bridge/Doctrine/Tests/ContainerAwareEventManagerTest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Symfony/Bridge/Doctrine/Tests/ContainerAwareEventManagerTest.php b/src/Symfony/Bridge/Doctrine/Tests/ContainerAwareEventManagerTest.php index 5185a75998..55991dbf4f 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/ContainerAwareEventManagerTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/ContainerAwareEventManagerTest.php @@ -16,6 +16,9 @@ use Symfony\Component\DependencyInjection\Container; class ContainerAwareEventManagerTest extends \PHPUnit_Framework_TestCase { + private $container; + private $evm; + protected function setUp() { $this->container = new Container(); From dbd02b087175c7817a39d047c6f6e237b8adeca5 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 2 Apr 2015 13:05:24 +0200 Subject: [PATCH 2/6] Use specialized config methods instead of the generic ifTrue() method --- .../FrameworkBundle/DependencyInjection/Configuration.php | 7 ++----- .../TwigBundle/DependencyInjection/Configuration.php | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index 2de60489a8..08bcc1c19d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -69,10 +69,7 @@ class Configuration implements ConfigurationInterface ->booleanNode('test')->end() ->scalarNode('default_locale')->defaultValue('en')->end() ->arrayNode('trusted_hosts') - ->beforeNormalization() - ->ifTrue(function ($v) { return is_string($v); }) - ->then(function ($v) { return array($v); }) - ->end() + ->beforeNormalization()->ifString()->then(function ($v) { return array($v); })->end() ->prototype('scalar')->end() ->end() ->end() @@ -263,7 +260,7 @@ class Configuration implements ConfigurationInterface ->addDefaultChildrenIfNoneSet() ->prototype('scalar')->defaultValue('FrameworkBundle:Form')->end() ->validate() - ->ifTrue(function ($v) {return !in_array('FrameworkBundle:Form', $v); }) + ->ifNotInArray(array('FrameworkBundle:Form')) ->then(function ($v) { return array_merge(array('FrameworkBundle:Form'), $v); }) diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php index a20ca8c1a8..8cc114ab29 100644 --- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php @@ -58,7 +58,7 @@ class Configuration implements ConfigurationInterface ->prototype('scalar')->defaultValue('form_div_layout.html.twig')->end() ->example(array('MyBundle::form.html.twig')) ->validate() - ->ifTrue(function ($v) { return !in_array('form_div_layout.html.twig', $v); }) + ->ifNotInArray(array('form_div_layout.html.twig')) ->then(function ($v) { return array_merge(array('form_div_layout.html.twig'), $v); }) From a95f7f38af2c7c6ce8266cf162a6eaff9bbcc45b Mon Sep 17 00:00:00 2001 From: stloyd Date: Tue, 31 Mar 2015 15:09:45 +0200 Subject: [PATCH 3/6] Fix some phpdocs for Twig extensions & templating helpers --- src/Symfony/Bridge/Twig/Extension/CodeExtension.php | 3 +++ src/Symfony/Bridge/Twig/Extension/HttpKernelExtension.php | 3 +++ src/Symfony/Bridge/Twig/Extension/RoutingExtension.php | 4 +--- src/Symfony/Bridge/Twig/Extension/SecurityExtension.php | 4 +--- src/Symfony/Bridge/Twig/Extension/TranslationExtension.php | 4 +--- src/Symfony/Bridge/Twig/Extension/YamlExtension.php | 4 +--- .../FrameworkBundle/Templating/Helper/ActionsHelper.php | 4 +--- .../Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php | 4 +--- .../FrameworkBundle/Templating/Helper/RequestHelper.php | 4 +--- .../Bundle/FrameworkBundle/Templating/Helper/RouterHelper.php | 4 +--- .../FrameworkBundle/Templating/Helper/SessionHelper.php | 4 +--- .../FrameworkBundle/Templating/Helper/TranslatorHelper.php | 4 +--- .../SecurityBundle/Templating/Helper/LogoutUrlHelper.php | 4 +--- .../SecurityBundle/Templating/Helper/SecurityHelper.php | 4 +--- src/Symfony/Bundle/TwigBundle/Extension/ActionsExtension.php | 3 +++ src/Symfony/Bundle/TwigBundle/Extension/AssetsExtension.php | 4 +--- 16 files changed, 22 insertions(+), 39 deletions(-) diff --git a/src/Symfony/Bridge/Twig/Extension/CodeExtension.php b/src/Symfony/Bridge/Twig/Extension/CodeExtension.php index 4a0c1e9c76..b5f619d327 100644 --- a/src/Symfony/Bridge/Twig/Extension/CodeExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/CodeExtension.php @@ -210,6 +210,9 @@ class CodeExtension extends \Twig_Extension }, $text); } + /** + * {@inheritdoc} + */ public function getName() { return 'code'; diff --git a/src/Symfony/Bridge/Twig/Extension/HttpKernelExtension.php b/src/Symfony/Bridge/Twig/Extension/HttpKernelExtension.php index 4d9919d16c..1da12aaf5e 100644 --- a/src/Symfony/Bridge/Twig/Extension/HttpKernelExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/HttpKernelExtension.php @@ -81,6 +81,9 @@ class HttpKernelExtension extends \Twig_Extension return new ControllerReference($controller, $attributes, $query); } + /** + * {@inheritdoc} + */ public function getName() { return 'http_kernel'; diff --git a/src/Symfony/Bridge/Twig/Extension/RoutingExtension.php b/src/Symfony/Bridge/Twig/Extension/RoutingExtension.php index 237c36c190..7469183e75 100644 --- a/src/Symfony/Bridge/Twig/Extension/RoutingExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/RoutingExtension.php @@ -89,9 +89,7 @@ class RoutingExtension extends \Twig_Extension } /** - * Returns the name of the extension. - * - * @return string The extension name + * {@inheritdoc} */ public function getName() { diff --git a/src/Symfony/Bridge/Twig/Extension/SecurityExtension.php b/src/Symfony/Bridge/Twig/Extension/SecurityExtension.php index edba0e7b8b..49863a4e3f 100644 --- a/src/Symfony/Bridge/Twig/Extension/SecurityExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/SecurityExtension.php @@ -52,9 +52,7 @@ class SecurityExtension extends \Twig_Extension } /** - * Returns the name of the extension. - * - * @return string The extension name + * {@inheritdoc} */ public function getName() { diff --git a/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php b/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php index 0fde3a675d..f1f2fbd20b 100644 --- a/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php @@ -99,9 +99,7 @@ class TranslationExtension extends \Twig_Extension } /** - * Returns the name of the extension. - * - * @return string The extension name + * {@inheritdoc} */ public function getName() { diff --git a/src/Symfony/Bridge/Twig/Extension/YamlExtension.php b/src/Symfony/Bridge/Twig/Extension/YamlExtension.php index 63d658da3b..fc9bf0e9e3 100644 --- a/src/Symfony/Bridge/Twig/Extension/YamlExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/YamlExtension.php @@ -56,9 +56,7 @@ class YamlExtension extends \Twig_Extension } /** - * Returns the name of the extension. - * - * @return string The extension name + * {@inheritdoc} */ public function getName() { diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/ActionsHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/ActionsHelper.php index d4a855d53b..8f0d54eada 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/ActionsHelper.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/ActionsHelper.php @@ -58,9 +58,7 @@ class ActionsHelper extends Helper } /** - * Returns the canonical name of this helper. - * - * @return string The canonical name + * {@inheritdoc} */ public function getName() { diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php index 94a9af0cc0..e7042e0dc3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php @@ -205,9 +205,7 @@ class CodeHelper extends Helper } /** - * Returns the canonical name of this helper. - * - * @return string The canonical name + * {@inheritdoc} */ public function getName() { diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/RequestHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/RequestHelper.php index 9f001f7f3f..b7fbfcdca7 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/RequestHelper.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/RequestHelper.php @@ -59,9 +59,7 @@ class RequestHelper extends Helper } /** - * Returns the canonical name of this helper. - * - * @return string The canonical name + * {@inheritdoc} */ public function getName() { diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/RouterHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/RouterHelper.php index 830e5c9019..d54caaf395 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/RouterHelper.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/RouterHelper.php @@ -50,9 +50,7 @@ class RouterHelper extends Helper } /** - * Returns the canonical name of this helper. - * - * @return string The canonical name + * {@inheritdoc} */ public function getName() { diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/SessionHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/SessionHelper.php index c4362df1db..675fe9dc90 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/SessionHelper.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/SessionHelper.php @@ -62,9 +62,7 @@ class SessionHelper extends Helper } /** - * Returns the canonical name of this helper. - * - * @return string The canonical name + * {@inheritdoc} */ public function getName() { diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/TranslatorHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/TranslatorHelper.php index 30816d736f..2c2641a885 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/TranslatorHelper.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/TranslatorHelper.php @@ -50,9 +50,7 @@ class TranslatorHelper extends Helper } /** - * Returns the canonical name of this helper. - * - * @return string The canonical name + * {@inheritdoc} */ public function getName() { diff --git a/src/Symfony/Bundle/SecurityBundle/Templating/Helper/LogoutUrlHelper.php b/src/Symfony/Bundle/SecurityBundle/Templating/Helper/LogoutUrlHelper.php index 1fef75ca09..9514ebf616 100644 --- a/src/Symfony/Bundle/SecurityBundle/Templating/Helper/LogoutUrlHelper.php +++ b/src/Symfony/Bundle/SecurityBundle/Templating/Helper/LogoutUrlHelper.php @@ -114,9 +114,7 @@ class LogoutUrlHelper extends Helper } /** - * Returns the canonical name of this helper. - * - * @return string The canonical name + * {@inheritdoc} */ public function getName() { diff --git a/src/Symfony/Bundle/SecurityBundle/Templating/Helper/SecurityHelper.php b/src/Symfony/Bundle/SecurityBundle/Templating/Helper/SecurityHelper.php index 7ca0e7bb66..a43f2b446d 100644 --- a/src/Symfony/Bundle/SecurityBundle/Templating/Helper/SecurityHelper.php +++ b/src/Symfony/Bundle/SecurityBundle/Templating/Helper/SecurityHelper.php @@ -48,9 +48,7 @@ class SecurityHelper extends Helper } /** - * Returns the canonical name of this helper. - * - * @return string The canonical name + * {@inheritdoc} */ public function getName() { diff --git a/src/Symfony/Bundle/TwigBundle/Extension/ActionsExtension.php b/src/Symfony/Bundle/TwigBundle/Extension/ActionsExtension.php index 3b08bd6859..76f4dff5c3 100644 --- a/src/Symfony/Bundle/TwigBundle/Extension/ActionsExtension.php +++ b/src/Symfony/Bundle/TwigBundle/Extension/ActionsExtension.php @@ -62,6 +62,9 @@ class ActionsExtension extends \Twig_Extension ); } + /** + * {@inheritdoc} + */ public function getName() { return 'actions'; diff --git a/src/Symfony/Bundle/TwigBundle/Extension/AssetsExtension.php b/src/Symfony/Bundle/TwigBundle/Extension/AssetsExtension.php index 929680597c..4f40c7a0d8 100644 --- a/src/Symfony/Bundle/TwigBundle/Extension/AssetsExtension.php +++ b/src/Symfony/Bundle/TwigBundle/Extension/AssetsExtension.php @@ -68,9 +68,7 @@ class AssetsExtension extends \Twig_Extension } /** - * Returns the name of the extension. - * - * @return string The extension name + * {@inheritdoc} */ public function getName() { From 6f5e95b762ae0c00585a814efbec7cc6b46b47ce Mon Sep 17 00:00:00 2001 From: Gerben Wijnja Date: Fri, 3 Apr 2015 01:10:26 +0200 Subject: [PATCH 4/6] [StringUtil] Fixed singularification of 'movies' The word 'movies' was singularified to 'movy'. There seem to be only two words ending in 'ovies', which are 'movies' and 'anchovies'. The singular of the latter is 'anchovy'. All other words ending in 'vies' singularify to 'vy', so the word 'movies' is an exception to the general rule. --- src/Symfony/Component/PropertyAccess/StringUtil.php | 3 +++ src/Symfony/Component/PropertyAccess/Tests/StringUtilTest.php | 1 + 2 files changed, 4 insertions(+) diff --git a/src/Symfony/Component/PropertyAccess/StringUtil.php b/src/Symfony/Component/PropertyAccess/StringUtil.php index 5fa1b1734f..2160f0f422 100644 --- a/src/Symfony/Component/PropertyAccess/StringUtil.php +++ b/src/Symfony/Component/PropertyAccess/StringUtil.php @@ -60,6 +60,9 @@ class StringUtil // indices (index), appendices (appendix), prices (price) array('seci', 4, false, true, array('ex', 'ix', 'ice')), + // movies (movie) + array('seivom', 6, true, true, 'movie'), + // babies (baby) array('sei', 3, false, true, 'y'), diff --git a/src/Symfony/Component/PropertyAccess/Tests/StringUtilTest.php b/src/Symfony/Component/PropertyAccess/Tests/StringUtilTest.php index 7c6376dbd6..73922cd72a 100644 --- a/src/Symfony/Component/PropertyAccess/Tests/StringUtilTest.php +++ b/src/Symfony/Component/PropertyAccess/Tests/StringUtilTest.php @@ -99,6 +99,7 @@ class StringUtilTest extends \PHPUnit_Framework_TestCase array('men', 'man'), array('mice', 'mouse'), array('moves', 'move'), + array('movies', 'movie'), array('nebulae', 'nebula'), array('neuroses', array('neuros', 'neurose', 'neurosis')), array('oases', array('oas', 'oase', 'oasis')), From 02cda0595c23a1811f2004295cd6abfb91f301cf Mon Sep 17 00:00:00 2001 From: Luis Cordova Date: Sun, 29 Mar 2015 03:09:29 -0500 Subject: [PATCH 5/6] [Enhancement] netbeans - force interactive shell when limited detection --- src/Symfony/Component/Console/Application.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index fa14441421..9daff3f301 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -855,7 +855,7 @@ class Application $input->setInteractive(false); } elseif (function_exists('posix_isatty') && $this->getHelperSet()->has('dialog')) { $inputStream = $this->getHelperSet()->get('dialog')->getInputStream(); - if (!@posix_isatty($inputStream)) { + if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) { $input->setInteractive(false); } } From 40ab7ef349751d3d7a9526780abf2ed8b227eb6e Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 3 Apr 2015 07:27:47 +0200 Subject: [PATCH 6/6] [HttpKernel] Embed the original exception as previous to bounced exceptions --- .../HttpKernel/EventListener/ExceptionListener.php | 13 ++++++++++++- .../Tests/EventListener/ExceptionListenerTest.php | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php b/src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php index a54fe45e9f..b1c1982f45 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php @@ -72,7 +72,18 @@ class ExceptionListener implements EventSubscriberInterface // set handling to false otherwise it wont be able to handle further more $handling = false; - // throwing $e, not $exception, is on purpose: fixing error handling code paths is the most important + $wrapper = $e; + + while ($prev = $wrapper->getPrevious()) { + if ($exception === $wrapper = $prev) { + throw $e; + } + } + + $prev = new \ReflectionProperty('Exception', 'previous'); + $prev->setAccessible(true); + $prev->setValue($wrapper, $exception); + throw $e; } diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php index 86244df0fc..8fb00f51c1 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php @@ -57,6 +57,7 @@ class ExceptionListenerTest extends \PHPUnit_Framework_TestCase $this->fail('RuntimeException expected'); } catch (\RuntimeException $e) { $this->assertSame('bar', $e->getMessage()); + $this->assertSame('foo', $e->getPrevious()->getMessage()); } } @@ -77,6 +78,7 @@ class ExceptionListenerTest extends \PHPUnit_Framework_TestCase $this->fail('RuntimeException expected'); } catch (\RuntimeException $e) { $this->assertSame('bar', $e->getMessage()); + $this->assertSame('foo', $e->getPrevious()->getMessage()); } $this->assertEquals(3, $logger->countErrors());