Remove redundant sprintf arguments.
This commit is contained in:
parent
0cd875957b
commit
c8012f0448
@ -68,9 +68,9 @@ class CodeExtension extends AbstractExtension
|
|||||||
list($class, $method) = explode('::', $method, 2);
|
list($class, $method) = explode('::', $method, 2);
|
||||||
$result = sprintf('%s::%s()', $this->abbrClass($class), $method);
|
$result = sprintf('%s::%s()', $this->abbrClass($class), $method);
|
||||||
} elseif ('Closure' === $method) {
|
} elseif ('Closure' === $method) {
|
||||||
$result = sprintf('<abbr title="%s">%s</abbr>', $method, $method);
|
$result = sprintf('<abbr title="%s">%1$s</abbr>', $method);
|
||||||
} else {
|
} else {
|
||||||
$result = sprintf('<abbr title="%s">%s</abbr>()', $method, $method);
|
$result = sprintf('<abbr title="%s">%1$s</abbr>()', $method);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -74,11 +74,11 @@ class FormThemeTest extends TestCase
|
|||||||
protected function getVariableGetter($name)
|
protected function getVariableGetter($name)
|
||||||
{
|
{
|
||||||
if (\PHP_VERSION_ID >= 70000) {
|
if (\PHP_VERSION_ID >= 70000) {
|
||||||
return sprintf('($context["%s"] ?? null)', $name, $name);
|
return sprintf('($context["%s"] ?? null)', $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (\PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
|
return sprintf('(isset($context["%s"]) ? $context["%1$s"] : null)', $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return sprintf('$this->getContext($context, "%s")', $name);
|
return sprintf('$this->getContext($context, "%s")', $name);
|
||||||
|
@ -272,11 +272,11 @@ class SearchAndRenderBlockNodeTest extends TestCase
|
|||||||
protected function getVariableGetter($name)
|
protected function getVariableGetter($name)
|
||||||
{
|
{
|
||||||
if (\PHP_VERSION_ID >= 70000) {
|
if (\PHP_VERSION_ID >= 70000) {
|
||||||
return sprintf('($context["%s"] ?? null)', $name, $name);
|
return sprintf('($context["%s"] ?? null)', $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (\PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
|
return sprintf('(isset($context["%s"]) ? $context["%1$s"] : null)', $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return sprintf('$this->getContext($context, "%s")', $name);
|
return sprintf('$this->getContext($context, "%s")', $name);
|
||||||
|
@ -45,11 +45,11 @@ class TransNodeTest extends TestCase
|
|||||||
protected function getVariableGetterWithoutStrictCheck($name)
|
protected function getVariableGetterWithoutStrictCheck($name)
|
||||||
{
|
{
|
||||||
if (\PHP_VERSION_ID >= 70000) {
|
if (\PHP_VERSION_ID >= 70000) {
|
||||||
return sprintf('($context["%s"] ?? null)', $name, $name);
|
return sprintf('($context["%s"] ?? null)', $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (\PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
|
return sprintf('(isset($context["%s"]) ? $context["%1$s"] : null)', $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return sprintf('$this->getContext($context, "%s", true)', $name);
|
return sprintf('$this->getContext($context, "%s", true)', $name);
|
||||||
@ -58,15 +58,15 @@ class TransNodeTest extends TestCase
|
|||||||
protected function getVariableGetterWithStrictCheck($name)
|
protected function getVariableGetterWithStrictCheck($name)
|
||||||
{
|
{
|
||||||
if (Environment::MAJOR_VERSION >= 2) {
|
if (Environment::MAJOR_VERSION >= 2) {
|
||||||
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);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (\PHP_VERSION_ID >= 70000) {
|
if (\PHP_VERSION_ID >= 70000) {
|
||||||
return sprintf('($context["%s"] ?? $this->getContext($context, "%s"))', $name, $name, $name);
|
return sprintf('($context["%s"] ?? $this->getContext($context, "%1$s"))', $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (\PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
return sprintf('(isset($context["%s"]) ? $context["%s"] : $this->getContext($context, "%s"))', $name, $name, $name);
|
return sprintf('(isset($context["%s"]) ? $context["%1$s"] : $this->getContext($context, "%1$s"))', $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return sprintf('$this->getContext($context, "%s")', $name);
|
return sprintf('$this->getContext($context, "%s")', $name);
|
||||||
|
@ -60,9 +60,9 @@ class CodeHelper extends Helper
|
|||||||
list($class, $method) = explode('::', $method, 2);
|
list($class, $method) = explode('::', $method, 2);
|
||||||
$result = sprintf('%s::%s()', $this->abbrClass($class), $method);
|
$result = sprintf('%s::%s()', $this->abbrClass($class), $method);
|
||||||
} elseif ('Closure' === $method) {
|
} elseif ('Closure' === $method) {
|
||||||
$result = sprintf('<abbr title="%s">%s</abbr>', $method, $method);
|
$result = sprintf('<abbr title="%s">%1$s</abbr>', $method);
|
||||||
} else {
|
} else {
|
||||||
$result = sprintf('<abbr title="%s">%s</abbr>()', $method, $method);
|
$result = sprintf('<abbr title="%s">%1$s</abbr>()', $method);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -12,8 +12,8 @@
|
|||||||
namespace Symfony\Component\BrowserKit\Tests;
|
namespace Symfony\Component\BrowserKit\Tests;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\BrowserKit\CookieJar;
|
|
||||||
use Symfony\Component\BrowserKit\Cookie;
|
use Symfony\Component\BrowserKit\Cookie;
|
||||||
|
use Symfony\Component\BrowserKit\CookieJar;
|
||||||
use Symfony\Component\BrowserKit\Response;
|
use Symfony\Component\BrowserKit\Response;
|
||||||
|
|
||||||
class CookieJarTest extends TestCase
|
class CookieJarTest extends TestCase
|
||||||
@ -94,7 +94,7 @@ class CookieJarTest extends TestCase
|
|||||||
{
|
{
|
||||||
$timestamp = time() + 3600;
|
$timestamp = time() + 3600;
|
||||||
$date = gmdate('D, d M Y H:i:s \G\M\T', $timestamp);
|
$date = gmdate('D, d M Y H:i:s \G\M\T', $timestamp);
|
||||||
$setCookies = array(sprintf('foo=foo; expires=%s; domain=.symfony.com; path=/, bar=bar; domain=.blog.symfony.com, PHPSESSID=id; expires=%s', $date, $date));
|
$setCookies = array(sprintf('foo=foo; expires=%s; domain=.symfony.com; path=/, bar=bar; domain=.blog.symfony.com, PHPSESSID=id; expires=%1$s', $date));
|
||||||
|
|
||||||
$cookieJar = new CookieJar();
|
$cookieJar = new CookieJar();
|
||||||
$cookieJar->updateFromSetCookie($setCookies);
|
$cookieJar->updateFromSetCookie($setCookies);
|
||||||
|
@ -684,7 +684,7 @@ class Crawler extends \SplObjectStorage
|
|||||||
public function selectButton($value)
|
public function selectButton($value)
|
||||||
{
|
{
|
||||||
$translate = 'translate(@type, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz")';
|
$translate = 'translate(@type, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz")';
|
||||||
$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.' ')).
|
$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.' ')).
|
||||||
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)).
|
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)).
|
||||||
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));
|
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));
|
||||||
|
|
||||||
|
@ -437,7 +437,7 @@ class Form extends Link implements \ArrayAccess
|
|||||||
// corresponding elements are either descendants or have a matching HTML5 form attribute
|
// corresponding elements are either descendants or have a matching HTML5 form attribute
|
||||||
$formId = Crawler::xpathLiteral($this->node->getAttribute('id'));
|
$formId = Crawler::xpathLiteral($this->node->getAttribute('id'));
|
||||||
|
|
||||||
$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));
|
$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));
|
||||||
foreach ($fieldNodes as $node) {
|
foreach ($fieldNodes as $node) {
|
||||||
$this->addField($node);
|
$this->addField($node);
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,8 @@ namespace Symfony\Component\PropertyAccess;
|
|||||||
|
|
||||||
use Symfony\Component\PropertyAccess\Exception\AccessException;
|
use Symfony\Component\PropertyAccess\Exception\AccessException;
|
||||||
use Symfony\Component\PropertyAccess\Exception\InvalidArgumentException;
|
use Symfony\Component\PropertyAccess\Exception\InvalidArgumentException;
|
||||||
use Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException;
|
|
||||||
use Symfony\Component\PropertyAccess\Exception\NoSuchIndexException;
|
use Symfony\Component\PropertyAccess\Exception\NoSuchIndexException;
|
||||||
|
use Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException;
|
||||||
use Symfony\Component\PropertyAccess\Exception\UnexpectedTypeException;
|
use Symfony\Component\PropertyAccess\Exception\UnexpectedTypeException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -453,7 +453,7 @@ class PropertyAccessor implements PropertyAccessorInterface
|
|||||||
private function readProperty($zval, $property)
|
private function readProperty($zval, $property)
|
||||||
{
|
{
|
||||||
if (!is_object($zval[self::VALUE])) {
|
if (!is_object($zval[self::VALUE])) {
|
||||||
throw new NoSuchPropertyException(sprintf('Cannot read property "%s" from an array. Maybe you intended to write the property path as "[%s]" instead.', $property, $property));
|
throw new NoSuchPropertyException(sprintf('Cannot read property "%s" from an array. Maybe you intended to write the property path as "[%1$s]" instead.', $property));
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = self::$resultProto;
|
$result = self::$resultProto;
|
||||||
@ -595,7 +595,7 @@ class PropertyAccessor implements PropertyAccessorInterface
|
|||||||
private function writeProperty($zval, $property, $value)
|
private function writeProperty($zval, $property, $value)
|
||||||
{
|
{
|
||||||
if (!is_object($zval[self::VALUE])) {
|
if (!is_object($zval[self::VALUE])) {
|
||||||
throw new NoSuchPropertyException(sprintf('Cannot write property "%s" to an array. Maybe you should write the property path as "[%s]" instead?', $property, $property));
|
throw new NoSuchPropertyException(sprintf('Cannot write property "%s" to an array. Maybe you should write the property path as "[%1$s]" instead?', $property));
|
||||||
}
|
}
|
||||||
|
|
||||||
$object = $zval[self::VALUE];
|
$object = $zval[self::VALUE];
|
||||||
|
Reference in New Issue
Block a user