Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 865622e

Browse filesBrowse files
Merge branch '2.7' into 2.8
* 2.7: [HttpFoundation] Fix FileBag issue with associative arrays fix the phpdoc that is not really inherited from response Minor docblock cleanup Remove redundant sprintf arguments.
2 parents 2b95ba3 + 8555114 commit 865622e
Copy full SHA for 865622e

File tree

Expand file treeCollapse file tree

15 files changed

+46
-36
lines changed
Filter options
Expand file treeCollapse file tree

15 files changed

+46
-36
lines changed

‎src/Symfony/Bridge/Doctrine/Security/RememberMe/DoctrineTokenProvider.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Security/RememberMe/DoctrineTokenProvider.php
-6Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@
3737
*/
3838
class DoctrineTokenProvider implements TokenProviderInterface
3939
{
40-
/**
41-
* Doctrine DBAL database connection
42-
* F.ex. service id: doctrine.dbal.default_connection.
43-
*
44-
* @var Connection
45-
*/
4640
private $conn;
4741

4842
public function __construct(Connection $conn)

‎src/Symfony/Bridge/Twig/Extension/CodeExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/Extension/CodeExtension.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ public function abbrMethod($method)
6868
list($class, $method) = explode('::', $method, 2);
6969
$result = sprintf('%s::%s()', $this->abbrClass($class), $method);
7070
} elseif ('Closure' === $method) {
71-
$result = sprintf('<abbr title="%s">%s</abbr>', $method, $method);
71+
$result = sprintf('<abbr title="%s">%1$s</abbr>', $method);
7272
} else {
73-
$result = sprintf('<abbr title="%s">%s</abbr>()', $method, $method);
73+
$result = sprintf('<abbr title="%s">%1$s</abbr>()', $method);
7474
}
7575

7676
return $result;

