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 c8012f0

Browse filesBrowse files
committed
Remove redundant sprintf arguments.
1 parent 0cd8759 commit c8012f0
Copy full SHA for c8012f0

File tree

9 files changed

+20
-20
lines changed
Filter options

9 files changed

+20
-20
lines changed

‎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/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
@@ -684,7 +684,7 @@ public function selectLink($value)
684684
public function selectButton($value)
685685
{
686686
$translate = 'translate(@type, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz")';
687-
$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.' ')).
687+
$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.' ')).
688688
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)).
689689
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));
690690

‎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
@@ -437,7 +437,7 @@ private function initialize()
437437
// corresponding elements are either descendants or have a matching HTML5 form attribute
438438
$formId = Crawler::xpathLiteral($this->node->getAttribute('id'));
439439

440-
$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));
440+
$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));
441441
foreach ($fieldNodes as $node) {
442442
$this->addField($node);
443443
}

‎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
/**
@@ -453,7 +453,7 @@ private function readIndex($zval, $index)
453453
private function readProperty($zval, $property)
454454
{
455455
if (!is_object($zval[self::VALUE])) {
456-
throw new NoSuchPropertyException(sprintf('Cannot read property "%s" from an array. Maybe you intended to write the property path as "[%s]" instead.', $property, $property));
456+
throw new NoSuchPropertyException(sprintf('Cannot read property "%s" from an array. Maybe you intended to write the property path as "[%1$s]" instead.', $property));
457457
}
458458

459459
$result = self::$resultProto;
@@ -595,7 +595,7 @@ private function writeIndex($zval, $index, $value)
595595
private function writeProperty($zval, $property, $value)
596596
{
597597
if (!is_object($zval[self::VALUE])) {
598-
throw new NoSuchPropertyException(sprintf('Cannot write property "%s" to an array. Maybe you should write the property path as "[%s]" instead?', $property, $property));
598+
throw new NoSuchPropertyException(sprintf('Cannot write property "%s" to an array. Maybe you should write the property path as "[%1$s]" instead?', $property));
599599
}
600600

601601
$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.