8000 Merge branch '2.8' into 3.4 · symfony/symfony@faec031 · GitHub
[go: up one dir, main page]

Skip to content

Commit faec031

Browse files
Merge branch '2.8' into 3.4
* 2.8: Remove duplicate condition fix useless space in docblock remove unneeded tearDown method [FrameworkBundle] Fix broken exception message Revert "fixed CS" Skip empty proxy code [Security] Fix "exclude-from-classmap" add missing double-quotes to extra_fields output message Convert InsufficientAuthenticationException to HttpException
2 parents c2478d4 + 0c6f671 commit faec031

File tree

19 files changed

+71
-50
lines changed

19 files changed

+71
-50
lines changed

src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public function __construct(ContainerInterface $container)
4141
*
4242
* @param string $eventName The name of the event to dispatch. The name of the event is
4343
* the name of the method that is invoked on listeners.
44-
* @param EventArgs $eventArgs the event arguments to pass to the event handlers/listeners.
45-
* If not supplied, the single empty EventArgs instance is used
44+
* @param EventArgs $eventArgs The event arguments to pass to the event handlers/listeners.
45+
* If not supplied, the single empty EventArgs instance is used.
4646
*
4747
* @return bool
4848
*/

src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
195195
$currentName = $transPaths[0];
196196

197197
if (!is_dir($transPaths[0])) {
198-
throw new InvalidArgumentException(sprintf('<error>"%s" is neither an enabled bundle nor a directory.</error>', $transPaths[0]));
198+
throw new InvalidArgumentException(sprintf('"%s" is neither an enabled bundle nor a directory.', $transPaths[0]));
199199
}
200200
}
201201
}

src/Symfony/Component/Console/Command/Command.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,14 +309,13 @@ public function mergeApplicationDefinition($mergeArgs = true)
309309

310310
$this->definition->addOptions($this->application->getDefinition()->getOptions());
311311

312+
$this->applicationDefinitionMerged = true;
313+
312314
if ($mergeArgs) {
313315
$currentArguments = $this->definition->getArguments();
314316
$this->definition->setArguments($this->application->getDefinition()->getArguments());
315317
$this->definition->addArguments($currentArguments);
316-
}
317318

318-
$this->applicationDefinitionMerged = true;
319-
if ($mergeArgs) {
320319
$this->applicationDefinitionMergedWithArgs = true;
321320
}
322321
}

