Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 98c0621

Browse files
committed
Merge branch '2.4' into 2.5
* 2.4: (24 commits) [Validator] Added Swedish translations Fix incorrect romanian plural translations fix axes handling in Crawler::filterXPath() fix some docblocks Fixed self-reference in 'service_container' service breaks garbage collection (and clone). [Process] Fix tests when pcntl is not available. [DependencyInjection] Roll back changes made to generated files. [Console] Roll back changes made to fixture files. Issue #11489 Added some CA and ES translations [Validator] Added more detailed inline documentation [Validator] Removed information from the violation output if the value is an array, object or resource partially reverted previous commit fixed CS properly handle null data when denormalizing [Validator] Renamed valueToString() to formatValue(); added missing formatValue() calls [Validator] Fixed CS [Validator] Fixed date-to-string conversion tests to match ICU 51 [Validator] Added "{{ value }}" parameters where they were missing [Validator] Simplified and explained the LuhnValidator [Validator] Simplified IssnValidator ... Conflicts: src/Symfony/Bridge/Propel1/Form/ChoiceList/ModelChoiceList.php src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php src/Symfony/Component/Security/Core/Encoder/BasePasswordEncoder.php src/Symfony/Component/Validator/Constraints/ChoiceValidator.php src/Symfony/Component/Validator/Constraints/CollectionValidator.php src/Symfony/Component/Validator/Constraints/FileValidator.php src/Symfony/Component/Validator/Constraints/Isbn.php src/Symfony/Component/Validator/Constraints/IsbnValidator.php src/Symfony/Component/Validator/Constraints/LengthValidator.php src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php src/Symfony/Component/Validator/Tests/Constraints/BlankValidatorTest.php src/Symfony/Component/Validator/Tests/Constraints/ChoiceValidatorTest.php src/Symfony/Component/Validator/Tests/Constraints/CollectionValidatorTest.php src/Symfony/Component/Validator/Tests/Constraints/DateTimeValidatorTest.php src/Symfony/Component/Validator/Tests/Constraints/DateValidatorTest.php src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php src/Symfony/Component/Validator/Tests/Constraints/FalseValidatorTest.php src/Symfony/Component/Validator/Tests/Constraints/FileValidatorPathTest.php src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php src/Symfony/Component/Validator/Tests/Constraints/IbanValidatorTest.php src/Symfony/Component/Validator/Tests/Constraints/IpValidatorTest.php src/Symfony/Component/Validator/Tests/Constraints/IsbnValidatorTest.php src/Symfony/Component/Validator/Tests/Constraints/LengthValidatorTest.php src/Symfony/Component/Validator/Tests/Constraints/NullValidatorTest.php src/Symfony/Component/Validator/Tests/Constraints/RegexValidatorTest.php src/Symfony/Component/Validator/Tests/Constraints/TimeValidatorTest.php src/Symfony/Component/Validator/Tests/Constraints/TrueValidatorTest.php src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php
2 parents a6a7f5d + a4ec72e commit 98c0621

File tree

98 files changed

+839
-404
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+839
-404
lines changed

src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ abstract class RegisterMappingsPass implements CompilerPassInterface
7474
* @param string[] $managerParameters list of container parameters
7575
* that could hold the manager name
7676
* @param string $driverPattern pattern to get the metadata driver service names
77-
* @param string $enabledParameter service container parameter that must be
77+
* @param string|false $enabledParameter service container parameter that must be
7878
* present to enable the mapping. Set to false
7979
* to not do any check, optional.
8080
*/

src/Symfony/Component/Config/Definition/BaseNode.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ public function getParent()
292292
*
293293
* @return mixed The finalized value
294294
*
295+
* @throws Exception
295296
* @throws InvalidConfigurationException
296297
*/
297298
final public function finalize($value)