‎src/Symfony/Bridge/Twig/Tests/Node/FormThemeTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/Tests/Node/FormThemeTest.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ public function testCompile()
7474
protected function getVariableGetter($name)
7575
{
7676
if (\PHP_VERSION_ID >= 70000) {
77-
return sprintf('($context["%s"] ?? null)', $name, $name);
77+
return sprintf('($context["%s"] ?? null)', $name);
7878
}
7979

8080
if (\PHP_VERSION_ID >= 50400) {
81-
return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
81+
return sprintf('(isset($context["%s"]) ? $context["%1$s"] : null)', $name);
8282
}
8383

8484
return sprintf('$this->getContext($context, "%s")', $name);

‎src/Symfony/Bridge/Twig/Tests/Node/SearchAndRenderBlockNodeTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/Tests/Node/SearchAndRenderBlockNodeTest.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,11 +272,11 @@ public function testCompileLabelWithLabelThatEvaluatesToNullAndAttributes()
272272
protected function getVariableGetter($name)
273273
{
274274
if (\PHP_VERSION_ID >= 70000) {
275-
return sprintf('($context["%s"] ?? null)', $name, $name);
275+
return sprintf('($context["%s"] ?? null)', $name);
276276
}
277277

278278
if (\PHP_VERSION_ID >= 50400) {
279-
return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
279+
return sprintf('(isset($context["%s"]) ? $context["%1$s"] : null)', $name);
280280
}
281281

282282
return sprintf('$this->getContext($context, "%s")', $name);

‎src/Symfony/Bridge/Twig/Tests/Node/TransNodeTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/Tests/Node/TransNodeTest.php
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ public function testCompileStrict()
4545
protected function getVariableGetterWithoutStrictCheck($name)
4646
{
4747
if (\PHP_VERSION_ID >= 70000) {
48-
return sprintf('($context["%s"] ?? null)', $name, $name);
48+
return sprintf('($context["%s"] ?? null)', $name);
4949
}
5050

5151
if (\PHP_VERSION_ID >= 50400) {
52-
return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
52+
return sprintf('(isset($context["%s"]) ? $context["%1$s"] : null)', $name);
5353
}
5454

5555
return sprintf('$this->getContext($context, "%s", true)', $name);
@@ -58,15 +58,15 @@ protected function getVariableGetterWithoutStrictCheck($name)
5858
protected function getVariableGetterWithStrictCheck($name)
5959
{
6060
if (Environment::MAJOR_VERSION >= 2) {
61-
return sprintf('(isset($context["%s"]) || array_key_exists("%s", $context) ? $context["%s"] : (function () { throw new Twig_Error_Runtime(\'Variable "%s" does not exist.\', 0, $this->getSourceContext()); })())', $name, $name, $name, $name);
61+
return sprintf('(isset($context["%s"]) || array_key_exists("%1$s", $context) ? $context["%1$s"] : (function () { throw new Twig_Error_Runtime(\'Variable "%1$s" does not exist.\', 0, $this->getSourceContext()); })())', $name);
6262
}
6363

6464
if (\PHP_VERSION_ID >= 70000) {
65-
return sprintf('($context["%s"] ?? $this->getContext($context, "%s"))', $name, $name, $name);
65+
return sprintf('($context["%s"] ?? $this->getContext($context, "%1$s"))', $name);
6666
}
6767

6868
if (\PHP_VERSION_ID >= 50400) {
69-
return sprintf('(isset($context["%s"]) ? $context["%s"] : $this->getContext($context, "%s"))', $name, $name, $name);
69+
return sprintf('(isset($context["%s"]) ? $context["%1$s"] : $this->getContext($context, "%1$s"))', $name);
7070
}
7171

7272
return sprintf('$this->getContext($context, "%s")', $name);

‎src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ public function abbrMethod($method)
6060
list($class, $method) = explode('::', $method, 2);
6161
$result = sprintf('%s::%s()', $this->abbrClass($class), $method);
6262
} elseif ('Closure' === $method) {
63-
$result = sprintf('<abbr title="%s">%s</abbr>', $method, $method);
63+
$result = sprintf('<abbr title="%s">%1$s</abbr>', $method);
6464
} else {
65-
$result = sprintf('<abbr title="%s">%s</abbr>()', $method, $method);
65+
$result = sprintf('<abbr title="%s">%1$s</abbr>()', $method);
6666
}
6767

6868
return $result;

‎src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,6 @@ private function configureDbalAclProvider(array $config, ContainerBuilder $conta
160160
$container->setParameter('security.acl.dbal.sid_table_name', $config['tables']['security_identity']);
161161
}
162162

163-
/**
164-
* Loads the web configuration.
165-
*/
166163
private function createRoleHierarchy(array $config, ContainerBuilder $container)
167164
{
168165
if (!isset($config['role_hierarchy']) || 0 === count($config['role_hierarchy'])) {

‎src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@
2626
*/
2727
class TwigExtension extends Extension
2828
{
29-
/**
30-
* Responds to the twig configuration parameter.
31-
*/
3229
public function load(array $configs, ContainerBuilder $container)
3330
{
3431
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));

‎src/Symfony/Component/BrowserKit/Tests/CookieJarTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/BrowserKit/Tests/CookieJarTest.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
namespace Symfony\Component\BrowserKit\Tests;
1313

1414
use PHPUnit\Framework\TestCase;
15-
use Symfony\Component\BrowserKit\CookieJar;
1615
use Symfony\Component\BrowserKit\Cookie;
16+
use Symfony\Component\BrowserKit\CookieJar;
1717
use Symfony\Component\BrowserKit\Response;
1818

1919
class CookieJarTest extends TestCase
@@ -94,7 +94,7 @@ public function testUpdateFromSetCookieWithMultipleCookies()
9494
{
9595
$timestamp = time() + 3600;
9696
$date = gmdate('D, d M Y H:i:s \G\M\T', $timestamp);
97-
$setCookies = array(sprintf('foo=foo; expires=%s; domain=.symfony.com; path=/, bar=bar; domain=.blog.symfony.com, PHPSESSID=id; expires=%s', $date, $date));
97+
$setCookies = array(sprintf('foo=foo; expires=%s; domain=.symfony.com; path=/, bar=bar; domain=.blog.symfony.com, PHPSESSID=id; expires=%1$s', $date));
9898

9999
$cookieJar = new CookieJar();
100100
$cookieJar->updateFromSetCookie($setCookies);

‎src/Symfony/Component/DomCrawler/Crawler.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DomCrawler/Crawler.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ public function selectLink($value)
682682
public function selectButton($value)
683683
{
684684
$translate = 'translate(@type, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz")';
685-
$xpath = sprintf('descendant-or-self::input[((contains(%s, "submit") or contains(%s, "button")) and contains(concat(\' \', normalize-space(string(@value)), \' \'), %s)) ', $translate, $translate, static::xpathLiteral(' '.$value.' ')).
685+
$xpath = sprintf('descendant-or-self::input[((contains(%s, "submit") or contains(%1$s, "button")) and contains(concat(\' \', normalize-space(string(@value)), \' \'), %s)) ', $translate, static::xpathLiteral(' '.$value.' ')).
686686
sprintf('or (contains(%s, "image") and contains(concat(\' \', normalize-space(string(@alt)), \' \'), %s)) or @id=%s or @name=%s] ', $translate, static::xpathLiteral(' '.$value.' '), static::xpathLiteral($value), static::xpathLiteral($value)).
687687
sprintf('| descendant-or-self::button[contains(concat(\' \', normalize-space(string(.)), \' \'), %s) or @id=%s or @name=%s]', static::xpathLiteral(' '.$value.' '), static::xpathLiteral($value), static::xpathLiteral($value));
688688

‎src/Symfony/Component/DomCrawler/Form.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DomCrawler/Form.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ private function initialize()
433433
// corresponding elements are either descendants or have a matching HTML5 form attribute
434434
$formId = Crawler::xpathLiteral($this->node->getAttribute('id'));
435435

436-
$fieldNodes = $xpath->query(sprintf('descendant::input[@form=%s] | descendant::button[@form=%s] | descendant::textarea[@form=%s] | descendant::select[@form=%s] | //form[@id=%s]//input[not(@form)] | //form[@id=%s]//button[not(@form)] | //form[@id=%s]//textarea[not(@form)] | //form[@id=%s]//select[not(@form)]', $formId, $formId, $formId, $formId, $formId, $formId, $formId, $formId));
436+
$fieldNodes = $xpath->query(sprintf('descendant::input[@form=%s] | descendant::button[@form=%1$s] | descendant::textarea[@form=%1$s] | descendant::select[@form=%1$s] | //form[@id=%1$s]//input[not(@form)] | //form[@id=%1$s]//button[not(@form)] | //form[@id=%1$s]//textarea[not(@form)] | //form[@id=%1$s]//select[not(@form)]', $formId));
437437
foreach ($fieldNodes as $node) {
438438
$this->addField($node);
439439
}

‎src/Symfony/Component/HttpFoundation/FileBag.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/FileBag.php
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,10 @@ protected function convertFileInformation($file)
8787
$file = new UploadedFile($file['tmp_name'], $file['name'], $file['type'], $file['size'], $file['error']);
8888
}
8989
} else {
90-
$file = array_filter(array_map(array($this, 'convertFileInformation'), $file));
90+
$file = array_map(array($this, 'convertFileInformation'), $file);
91+
if (array_keys($keys) === $keys) {
92+
$file = array_filter($file);
93+
}
9194
}
9295
}
9396

‎src/Symfony/Component/HttpFoundation/RedirectResponse.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/RedirectResponse.php
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,13 @@ public function __construct($url, $status = 302, $headers = array())
4444
}
4545

4646
/**
47-
* {@inheritdoc}
47+
* Factory method for chainability.
48+
*
49+
* @param string $url The url to redirect to
50+
* @param int $status The response status code
51+
* @param array $headers An array of response headers
52+
*
53+
* @return static
4854
*/
4955
public static function create($url = '', $status = 302, $headers = array())
5056
{

‎src/Symfony/Component/HttpFoundation/Tests/FileBagTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Tests/FileBagTest.php
+15-2Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,28 @@ public function testShouldSetEmptyUploadedFilesToNull()
6262

6363
public function testShouldRemoveEmptyUploadedFilesForMultiUpload()
6464
{
65-
$bag = new FileBag(array('file' => array(
65+
$bag = new FileBag(array('files' => array(
6666
'name' => array(''),
6767
'type' => array(''),
6868
'tmp_name' => array(''),
6969
'error' => array(UPLOAD_ERR_NO_FILE),
7070
'size' => array(0),
7171
)));
7272

73-
$this->assertSame(array(), $bag->get('file'));
73+
$this->assertSame(array(), $bag->get('files'));
74+
}
75+
76+
public function testShouldNotRemoveEmptyUploadedFilesForAssociativeArray()
77+
{
78+
$bag = new FileBag(array('files' => array(
79+
'name' => array('file1' => ''),
80+
'type' => array('file1' => ''),
81+
'tmp_name' => array('file1' => ''),
82+
'error' => array('file1' => UPLOAD_ERR_NO_FILE),
83+
'size' => array('file1' => 0),
84+
)));
85+
86+
$this->assertSame(array('file1' => null), $bag->get('files'));
7487
}
7588

7689
public function testShouldConvertUploadedFilesWithPhpBug()

‎src/Symfony/Component/PropertyAccess/PropertyAccessor.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/PropertyAccess/PropertyAccessor.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
use Symfony\Component\PropertyAccess\Exception\AccessException;
1515
use Symfony\Component\PropertyAccess\Exception\InvalidArgumentException;
16-
use Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException;
1716
use Symfony\Component\PropertyAccess\Exception\NoSuchIndexException;
17+
use Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException;
1818
use Symfony\Component\PropertyAccess\Exception\UnexpectedTypeException;
1919

2020
/**
@@ -439,7 +439,7 @@ private function readIndex($zval, $index)
439439
private function readProperty($zval, $property)
440440
{
441441
if (!is_object($zval[self::VALUE])) {
442-
throw new NoSuchPropertyException(sprintf('Cannot read property "%s" from an array. Maybe you intended to write the property path as "[%s]" instead.', $property, $property));
442+
throw new NoSuchPropertyException(sprintf('Cannot read property "%s" from an array. Maybe you intended to write the property path as "[%1$s]" instead.', $property));
443443
}
444444

445445
$result = self::$resultProto;
@@ -581,7 +581,7 @@ private function writeIndex($zval, $index, $value)
581581
private function writeProperty($zval, $property, $value)
582582
{
583583
if (!is_object($zval[self::VALUE])) {
584-
throw new NoSuchPropertyException(sprintf('Cannot write property "%s" to an array. Maybe you should write the property path as "[%s]" instead?', $property, $property));
584+
throw new NoSuchPropertyException(sprintf('Cannot write property "%s" to an array. Maybe you should write the property path as "[%1$s]" instead?', $property));
585585
}
586586

587587
$object = $zval[self::VALUE];

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.