src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,9 @@ private function generateProxyClasses()
367367
$alreadyGenerated[$class] = true;
368368
// register class' reflector for resource tracking
369369
$this->container->getReflectionClass($class);
370-
$proxyCode = "\n".$proxyDumper->getProxyCode($definition);
370+
if ("\n" === $proxyCode = "\n".$proxyDumper->getProxyCode($definition)) {
371+
continue;
372+
}
371373
if ($strip) {
372374
$proxyCode = "<?php\n".$proxyCode;
373375
$proxyCode = substr(Kernel::stripComments($proxyCode), 5);

src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ public function __construct(ContainerInterface $container)
5656
* @param string $eventName Event for which the listener is added
5757
* @param array $callback The service ID of the listener service & the method
5858
* name that has to be called
59-
* @param int $priority the higher this value, the earlier an event listener
59+
* @param int $priority The higher this value, the earlier an event listener
6060
* will be triggered in the chain.
61-
* Defaults to 0
61+
* Defaults to 0.
6262
*
6363
* @throws \InvalidArgumentException
6464
*/

src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public function validate($form, Constraint $constraint)
127127
if (!$config->getOption('allow_extra_fields') && \count($form->getExtraData()) > 0) {
128128
$this->context->setConstraint($constraint);
129129
$this->context->buildViolation($config->getOption('extra_fields_message'))
130-
->setParameter('{{ extra_fields }}', implode('", "', array_keys($form->getExtraData())))
130+
->setParameter('{{ extra_fields }}', '"'.implode('", "', array_keys($form->getExtraData())).'"')
131131
->setInvalidValue($form->getExtraData())
132132
->setCode(Form::NO_SUCH_FIELD_ERROR)
133133
->addViolation();

src/Symfony/Component/Form/FormConfigBuilderInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,10 @@ public function setRequestHandler(RequestHandlerInterface $requestHandler);
257257
*
258258
* Should be set to true only for root forms.
259259
*
260-
* @param bool $initialize true to initialize the form automatically,
260+
* @param bool $initialize True to initialize the form automatically,
261261
* false to suppress automatic initialization.
262262
* In the second case, you need to call
263-
* {@link FormInterface::initialize()} manually
263+
* {@link FormInterface::initialize()} manually.
264264
*
265265
* @return $this The configuration object
266266
*/

src/Symfony/Component/Form/FormInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ public function getData();
127127
/**
128128
* Returns the normalized data of the field.
129129
*
130-
* @return mixed when the field is not submitted, the default data is returned.
130+
* @return mixed When the field is not submitted, the default data is returned.
131131
* When the field is submitted, the normalized submitted data is
132-
* returned if the field is valid, null otherwise
132+
* returned if the field is valid, null otherwise.
133133
*/
134134
public function getNormData();
135135

src/Symfony/Component/Form/FormRendererEngineInterface.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ public function setTheme(FormView $view, $themes /*, $useDefaultThemes = true */
3838
* The type of the resource is decided by the implementation. The resource
3939
* is later passed to {@link renderBlock()} by the rendering algorithm.
4040
*
41-
* @param FormView $view the view for determining the used themes.
41+
* @param FormView $view The view for determining the used themes.
4242
* First the themes attached directly to the
4343
* view with {@link setTheme()} are considered,
44-
* then the ones of its parent etc
44+
* then the ones of its parent etc.
4545
* @param string $blockName The name of the block to render
4646
*
4747
* @return mixed the renderer resource or false, if none was found
@@ -70,10 +70,10 @@ public function getResourceForBlockName(FormView $view, $blockName);
7070
* The type of the resource is decided by the implementation. The resource
7171
* is later passed to {@link renderBlock()} by the rendering algorithm.
7272
*
73-
* @param FormView $view the view for determining the used themes.
73+
* @param FormView $view The view for determining the used themes.
7474
* First the themes attached directly to
7575
* the view with {@link setTheme()} are
76-
* considered, then the ones of its parent etc
76+
* considered, then the ones of its parent etc.
7777
* @param array $blockNameHierarchy The block name hierarchy, with the root block
7878
* at the beginning
7979
* @param int $hierarchyLevel The level in the hierarchy at which to start
@@ -108,10 +108,10 @@ public function getResourceForBlockNameHierarchy(FormView $view, array $blockNam
108108
* The type of the resource is decided by the implementation. The resource
109109
* is later passed to {@link renderBlock()} by the rendering algorithm.
110110
*
111-
* @param FormView $view the view for determining the used themes.
111+
* @param FormView $view The view for determining the used themes.
112112
* First the themes attached directly to
113113
* the view with {@link setTheme()} are
114-
* considered, then the ones of its parent etc
114+
* considered, then the ones of its parent etc.
115115
* @param array $blockNameHierarchy The block name hierarchy, with the root block
116116
* at the beginning
117117
* @param int $hierarchyLevel The level in the hierarchy at which to start

src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,12 +592,33 @@ public function testViolationIfExtraData()
592592
$this->validator->validate($form, new Form());
593593

594594
$this->buildViolation('Extra!')
595-
->setParameter('{{ extra_fields }}', 'foo')
595+
->setParameter('{{ extra_fields }}', '"foo"')
596596
->setInvalidValue(array('foo' => 'bar'))
597597
->setCode(Form::NO_SUCH_FIELD_ERROR)
598598
->assertRaised();
599599
}
600600

601+
public function testViolationFormatIfMultipleExtraFields()
602+
{
603+
$form = $this->getBuilder('parent', null, array('extra_fields_message' => 'Extra!'))
604+
->setCompound(true)
605+
->setDataMapper($this->getDataMapper())
606+
->add($this->getBuilder('child'))
607+
->getForm();
608+
609+
$form->submit(array('foo' => 'bar', 'baz' => 'qux', 'quux' => 'quuz'));
610+
611+
$this->expectNoValidate();
612+
613+
$this->validator->validate($form, new Form());
614+
615+
$this->buildViolation('Extra!')
616+
->setParameter('{{ extra_fields }}', '"foo", "baz", "quux"')
617+
->setInvalidValue(array('foo' => 'bar', 'baz' => 'qux', 'quux' => 'quuz'))
618+
->setCode(Form::NO_SUCH_FIELD_ERROR)
619+
->assertRaised();
620+
}
621+
601622
public function testNoViolationIfAllowExtraData()
602623
{
603624
$context = $this->getMockExecutionContext();

src/Symfony/Component/Form/Util/OrderedHashMapIterator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ class OrderedHashMapIterator implements \Iterator
6262
* keys
6363
* @param array $orderedKeys The keys of the map in the order in which
6464
* they should be iterated
65-
* @param array $managedCursors an array from which to reference the
65+
* @param array $managedCursors An array from which to reference the
6666
* iterator's cursor as long as it is alive.
6767
* This array is managed by the corresponding
6868
* {@link OrderedHashMap} instance to support
69-
* recognizing the deletion of elements
69+
* recognizing the deletion of elements.
7070
*/
7171
public function __construct(array &$elements, array &$orderedKeys, array &$managedCursors)
7272
{

src/Symfony/Component/HttpFoundation/AcceptHeaderItem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public static function fromString($itemValue)
6565
}
6666

6767
/**
68-
* Returns header value's string representation.
68+
* Returns header value's string representation.
6969
*
7070
* @return string
7171
*/

src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
class NativeFileSessionHandler extends NativeSessionHandler
2020
{
2121
/**
22-
* @param string $savePath path of directory to save session files
22+
* @param string $savePath Path of directory to save session files
2323
* Default null will leave setting as defined by PHP.
2424
* '/path', 'N;/path', or 'N;octal-mode;/path
2525
*

src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,9 +506,9 @@ public function setPattern($pattern)
506506
/**
507507
* Set the formatter's timezone identifier.
508508
*
509-
* @param string $timeZoneId the time zone ID string of the time zone to use.
509+
* @param string $timeZoneId The time zone ID string of the time zone to use.
510510
* If NULL or the empty string, the default time zone for the
511-
* runtime is used
511+
* runtime is used.
512512
*
513513
* @return bool true on success or false on failure
514514
*

src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,9 @@ class NumberFormatter
242242

243243
/**
244244
* @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
245-
* @param int $style style of the formatting, one of the format style constants.
245+
* @param int $style Style of the formatting, one of the format style constants.
246246
* The only supported styles are NumberFormatter::DECIMAL
247-
* and NumberFormatter::CURRENCY
247+
* and NumberFormatter::CURRENCY.
248248
* @param string $pattern Not supported. A pattern string in case $style is NumberFormat::PATTERN_DECIMAL or
249249
* NumberFormat::PATTERN_RULEBASED. It must conform to the syntax
250250
* described in the ICU DecimalFormat or ICU RuleBasedNumberFormat documentation
@@ -279,9 +279,9 @@ public function __construct($locale = 'en', $style = null, $pattern = null)
279279
* Static constructor.
280280
*
281281
* @param string $locale The locale code. The only supported locale is "en" (or null using the default locale, i.e. "en")
282-
* @param int $style style of the formatting, one of the format style constants.
282+
* @param int $style Style of the formatting, one of the format style constants.
283283
* The only currently supported styles are NumberFormatter::DECIMAL
284-
* and NumberFormatter::CURRENCY
284+
* and NumberFormatter::CURRENCY.
285285
* @param string $pattern Not supported. A pattern string in case $style is NumberFormat::PATTERN_DECIMAL or
286286
* NumberFormat::PATTERN_RULEBASED. It must conform to the syntax
287287
* described in the ICU DecimalFormat or ICU RuleBasedNumberFormat documentation
@@ -341,8 +341,8 @@ public function formatCurrency($value, $currency)
341341
* Format a number.
342342
*
343343
* @param int|float $value The value to format
344-
* @param int $type type of the formatting, one of the format type constants.
345-
* Only type NumberFormatter::TYPE_DEFAULT is currently supported
344+
* @param int $type Type of the formatting, one of the format type constants.
345+
* Only type NumberFormatter::TYPE_DEFAULT is currently supported.
346346
*
347347
* @return bool|string The formatted value or false on error
348348
*
@@ -551,9 +551,9 @@ public function parse($value, $type = self::TYPE_DOUBLE, &$position = 0)
551551
/**
552552
* Set an attribute.
553553
*
554-
* @param int $attr an attribute specifier, one of the numeric attribute constants.
554+
* @param int $attr An attribute specifier, one of the numeric attribute constants.
555555
* The only currently supported attributes are NumberFormatter::FRACTION_DIGITS,
556-
* NumberFormatter::GROUPING_USED and NumberFormatter::ROUNDING_MODE
556+
* NumberFormatter::GROUPING_USED and NumberFormatter::ROUNDING_MODE.
557557
* @param int $value The attribute value
558558
*
559559
* @return bool true on success or false on failure

src/Symfony/Component/Security/Guard/Tests/Authenticator/FormLoginAuthenticatorTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,6 @@ protected function setUp()
143143
->setDefaultSuccessRedirectUrl(self::DEFAULT_SUCCESS_URL)
144144
;
145145
}
146-
147-
protected function tearDown()
148-
{
149-
$this->request = null;
150-
$this->requestWithSession = null;
151-
}
152146
}
153147

154148
class TestFormLoginAuthenticator extends AbstractFormLoginAuthenticator

src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Symfony\Component\HttpFoundation\Response;
1818
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
1919
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
20+
use Symfony\Component\HttpKernel\Exception\HttpException;
2021
use Symfony\Component\HttpKernel\HttpKernelInterface;
2122
use Symfony\Component\HttpKernel\KernelEvents;
2223
use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface;
@@ -176,7 +177,7 @@ private function handleLogoutException(LogoutException $exception)
176177
private function startAuthentication(Request $request, AuthenticationException $authException)
177178
{
178179
if (null === $this->authenticationEntryPoint) {
179-
throw $authException;
180+
throw new HttpException(Response::HTTP_UNAUTHORIZED, $authException->getMessage(), $authException, array(), $authException->getCode());
180181
}
181182

182183
if (null !== $this->logger) {

src/Symfony/Component/Security/Http/Tests/Firewall/ExceptionListenerTest.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Symfony\Component\HttpFoundation\Request;
1616
use Symfony\Component\HttpFoundation\Response;
1717
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
18+
use Symfony\Component\HttpKernel\Exception\HttpException;
1819
use Symfony\Component\HttpKernel\HttpKernelInterface;
1920
use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface;
2021
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
@@ -30,15 +31,15 @@ class ExceptionListenerTest extends TestCase
3031
/**
3132
* @dataProvider getAuthenticationExceptionProvider
3233
*/
33-
public function testAuthenticationExceptionWithoutEntryPoint(\Exception $exception, \Exception $eventException = null)
34+
public function testAuthenticationExceptionWithoutEntryPoint(\Exception $exception, \Exception $eventException)
3435
{
3536
$event = $this->createEvent($exception);
3637

3738
$listener = $this->createExceptionListener();
3839
$listener->onKernelException($event);
3940

4041
$this->assertNull($event->getResponse());
41-
$this->assertSame(null === $eventException ? $exception : $eventException, $event->getException());
42+
$this->assertEquals($eventException, $event->getException());
4243
}
4344

4445
/**
@@ -63,11 +64,11 @@ public function testAuthenticationExceptionWithEntryPoint(\Exception $exception)
6364
public function getAuthenticationExceptionProvider()
6465
{
6566
return array(
66-
array(new AuthenticationException()),
67-
array(new \LogicException('random', 0, $e = new AuthenticationException()), $e),
68-
array(new \LogicException('random', 0, $e = new AuthenticationException('embed', 0, new AuthenticationException())), $e),
69-
array(new \LogicException('random', 0, $e = new AuthenticationException('embed', 0, new AccessDeniedException())), $e),
70-
array(new AuthenticationException('random', 0, new \LogicException())),
67+
array($e = new AuthenticationException(), new HttpException(Response::HTTP_UNAUTHORIZED, '', $e, array(), 0)),
68+
array(new \LogicException('random', 0, $e = new AuthenticationException()), new HttpException(Response::HTTP_UNAUTHORIZED, '', $e, array(), 0)),
69+
array(new \LogicException('random', 0, $e = new AuthenticationException('embed', 0, new AuthenticationException())), new HttpException(Response::HTTP_UNAUTHORIZED, 'embed', $e, array(), 0)),
70+
array(new \LogicException('random', 0, $e = new AuthenticationException('embed', 0, new AccessDeniedException())), new HttpException(Response::HTTP_UNAUTHORIZED, 'embed', $e, array(), 0)),
71+
array($e = new AuthenticationException('random', 0, new \LogicException()), new HttpException(Response::HTTP_UNAUTHORIZED, 'random', $e, array(), 0)),
7172
);
7273
}
7374

src/Symfony/Component/Security/composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@
5151
"autoload": {
5252
"psr-4": { "Symfony\\Component\\Security\\": "" },
5353
"exclude-from-classmap": [
54-
"/Tests/"
54+
"/Core/Tests/",
55+
"/Csrf/Tests/",
56+
"/Guard/Tests/",
57+
"/Http/Tests/"
5558
]
5659
},
5760
"minimum-stability": "dev",

0 commit comments

Comments
 (0)
0