Merge branch '2.3' into 2.6

* 2.3:
  [HttpKernel] Embed the original exception as previous to bounced exceptions
  [Enhancement] netbeans - force interactive shell when limited detection
  [StringUtil] Fixed singularification of 'movies'
  Fix some phpdocs for Twig extensions & templating helpers
  Use specialized config methods instead of the generic ifTrue() method
  [DoctrineBridge] Add missing variable declaration in testcase

Conflicts:
	src/Symfony/Component/Console/Application.php
This commit is contained in:
Nicolas Grekas 2015-04-03 17:17:51 +02:00
commit 7adba99975
24 changed files with 47 additions and 47 deletions

View File

@ -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();

View File

@ -212,6 +212,9 @@ class CodeExtension extends \Twig_Extension
}, $text);
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'code';

View File

@ -81,6 +81,9 @@ class HttpKernelExtension extends \Twig_Extension
return new ControllerReference($controller, $attributes, $query);
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'http_kernel';

View File

@ -89,9 +89,7 @@ class RoutingExtension extends \Twig_Extension
}
/**
* Returns the name of the extension.
*
* @return string The extension name
* {@inheritdoc}
*/
public function getName()
{

View File

@ -52,9 +52,7 @@ class SecurityExtension extends \Twig_Extension
}
/**
* Returns the name of the extension.
*
* @return string The extension name
* {@inheritdoc}
*/
public function getName()
{

View File

@ -99,9 +99,7 @@ class TranslationExtension extends \Twig_Extension
}
/**
* Returns the name of the extension.
*
* @return string The extension name
* {@inheritdoc}
*/
public function getName()
{

View File

@ -56,9 +56,7 @@ class YamlExtension extends \Twig_Extension
}
/**
* Returns the name of the extension.
*
* @return string The extension name
* {@inheritdoc}
*/
public function getName()
{

View File

@ -79,10 +79,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()
@ -348,7 +345,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);
})

View File

@ -58,9 +58,7 @@ class ActionsHelper extends Helper
}
/**
* Returns the canonical name of this helper.
*
* @return string The canonical name
* {@inheritdoc}
*/
public function getName()
{

View File

@ -205,9 +205,7 @@ class CodeHelper extends Helper
}
/**
* Returns the canonical name of this helper.
*
* @return string The canonical name
* {@inheritdoc}
*/
public function getName()
{

View File

@ -82,9 +82,7 @@ class RequestHelper extends Helper
}
/**
* Returns the canonical name of this helper.
*
* @return string The canonical name
* {@inheritdoc}
*/
public function getName()
{

View File

@ -50,9 +50,7 @@ class RouterHelper extends Helper
}
/**
* Returns the canonical name of this helper.
*
* @return string The canonical name
* {@inheritdoc}
*/
public function getName()
{

View File

@ -85,9 +85,7 @@ class SessionHelper extends Helper
}
/**
* Returns the canonical name of this helper.
*
* @return string The canonical name
* {@inheritdoc}
*/
public function getName()
{

View File

@ -50,9 +50,7 @@ class TranslatorHelper extends Helper
}
/**
* Returns the canonical name of this helper.
*
* @return string The canonical name
* {@inheritdoc}
*/
public function getName()
{

View File

@ -121,9 +121,7 @@ class LogoutUrlHelper extends Helper
}
/**
* Returns the canonical name of this helper.
*
* @return string The canonical name
* {@inheritdoc}
*/
public function getName()
{

View File

@ -48,9 +48,7 @@ class SecurityHelper extends Helper
}
/**
* Returns the canonical name of this helper.
*
* @return string The canonical name
* {@inheritdoc}
*/
public function getName()
{

View File

@ -70,7 +70,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);
})

View File

@ -62,6 +62,9 @@ class ActionsExtension extends \Twig_Extension
);
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'actions';

View File

@ -79,9 +79,7 @@ class AssetsExtension extends \Twig_Extension
}
/**
* Returns the name of the extension.
*
* @return string The extension name
* {@inheritdoc}
*/
public function getName()
{

View File

@ -830,7 +830,7 @@ class Application
$input->setInteractive(false);
} elseif (function_exists('posix_isatty') && $this->getHelperSet()->has('question')) {
$inputStream = $this->getHelperSet()->get('question')->getInputStream();
if (!@posix_isatty($inputStream)) {
if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) {
$input->setInteractive(false);
}
}

View File

@ -62,7 +62,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;
}

View File

@ -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());

View File

@ -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'),

View File

@ -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')),