src/Symfony/Component/Console/Application.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,8 @@ protected function configureIO(InputInterface $input, OutputInterface $output)
874874
* @param OutputInterface $output An Output instance
875875
*
876876
* @return int 0 if everything went fine, or an error code
877+
*
878+
* @throws \Exception when the command being run threw an exception
877879
*/
878880
protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
879881
{

src/Symfony/Component/Console/Helper/DescriptorHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function __construct()
5454
* @param object $object
5555
* @param array $options
5656
*
57-
* @throws \InvalidArgumentException
57+
* @throws \InvalidArgumentException when the given format is not supported
5858
*/
5959
public function describe(OutputInterface $output, $object, array $options = array())
6060
{

src/Symfony/Component/Console/Helper/DialogHelper.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ public function askHiddenResponse(OutputInterface $output, $question, $fallback
328328
* @param OutputInterface $output An Output instance
329329
* @param string|array $question The question to ask
330330
* @param callable $validator A PHP callback
331-
* @param int $attempts Max number of times to ask before giving up (false by default, which means infinite)
331+
* @param int|false $attempts Max number of times to ask before giving up (false by default, which means infinite)
332332
* @param string $default The default answer if none is given by the user
333333
* @param array $autocomplete List of values to autocomplete
334334
*
@@ -357,7 +357,7 @@ public function askAndValidate(OutputInterface $output, $question, $validator, $
357357
* @param OutputInterface $output An Output instance
358358
* @param string|array $question The question to ask
359359
* @param callable $validator A PHP callback
360-
* @param int $attempts Max number of times to ask before giving up (false by default, which means infinite)
360+
* @param int|false $attempts Max number of times to ask before giving up (false by default, which means infinite)
361361
* @param bool $fallback In case the response can not be hidden, whether to fallback on non-hidden question or not
362362
*
363363
* @return string The response
@@ -451,7 +451,7 @@ private function hasSttyAvailable()
451451
* @param callable $interviewer A callable that will ask for a question and return the result
452452
* @param OutputInterface $output An Output instance
453453
* @param callable $validator A PHP callback
454-
* @param int $attempts Max number of times to ask before giving up ; false will ask infinitely
454+
* @param int|false $attempts Max number of times to ask before giving up ; false will ask infinitely
455455
*
456456
* @return string The validated response
457457
*

src/Symfony/Component/Console/Helper/TableHelper.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ public function __construct()
4444
* @param int $layout self::LAYOUT_*
4545
*
4646
* @return TableHelper
47+
*
48+
* @throws InvalidArgumentException when the table layout is not known
4749
*/
4850
public function setLayout($layout)
4951
{

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function testExecuteListsCommandsWithRawOption()
5050
public function testExecuteListsCommandsWithNamespaceArgument()
5151
{
5252

53-
require_once(realpath(__DIR__.'/../Fixtures/FooCommand.php'));
53+
require_once realpath(__DIR__.'/../Fixtures/FooCommand.php');
5454
$application = new Application();
5555
$application->add(new \FooCommand());
5656
$commandTester = new CommandTester($command = $application->get('list'));

src/Symfony/Component/DependencyInjection/Container.php

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,12 @@ public function set($id, $service, $scope = self::SCOPE_CONTAINER)
197197

198198
$id = strtolower($id);
199199

200+
if ('service_container' === $id) {
201+
// BC: 'service_container' is no longer a self-reference but always
202+
// $this, so ignore this call.
203+
// @todo Throw InvalidArgumentException in next major release.
204+
return;
205+
}
200206
if (self::SCOPE_CONTAINER !== $scope) {
201207
if (!isset($this->scopedServices[$scope])) {
202208
throw new RuntimeException(sprintf('You cannot set service "%s" of inactive scope.', $id));
@@ -233,6 +239,10 @@ public function has($id)
233239
{
234240
$id = strtolower($id);
235241

242+
if ('service_container' === $id) {
243+
return true;
244+
}
245+
236246
return isset($this->services[$id])
237247
|| array_key_exists($id, $this->services)
238248
|| isset($this->aliases[$id])
@@ -251,9 +261,10 @@ public function has($id)
251261
*
252262
* @return object The associated service
253263
*
254-
* @throws InvalidArgumentException if the service is not defined
264+
* @throws InvalidArgumentException if the service is not defined
255265
* @throws ServiceCircularReferenceException When a circular reference is detected
256-
* @throws ServiceNotFoundException When the service is not defined
266+
* @throws ServiceNotFoundException When the service is not defined
267+
* @throws \Exception if an exception has been thrown when the service has been resolved
257268
*
258269
* @see Reference
259270
*
@@ -269,6 +280,9 @@ public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE
269280
if ($strtolower) {
270281
$id = strtolower($id);
271282
}
283+
if ('service_container' === $id) {
284+
return $this;
285+
}
272286
if (isset($this->aliases[$id])) {
273287
$id = $this->aliases[$id];
274288
}
@@ -340,6 +354,12 @@ public function initialized($id)
340354
{
341355
$id = strtolower($id);
342356

357+
if ('service_container' === $id) {
358+
// BC: 'service_container' was a synthetic service previously.
359+
// @todo Change to false in next major release.
360+
return true;
361+
}
362+
343363
return isset($this->services[$id]) || array_key_exists($id, $this->services);
344364
}
345365

@@ -357,6 +377,7 @@ public function getServiceIds()
357377
$ids[] = self::underscore($match[1]);
358378
}
359379
}
380+
$ids[] = 'service_container';
360381

361382
return array_unique(array_merge($ids, array_keys($this->services)));
362383
}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,10 @@ private function addServiceProperties($id, $definition, $variableName = 'instanc
429429
*
430430
* @param string $id
431431
* @param Definition $definition
432+
*
432433
* @return string
434+
*
435+
* @throws ServiceCircularReferenceException when the container contains a circular reference
433436
*/
434437
private function addServiceInlinedDefinitionsSetup($id, $definition)
435438
{
@@ -640,6 +643,8 @@ private function addServices()
640643
*
641644
* @param string $id A service identifier
642645
* @param Definition $definition A Definition instance
646+
*
647+
* @return string|null
643648
*/
644649
private function addServiceSynchronizer($id, Definition $definition)
645650
{

src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ private function parseDefinition($id, $service, $file)
248248
* @param string $file
249249
*
250250
* @return array The file content
251+
*
252+
* @throws InvalidArgumentException when the given file is not a local file or when it does not exist
251253
*/
252254
protected function loadFile($file)
253255
{

src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public function testAliases()
140140
eval('?>'.$dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Aliases')));
141141

142142
$container = new \Symfony_DI_PhpDumper_Test_Aliases();
143-
$container->set('foo', $foo = new \stdClass);
143+
$container->set('foo', $foo = new \stdClass());
144144
$this->assertSame($foo, $container->get('foo'));
145145
$this->assertSame($foo, $container->get('alias_for_foo'));
146146
$this->assertSame($foo, $container->get('alias_for_alias'));

src/Symfony/Component/DomCrawler/Crawler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ private function relativize($xpath)
889889
$expression = $nonMatchingExpression;
890890
} elseif (0 === strpos($expression, 'descendant::')) {
891891
$expression = 'descendant-or-self::' . substr($expression, strlen('descendant::'));
892-
} elseif (0 !== strpos($expression, 'descendant-or-self::')) {
892+
} elseif (!preg_match('/^(ancestor|ancestor-or-self|attribute|child|descendant-or-self|following|following-sibling|parent|preceding|preceding-sibling|self)::/', $expression)) {
893893
$expression = 'self::' .$expression;
894894
}
895895
$expressions[] = $parenthesis.$expression;

src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,74 @@ public function testFilterXPathWithAnUrl()
472472
$this->assertSame('Music', $crawler->text());
473473
}
474474

475+
public function testFilterXPathWithAncestorAxis()
476+
{
477+
$crawler = $this->createTestCrawler()->filterXPath('//form');
478+
479+
$this->assertCount(2, $crawler->filterXPath('ancestor::*'));
480+
}
481+
482+
public function testFilterXPathWithAncestorOrSelfAxis()
483+
{
484+
$crawler = $this->createTestCrawler()->filterXPath('//form');
485+
486+
$this->assertCount(3, $crawler->filterXPath('ancestor-or-self::*'));
487+
}
488+
489+
public function testFilterXPathWithAttributeAxis()
490+
{
491+
$crawler = $this->createTestCrawler()->filterXPath('//form');
492+
493+
$this->assertCount(2, $crawler->filterXPath('attribute::*'));
494+
}
495+
496+
public function testFilterXPathWithChildAxis()
497+
{
498+
$crawler = $this->createTestCrawler()->filterXPath('//body');
499+
500+
$this->assertCount(2, $crawler->filterXPath('child::input'));
501+
}
502+
503+
public function testFilterXPathWithFollowingAxis()
504+
{
505+
$crawler = $this->createTestCrawler()->filterXPath('//a');
506+
507+
$this->assertCount(3, $crawler->filterXPath('following::div'));
508+
}
509+
510+
public function testFilterXPathWithFollowingSiblingAxis()
511+
{
512+
$crawler = $this->createTestCrawler()->filterXPath('//a');
513+
514+
$this->assertCount(2, $crawler->filterXPath('following-sibling::div'));
515+
}
516+
517+
public function testFilterXPathWithParentAxis()
518+
{
519+
$crawler = $this->createTestCrawler()->filterXPath('//button');
520+
521+
$this->assertEquals('foo', $crawler->filterXPath('parent::*')->attr('action'));
522+
}
523+
524+
public function testFilterXPathWithPrecedingAxis()
525+
{
526+
$crawler = $this->createTestCrawler()->filterXPath('//form');
527+
528+
$this->assertCount(13, $crawler->filterXPath('preceding::*'));
529+
}
530+
531+
public function testFilterXPathWithPrecedingSiblingAxis()
532+
{
533+
$crawler = $this->createTestCrawler()->filterXPath('//form');
534+
535+
$this->assertCount(9, $crawler->filterXPath('preceding-sibling::*'));
536+
}
537+
538+
public function testFilterXPathWithSelfAxes()
539+
{
540+
$this->assertCount(1, $this->createTestCrawler()->filterXPath('self::*'));
541+
}
542+
475543
/**
476544
* @covers Symfony\Component\DomCrawler\Crawler::filter
477545
*/

src/Symfony/Component/Form/ButtonBuilder.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,8 @@ public function setRequestHandler(RequestHandlerInterface $requestHandler)
503503
*
504504
* @param bool $initialize
505505
*
506+
* @return ButtonBuilder
507+
*
506508
* @throws BadMethodCallException
507509
*/
508510
public function setAutoInitialize($initialize)

src/Symfony/Component/HttpFoundation/BinaryFileResponse.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ public function __construct($file, $status = 200, $headers = array(), $public =
6161
* @param null|string $contentDisposition The type of Content-Disposition to set automatically with the filename
6262
* @param bool $autoEtag Whether the ETag header should be automatically set
6363
* @param bool $autoLastModified Whether the Last-Modified header should be automatically set
64+
*
65+
* @return BinaryResponse The created response
6466
*/
6567
public static function create($file = null, $status = 200, $headers = array(), $public = true, $contentDisposition = null, $autoEtag = false, $autoLastModified = true)
6668
{

src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ public function validContentProvider()
781781
public function invalidContentProvider()
782782
{
783783
return array(
784-
'obj' => array(new \stdClass),
784+
'obj' => array(new \stdClass()),
785785
'array' => array(array()),
786786
'bool' => array(true, '1'),
787787
);

src/Symfony/Component/HttpKernel/Fragment/FragmentHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function setRequest(Request $request = null)
9797
* @return string|null The Response content or null when the Response is streamed
9898
*
9999
* @throws \InvalidArgumentException when the renderer does not exist
100-
* @throws \LogicException when the Request is not successful
100+
* @throws \LogicException when no master request is being handled
101101
*/
102102
public function render($uri, $renderer = 'inline', array $options = array())
103103
{

src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,7 @@ public function testXForwarderForHeaderForPassRequests()
11771177

11781178
public function testEsiCacheRemoveValidationHeadersIfEmbeddedResponses()
11791179
{
1180-
$time = new \DateTime;
1180+
$time = new \DateTime();
11811181

11821182
$responses = array(
11831183
array(

src/Symfony/Component/Process/Tests/ExecutableFinderTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function testFind()
4646

4747
$this->setPath(dirname(PHP_BINARY));
4848

49-
$finder = new ExecutableFinder;
49+
$finder = new ExecutableFinder();
5050
$result = $finder->find($this->getPhpBinaryName());
5151

5252
$this->assertSamePath(PHP_BINARY, $result);
@@ -62,7 +62,7 @@ public function testFindWithDefault()
6262

6363
$this->setPath('');
6464

65-
$finder = new ExecutableFinder;
65+
$finder = new ExecutableFinder();
6666
$result = $finder->find('foo', $expected);
6767

6868
$this->assertEquals($expected, $result);
@@ -82,7 +82,7 @@ public function testFindWithExtraDirs()
8282

8383
$extraDirs = array(dirname(PHP_BINARY));
8484

85-
$finder = new ExecutableFinder;
85+
$finder = new ExecutableFinder();
8686
$result = $finder->find($this->getPhpBinaryName(), null, $extraDirs);
8787

8888
$this->assertSamePath(PHP_BINARY, $result);
@@ -104,7 +104,7 @@ public function testFindWithOpenBaseDir()
104104

105105
ini_set('open_basedir', dirname(PHP_BINARY).PATH_SEPARATOR.'/');
106106

107-
$finder = new ExecutableFinder;
107+
$finder = new ExecutableFinder();
108108
$result = $finder->find($this->getPhpBinaryName());
109109

110110
$this->assertSamePath(PHP_BINARY, $result);

src/Symfony/Component/Process/Tests/SimpleProcessTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public function testKillSignalTerminatesProcessCleanly()
167167
$process = $this->getProcess('php -r "echo \'foo\'; sleep(1); echo \'bar\';"');
168168
$process->run(function () use ($process) {
169169
if ($process->isRunning()) {
170-
$process->signal(SIGKILL);
170+
$process->signal(defined('SIGKILL') ? SIGKILL : 9);
171171
}
172172
});
173173
} catch (RuntimeException $e) {
@@ -183,7 +183,7 @@ public function testTermSignalTerminatesProcessCleanly()
183183
$process = $this->getProcess('php -r "echo \'foo\'; sleep(1); echo \'bar\';"');
184184
$process->run(function () use ($process) {
185185
if ($process->isRunning()) {
186-
$process->signal(SIGTERM);
186+
$process->signal(defined('SIGTERM') ? SIGTERM : 15);
187187
}
188188
});
189189
} catch (RuntimeException $e) {

src/Symfony/Component/Security/Acl/Dbal/MutableAclProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -865,10 +865,10 @@ private function updateNewFieldAceProperty($name, array $changes)
865865
}
866866

867867
/**
868-
* This process old entries changes on an ACE related property (classFieldAces, or objectFieldAces).
868+
* This processes old entries changes on an ACE related property (classFieldAces, or objectFieldAces).
869869
*
870870
* @param string $name
871-
* @param array $changes
871+
* @param array $changes
872872
*/
873873
private function updateOldFieldAceProperty($name, array $changes)
874874
{

src/Symfony/Component/Security/Core/Encoder/BCryptPasswordEncoder.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ public function __construct($cost)
6161
*
6262
* @return string The encoded password
6363
*
64+
* @throws BadCredentialsException when the given password is too long
65+
*
6466
* @link http://lxr.php.net/xref/PHP_5_5/ext/standard/password.c#111
6567
*/
6668
public function encodePassword($raw, $salt)

src/Symfony/Component/Security/Core/Encoder/BasePasswordEncoder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ protected function comparePasswords($password1, $password2)
8989
/**
9090
* Checks if the password is too long.
9191
*
92-
* @param string $password The password
92+
* @param string $password The password to check
9393
*
9494
* @return bool true if the password is too long, false otherwise
9595
*/

0 commit comments

Comments
 (0)