8000 Merge branch '2.3' into 2.4 · symfony/symfony@3bed1b7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3bed1b7

Browse files
committed
Merge branch '2.3' into 2.4
* 2.3: (22 commits) 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. [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 [Validator] Fixed and simplified IsbnValidator [Validator] Simplified IBAN validation algorithm ... Conflicts: src/Symfony/Component/Console/Helper/DescriptorHelper.php src/Symfony/Component/DependencyInjection/Container.php src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php src/Symfony/Component/HttpFoundation/File/UploadedFile.php src/Symfony/Component/HttpKernel/Fragment/FragmentHandler.php src/Symfony/Component/Validator/Constraints/AbstractComparisonValidator.php src/Symfony/Component/Validator/Constraints/CollectionValidator.php src/Symfony/Component/Validator/Tests/Constraints/EqualToValidatorTest.php src/Symfony/Component/Validator/Tests/Constraints/GreaterThanValidatorTest.php src/Symfony/Component/Validator/Tests/Constraints/IdenticalToValidatorTest.php src/Symfony/Component/Validator/Tests/Constraints/LessThanOrEqualValidatorTest.php src/Symfony/Component/Validator/Tests/Constraints/LessThanValidatorTest.php src/Symfony/Component/Validator/Tests/Constraints/NotEqualToValidatorTest.php src/Symfony/Component/Validator/Tests/Constraints/NotIdenticalToValidatorTest.php
2 parents 69e8100 + d754467 commit 3bed1b7

File tree

88 files changed

+751
-328
lines changed

Some content is hidden

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

88 files changed

+751
-328
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/Bridge/Propel1/Form/ChoiceList/ModelChoiceList.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ class ModelChoiceList extends ObjectChoiceList
8080
* Either an array if $choices is given,
8181
* or a ModelCriteria to be merged with the $queryObject.
8282
* @param PropertyAccessorInterface $propertyAccessor The reflection graph for reading property paths.
83+
*
84+
* @throws MissingOptionsException when no model class is given
85+
* @throws InvalidOptionsException when the model class cannot be found
8386
*/
8487
public function __construct($class, $labelPath = null, $choices = null, $queryObject = null, $groupPath = null, $preferred = array(), PropertyAccessorInterface $propertyAccessor = null)
8588
{

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
@@ -872,6 +872,8 @@ protected function configureIO(InputInterface $input, OutputInterface $output)
872872
* @param OutputInterface $output An Output instance
873873
*
874874
* @return int 0 if everything went fine, or an error code
875+
*
876+
* @throws \Exception when the command being run threw an exception
875877
*/
876878
protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
877879
{

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
@@ -325,7 +325,7 @@ public function askHiddenResponse(OutputInterface $output, $question, $fallback
325325
* @param OutputInterface $output An Output instance
326326
* @param string|array $question The question to ask
327327
* @param callable $validator A PHP callback
328-
* @param int $attempts Max number of times to ask before giving up (false by default, which means infinite)
328+
* @param int|false $attempts Max number of times to ask before giving up (false by default, which means infinite)
329329
* @param string $default The default answer if none is given by the user
330330
* @param array $autocomplete List of values to autocomplete
331331
*
@@ -354,7 +354,7 @@ public function askAndValidate(OutputInterface $output, $question, $validator, $
354354
* @param OutputInterface $output An Output instance
355355
* @param string|array $question The question to ask
356356
* @param callable $validator A PHP callback
357-
* @param int $attempts Max number of times to ask before giving up (false by default, which means infinite)
357+
* @param int|false $attempts Max number of times to ask before giving up (false by default, which means infinite)
358358
* @param bool $fallback In case the response can not be hidden, whether to fallback on non-hidden question or not
359359
*
360360
* @return string The response
@@ -448,7 +448,7 @@ private function hasSttyAvailable()
448448
* @param callable $interviewer A callable that will ask for a question and return the result
449449
* @param OutputInterface $output An Output instance
450450
* @param callable $validator A PHP callback
451-
* @param int $attempts Max number of times to ask before giving up ; false will ask infinitely
451+
* @param int|false $attempts Max number of times to ask before giving up ; false will ask infinitely
452452
*
453453
* @return string The validated response
454454
*

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ public function __construct()
8080
* @param int $layout self::LAYOUT_*
8181
*
8282
* @return TableHelper
83+
*
84+
* @throws InvalidArgumentException when the table layout is not known
8385
*/
8486
public function setLayout($layout)
8587
{

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
@@ -428,7 +428,10 @@ private function addServiceProperties($id, $definition, $variableName = 'instanc
428428
*
429429
* @param string $id
430430
* @param Definition $definition
431+
*
431432
* @return string
433+
*
434+
* @throws ServiceCircularReferenceException when the container contains a circular reference
432435
*/
433436
private function addServiceInlinedDefinitionsSetup($id, $definition)
434437
{
@@ -632,6 +635,8 @@ private function addServices()
632635
*
633636
* @param string $id A service identifier
634637
* @param Definition $definition A Definition instance
638+
*
639+
* @return string|null
635640
*/
636641
private function addServiceSynchronizer($id, Definition $definition)
637642
{

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

Lines changed: 2 additions & 0 deletions
97AE
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,8 @@ private function parseDefinition($id, $service, $file)
243243
* @param string $file
244244
*
245245
* @return array The file content
246+
*
247+
* @throws InvalidArgumentException when the given file is not a local file or when it does not exist
246248
*/
247249
protected function loadFile($file)
248250
{

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
@@ -891,7 +891,7 @@ private function relativize($xpath)
891891
$expression = $nonMatchingExpression;
892892
} elseif (0 === strpos($expression, 'descendant::')) {
893893
$expression = 'descendant-or-self::' . substr($expression, strlen('descendant::'));
894-
} elseif (0 !== strpos($expression, 'descendant-or-self::')) {
894+
} elseif (!preg_match('/^(ancestor|ancestor-or-self|attribute|child|descendant-or-self|following|following-sibling|parent|preceding|preceding-sibling|self)::/', $expression)) {
895895
$expression = 'self::' .$expression;
896896
}
897897
$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
@@ -495,6 +495,8 @@ public function setRequestHandler(RequestHandlerInterface $requestHandler)
495495
*
496496
* @param bool $initialize
497497
*
498+
* @return ButtonBuilder
499+
*
498500
* @throws BadMethodCallException
499501
*/
500502
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/Debug/TraceableEventDispatcher.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,9 @@ public function preListenerCall($eventName, $eventId, $listener)
252252
/**
253253
* Returns information about the listener
254254
*
255-
* @param object $listener The listener
256-
* @param string $eventName The event name
255+
* @param object $listener The listener
256+
* @param int|null $eventId The event id
257+
* @param string $eventName The event name
257258
*
258259
* @return array Information about the listener
259260
*/

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) {

0 commit comments

Comments
 (0)
0