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 84c06b5

Browse filesBrowse files
committed
Prefix all sprintf() calls
1 parent 1c7cee8 commit 84c06b5
Copy full SHA for 84c06b5

23 files changed

+49
-49
lines changed

‎Exception/SyntaxErrorException.php

Copy file name to clipboardExpand all lines: Exception/SyntaxErrorException.php
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ class SyntaxErrorException extends ParseException
2525
{
2626
public static function unexpectedToken(string $expectedValue, Token $foundToken): self
2727
{
28-
return new self(sprintf('Expected %s, but %s found.', $expectedValue, $foundToken));
28+
return new self(\sprintf('Expected %s, but %s found.', $expectedValue, $foundToken));
2929
}
3030

3131
public static function pseudoElementFound(string $pseudoElement, string $unexpectedLocation): self
3232
{
33-
return new self(sprintf('Unexpected pseudo-element "::%s" found %s.', $pseudoElement, $unexpectedLocation));
33+
return new self(\sprintf('Unexpected pseudo-element "::%s" found %s.', $pseudoElement, $unexpectedLocation));
3434
}
3535

3636
public static function unclosedString(int $position): self
3737
{
38-
return new self(sprintf('Unclosed/invalid string at %s.', $position));
38+
return new self(\sprintf('Unclosed/invalid string at %s.', $position));
3939
}
4040

4141
public static function nestedNot(): self
@@ -45,7 +45,7 @@ public static function nestedNot(): self
4545

4646
public static function notAtTheStartOfASelector(string $pseudoElement): self
4747
{
48-
return new self(sprintf('Got immediate child pseudo-element ":%s" not at the start of a selector', $pseudoElement));
48+
return new self(\sprintf('Got immediate child pseudo-element ":%s" not at the start of a selector', $pseudoElement));
4949
}
5050

5151
public static function stringAsFunctionArgument(): self

‎Node/AttributeNode.php

Copy file name to clipboardExpand all lines: Node/AttributeNode.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function __toString(): string
6767
$attribute = $this->namespace ? $this->namespace.'|'.$this->attribute : $this->attribute;
6868

6969
return 'exists' === $this->operator
70-
? sprintf('%s[%s[%s]]', $this->getNodeName(), $this->selector, $attribute)
71-
: sprintf("%s[%s[%s %s '%s']]", $this->getNodeName(), $this->selector, $attribute, $this->operator, $this->value);
70+
? \sprintf('%s[%s[%s]]', $this->getNodeName(), $this->selector, $attribute)
71+
: \sprintf("%s[%s[%s %s '%s']]", $this->getNodeName(), $this->selector, $attribute, $this->operator, $this->value);
7272
}
7373
}

‎Node/ClassNode.php

Copy file name to clipboardExpand all lines: Node/ClassNode.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ public function getSpecificity(): Specificity
4646

4747
public function __toString(): string
4848
{
49-
return sprintf('%s[%s.%s]', $this->getNodeName(), $this->selector, $this->name);
49+
return \sprintf('%s[%s.%s]', $this->getNodeName(), $this->selector, $this->name);
5050
}
5151
}

‎Node/CombinedSelectorNode.php

Copy file name to clipboardExpand all lines: Node/CombinedSelectorNode.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,6 @@ public function __toString(): string
5454
{
5555
$combinator = ' ' === $this->combinator ? '<followed>' : $this->combinator;
5656

57-
return sprintf('%s[%s %s %s]', $this->getNodeName(), $this->selector, $combinator, $this->subSelector);
57+
return \sprintf('%s[%s %s %s]', $this->getNodeName(), $this->selector, $combinator, $this->subSelector);
5858
}
5959
}

‎Node/ElementNode.php

Copy file name to clipboardExpand all lines: Node/ElementNode.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,6 @@ public function __toString(): string
4848
{
4949
$element = $this->element ?: '*';
5050

51-
return sprintf('%s[%s]', $this->getNodeName(), $this->namespace ? $this->namespace.'|'.$element : $element);
51+
return \sprintf('%s[%s]', $this->getNodeName(), $this->namespace ? $this->namespace.'|'.$element : $element);
5252
}
5353
}

‎Node/FunctionNode.php

Copy file name to clipboardExpand all lines: Node/FunctionNode.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,6 @@ public function __toString(): string
6565
{
6666
$arguments = implode(', ', array_map(fn (Token $token) => "'".$token->getValue()."'", $this->arguments));
6767

68-
return sprintf('%s[%s:%s(%s)]', $this->getNodeName(), $this->selector, $this->name, $arguments ? '['.$arguments.']' : '');
68+
return \sprintf('%s[%s:%s(%s)]', $this->getNodeName(), $this->selector, $this->name, $arguments ? '['.$arguments.']' : '');
6969
}
7070
}

‎Node/HashNode.php

Copy file name to clipboardExpand all lines: Node/HashNode.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ public function getSpecificity(): Specificity
4646

4747
public function __toString(): string
4848
{
49-
return sprintf('%s[%s#%s]', $this->getNodeName(), $this->selector, $this->id);
49+
return \sprintf('%s[%s#%s]', $this->getNodeName(), $this->selector, $this->id);
5050
}
5151
}

‎Node/MatchingNode.php

Copy file name to clipboardExpand all lines: Node/MatchingNode.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@ public function __toString(): string
5050
$this->arguments,
5151
);
5252

53-
return sprintf('%s[%s:is(%s)]', $this->getNodeName(), $this->selector, implode(', ', $selectorArguments));
53+
return \sprintf('%s[%s:is(%s)]', $this->getNodeName(), $this->selector, implode(', ', $selectorArguments));
5454
}
5555
}

‎Node/NegationNode.php

Copy file name to clipboardExpand all lines: Node/NegationNode.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ public function getSpecificity(): Specificity
4646

4747
public function __toString(): string
4848
{
49-
return sprintf('%s[%s:not(%s)]', $this->getNodeName(), $this->selector, $this->subSelector);
49+
return \sprintf('%s[%s:not(%s)]', $this->getNodeName(), $this->selector, $this->subSelector);
5050
}
5151
}

‎Node/PseudoNode.php

Copy file name to clipboardExpand all lines: Node/PseudoNode.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ public function getSpecificity(): Specificity
4949

5050
public function __toString(): string
5151
{
52-
return sprintf('%s[%s:%s]', $this->getNodeName(), $this->selector, $this->identifier);
52+
return \sprintf('%s[%s:%s]', $this->getNodeName(), $this->selector, $this->identifier);
5353
}
5454
}

‎Node/SelectorNode.php

Copy file name to clipboardExpand all lines: Node/SelectorNode.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ public function getSpecificity(): Specificity
4949

5050
public function __toString(): string
5151
{
52-
return sprintf('%s[%s%s]', $this->getNodeName(), $this->tree, $this->pseudoElement ? '::'.$this->pseudoElement : '');
52+
return \sprintf('%s[%s%s]', $this->getNodeName(), $this->tree, $this->pseudoElement ? '::'.$this->pseudoElement : '');
5353
}
5454
}

‎Node/SpecificityAdjustmentNode.php

Copy file name to clipboardExpand all lines: Node/SpecificityAdjustmentNode.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ public function __toString(): string
4444
$this->arguments,
4545
);
4646

47-
return sprintf('%s[%s:where(%s)]', $this->getNodeName(), $this->selector, implode(', ', $selectorArguments));
47+
return \sprintf('%s[%s:where(%s)]', $this->getNodeName(), $this->selector, implode(', ', $selectorArguments));
4848
}
4949
}

‎Parser/Handler/StringHandler.php

Copy file name to clipboardExpand all lines: Parser/Handler/StringHandler.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function handle(Reader $reader, TokenStream $stream): bool
4949
$match = $reader->findPattern($this->patterns->getQuotedStringPattern($quote));
5050

5151
if (!$match) {
52-
throw new InternalErrorException(sprintf('Should have found at least an empty match at %d.', $reader->getPosition()));
52+
throw new InternalErrorException(\sprintf('Should have found at least an empty match at %d.', $reader->getPosition()));
5353
}
5454

5555
// check unclosed strings

‎Parser/Token.php

Copy file name to clipboardExpand all lines: Parser/Token.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ public function isString(): bool
9999
public function __toString(): string
100100
{
101101
if ($this->value) {
102-
return sprintf('<%s "%s" at %s>', $this->type, $this->value, $this->position);
102+
return \sprintf('<%s "%s" at %s>', $this->type, $this->value, $this->position);
103103
}
104104

105-
return sprintf('<%s at %s>', $this->type, $this->position);
105+
return \sprintf('<%s at %s>', $this->type, $this->position);
106106
}
107107
}

‎Parser/Tokenizer/TokenizerPatterns.php

Copy file name to clipboardExpand all lines: Parser/Tokenizer/TokenizerPatterns.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,6 @@ public function getNumberPattern(): string
8484

8585
public function getQuotedStringPattern(string $quote): string
8686
{
87-
return '~^'.sprintf($this->quotedStringPattern, $quote).'~i';
87+
return '~^'.\sprintf($this->quotedStringPattern, $quote).'~i';
8888
}
8989
}

‎Tests/Parser/ParserTest.php

Copy file name to clipboardExpand all lines: Tests/Parser/ParserTest.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function testSpecificity($source, $value)
7070
public function testParseSeries($series, $a, $b)
7171
{
7272
$parser = new Parser();
73-
$selectors = $parser->parse(sprintf(':nth-child(%s)', $series));
73+
$selectors = $parser->parse(\sprintf(':nth-child(%s)', $series));
7474
$this->assertCount(1, $selectors);
7575

7676
/** @var FunctionNode $function */
@@ -82,7 +82,7 @@ public function testParseSeries($series, $a, $b)
8282
public function testParseSeriesException($series)
8383
{
8484
$parser = new Parser();
85-
$selectors = $parser->parse(sprintf(':nth-child(%s)', $series));
85+
$selectors = $parser->parse(\sprintf(':nth-child(%s)', $series));
8686
$this->assertCount(1, $selectors);
8787

8888
/** @var FunctionNode $function */

‎XPath/Extension/AttributeMatchingExtension.php

Copy file name to clipboardExpand all lines: XPath/Extension/AttributeMatchingExtension.php
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ public function translateExists(XPathExpr $xpath, string $attribute, ?string $va
4747

4848
public function translateEquals(XPathExpr $xpath, string $attribute, ?string $value): XPathExpr
4949
{
50-
return $xpath->addCondition(sprintf('%s = %s', $attribute, Translator::getXpathLiteral($value)));
50+
return $xpath->addCondition(\sprintf('%s = %s', $attribute, Translator::getXpathLiteral($value)));
5151
}
5252

5353
public function translateIncludes(XPathExpr $xpath, string $attribute, ?string $value): XPathExpr
5454
{
55-
return $xpath->addCondition($value ? sprintf(
55+
return $xpath->addCondition($value ? \sprintf(
5656
'%1$s and contains(concat(\' \', normalize-space(%1$s), \' \'), %2$s)',
5757
$attribute,
5858
Translator::getXpathLiteral(' '.$value.' ')
@@ -61,7 +61,7 @@ public function translateIncludes(XPathExpr $xpath, string $attribute, ?string $
6161

6262
public function translateDashMatch(XPathExpr $xpath, string $attribute, ?string $value): XPathExpr
6363
{
64-
return $xpath->addCondition(sprintf(
64+
return $xpath->addCondition(\sprintf(
6565
'%1$s and (%1$s = %2$s or starts-with(%1$s, %3$s))',
6666
$attribute,
6767
Translator::getXpathLiteral($value),
@@ -71,7 +71,7 @@ public function translateDashMatch(XPathExpr $xpath, string $attribute, ?string
7171

7272
public function translatePrefixMatch(XPathExpr $xpath, string $attribute, ?string $value): XPathExpr
7373
{
74-
return $xpath->addCondition($value ? sprintf(
74+
return $xpath->addCondition($value ? \sprintf(
7575
'%1$s and starts-with(%1$s, %2$s)',
7676
$attribute,
7777
Translator::getXpathLiteral($value)
@@ -80,7 +80,7 @@ public function translatePrefixMatch(XPathExpr $xpath, string $attribute, ?strin
8080

8181
public function translateSuffixMatch(XPathExpr $xpath, string $attribute, ?string $value): XPathExpr
8282
{
83-
return $xpath->addCondition($value ? sprintf(
83+
return $xpath->addCondition($value ? \sprintf(
8484
'%1$s and substring(%1$s, string-length(%1$s)-%2$s) = %3$s',
8585
$attribute,
8686
\strlen($value) - 1,
@@ -90,7 +90,7 @@ public function translateSuffixMatch(XPathExpr $xpath, string $attribute, ?strin
9090

9191
public function translateSubstringMatch(XPathExpr $xpath, string $attribute, ?string $value): XPathExpr
9292
{
93-
return $xpath->addCondition($value ? sprintf(
93+
return $xpath->addCondition($value ? \sprintf(
9494
'%1$s and contains(%1$s, %2$s)',
9595
$attribute,
9696
Translator::getXpathLiteral($value)
@@ -99,7 +99,7 @@ public function translateSubstringMatch(XPathExpr $xpath, string $attribute, ?st
9999

100100
public function translateDifferent(XPathExpr $xpath, string $attribute, ?string $value): XPathExpr
101101
{
102-
return $xpath->addCondition(sprintf(
102+
return $xpath->addCondition(\sprintf(
103103
$value ? 'not(%1$s) or %1$s != %2$s' : '%s != %s',
104104
$attribute,
105105
Translator::getXpathLiteral($value)

‎XPath/Extension/FunctionExtension.php

Copy file name to clipboardExpand all lines: XPath/Extension/FunctionExtension.php
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function translateNthChild(XPathExpr $xpath, FunctionNode $function, bool
5050
try {
5151
[$a, $b] = Parser::parseSeries($function->getArguments());
5252
} catch (SyntaxErrorException $e) {
53-
throw new ExpressionErrorException(sprintf('Invalid series: "%s".', implode('", "', $function->getArguments())), 0, $e);
53+
throw new ExpressionErrorException(\sprintf('Invalid series: "%s".', implode('", "', $function->getArguments())), 0, $e);
5454
}
5555

5656
$xpath->addStarPrefix();
@@ -83,10 +83,10 @@ public function translateNthChild(XPathExpr $xpath, FunctionNode $function, bool
8383
$expr .= ' - '.$b;
8484
}
8585

86-
$conditions = [sprintf('%s %s 0', $expr, $sign)];
86+
$conditions = [\sprintf('%s %s 0', $expr, $sign)];
8787

8888
if (1 !== $a && -1 !== $a) {
89-
$conditions[] = sprintf('(%s) mod %d = 0', $expr, $a);
89+
$conditions[] = \sprintf('(%s) mod %d = 0', $expr, $a);
9090
}
9191

9292
return $xpath->addCondition(implode(' and ', $conditions));
@@ -134,7 +134,7 @@ public function translateContains(XPathExpr $xpath, FunctionNode $function): XPa
134134
}
135135
}
136136

137-
return $xpath->addCondition(sprintf(
137+
return $xpath->addCondition(\sprintf(
138138
'contains(string(.), %s)',
139139
Translator::getXpathLiteral($arguments[0]->getValue())
140140
));
@@ -152,7 +152,7 @@ public function translateLang(XPathExpr $xpath, FunctionNode $function): XPathEx
152152
}
153153
}
154154

155-
return $xpath->addCondition(sprintf(
155+
return $xpath->addCondition(\sprintf(
156156
'lang(%s)',
157157
Translator::getXpathLiteral($arguments[0]->getValue())
158158
));

‎XPath/Extension/HtmlExtension.php

Copy file name to clipboardExpand all lines: XPath/Extension/HtmlExtension.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public function translateLang(XPathExpr $xpath, FunctionNode $function): XPathEx
142142
}
143143
}
144144

145-
return $xpath->addCondition(sprintf(
145+
return $xpath->addCondition(\sprintf(
146146
'ancestor-or-self::*[@lang][1][starts-with(concat('
147147
."translate(@%s, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), '-')"
148148
.', %s)]',

‎XPath/Extension/NodeExtension.php

Copy file name to clipboardExpand all lines: XPath/Extension/NodeExtension.php
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function translateNegation(Node\NegationNode $node, Translator $translato
9191
$subXpath->addNameTest();
9292

9393
if ($subXpath->getCondition()) {
94-
return $xpath->addCondition(sprintf('not(%s)', $subXpath->getCondition()));
94+
return $xpath->addCondition(\sprintf('not(%s)', $subXpath->getCondition()));
9595
}
9696

9797
return $xpath->addCondition('0');
@@ -151,11 +151,11 @@ public function translateAttribute(Node\AttributeNode $node, Translator $transla
151151
}
152152

153153
if ($node->getNamespace()) {
154-
$name = sprintf('%s:%s', $node->getNamespace(), $name);
154+
$name = \sprintf('%s:%s', $node->getNamespace(), $name);
155155
$safe = $safe && $this->isSafeName($node->getNamespace());
156156
}
157157

158-
$attribute = $safe ? '@'.$name : sprintf('attribute::*[name() = %s]', Translator::getXpathLiteral($name));
158+
$attribute = $safe ? '@'.$name : \sprintf('attribute::*[name() = %s]', Translator::getXpathLiteral($name));
159159
$value = $node->getValue();
160160
$xpath = $translator->nodeToXPath($node->getSelector());
161161

@@ -196,7 +196,7 @@ public function translateElement(Node\ElementNode $node): XPathExpr
196196
}
197197

198198
if ($node->getNamespace()) {
199-
$element = sprintf('%s:%s', $node->getNamespace(), $element);
199+
$element = \sprintf('%s:%s', $node->getNamespace(), $element);
200200
$safe = $safe && $this->isSafeName($node->getNamespace());
201201
}
202202

‎XPath/Extension/PseudoClassExtension.php

Copy file name to clipboardExpand all lines: XPath/Extension/PseudoClassExtension.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function translateOnlyOfType(XPathExpr $xpath): XPathExpr
107107
{
108108
$element = $xpath->getElement();
109109

110-
return $xpath->addCondition(sprintf('count(preceding-sibling::%s)=0 and count(following-sibling::%s)=0', $element, $element));
110+
return $xpath->addCondition(\sprintf('count(preceding-sibling::%s)=0 and count(following-sibling::%s)=0', $element, $element));
111111
}
112112

113113
public function translateEmpty(XPathExpr $xpath): XPathExpr

‎XPath/Translator.php

Copy file name to clipboardExpand all lines: XPath/Translator.php
+8-8Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public static function getXpathLiteral(string $element): string
7575
$parts = [];
7676
while (true) {
7777
if (false !== $pos = strpos($string, "'")) {
78-
$parts[] = sprintf("'%s'", substr($string, 0, $pos));
78+
$parts[] = \sprintf("'%s'", substr($string, 0, $pos));
7979
$parts[] = "\"'\"";
8080
$string = substr($string, $pos + 1);
8181
} else {
@@ -84,7 +84,7 @@ public static function getXpathLiteral(string $element): string
8484
}
8585
}
8686

87-
return sprintf('concat(%s)', implode(', ', $parts));
87+
return \sprintf('concat(%s)', implode(', ', $parts));
8888
}
8989

9090
public function cssToXPath(string $cssExpr, string $prefix = 'descendant-or-self::'): string
@@ -130,7 +130,7 @@ public function registerExtension(Extension\ExtensionInterface $extension): stat
130130
public function getExtension(string $name): Extension\ExtensionInterface
131131
{
132132
if (!isset($this->extensions[$name])) {
133-
throw new ExpressionErrorException(sprintf('Extension "%s" not registered.', $name));
133+
throw new ExpressionErrorException(\sprintf('Extension "%s" not registered.', $name));
134134
}
135135

136136
return $this->extensions[$name];
@@ -152,7 +152,7 @@ public function registerParserShortcut(ParserInterface $shortcut): static
152152
public function nodeToXPath(NodeInterface $node): XPathExpr
153153
{
154154
if (!isset($this->nodeTranslators[$node->getNodeName()])) {
155-
throw new ExpressionErrorException(sprintf('Node "%s" not supported.', $node->getNodeName()));
155+
throw new ExpressionErrorException(\sprintf('Node "%s" not supported.', $node->getNodeName()));
156156
}
157157

158158
return $this->nodeTranslators[$node->getNodeName()]($node, $this);
@@ -164,7 +164,7 @@ public function nodeToXPath(NodeInterface $node): XPathExpr
164164
public function addCombination(string $combiner, NodeInterface $xpath, NodeInterface $combinedXpath): XPathExpr
165165
{
166166
if (!isset($this->combinationTranslators[$combiner])) {
167-
throw new ExpressionErrorException(sprintf('Combiner "%s" not supported.', $combiner));
167+
throw new ExpressionErrorException(\sprintf('Combiner "%s" not supported.', $combiner));
168168
}
169169

170170
return $this->combinationTranslators[$combiner]($this->nodeToXPath($xpath), $this->nodeToXPath($combinedXpath));
@@ -176,7 +176,7 @@ public function addCombination(string $combiner, NodeInterface $xpath, NodeInter
176176
public function addFunction(XPathExpr $xpath, FunctionNode $function): XPathExpr
177177
{
178178
if (!isset($this->functionTranslators[$function->getName()])) {
179-
throw new ExpressionErrorException(sprintf('Function "%s" not supported.', $function->getName()));
179+
throw new ExpressionErrorException(\sprintf('Function "%s" not supported.', $function->getName()));
180180
}
181181

182182
return $this->functionTranslators[$function->getName()]($xpath, $function);
@@ -188,7 +188,7 @@ public function addFunction(XPathExpr $xpath, FunctionNode $function): XPathExpr
188188
public function addPseudoClass(XPathExpr $xpath, string $pseudoClass): XPathExpr
189189
{
190190
if (!isset($this->pseudoClassTranslators[$pseudoClass])) {
191-
throw new ExpressionErrorException(sprintf('Pseudo-class "%s" not supported.', $pseudoClass));
191+
throw new ExpressionErrorException(\sprintf('Pseudo-class "%s" not supported.', $pseudoClass));
192192
}
193193

194194
return $this->pseudoClassTranslators[$pseudoClass]($xpath);
@@ -200,7 +200,7 @@ public function addPseudoClass(XPathExpr $xpath, string $pseudoClass): XPathExpr
200200
public function addAttributeMatching(XPathExpr $xpath, string $operator, string $attribute, ?string $value): XPathExpr
201201
{
202202
if (!isset($this->attributeMatchingTranslators[$operator])) {
203-
throw new ExpressionErrorException(sprintf('Attribute matcher operator "%s" not supported.', $operator));
203+
throw new ExpressionErrorException(\sprintf('Attribute matcher operator "%s" not supported.', $operator));
204204
}
205205

206206
return $this->attributeMatchingTranslators[$operator]($xpath, $attribute, $value);

‎XPath/XPathExpr.php

Copy file name to clipboardExpand all lines: XPath/XPathExpr.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function getElement(): string
4444
*/
4545
public function addCondition(string $condition, string $operator = 'and'): static
4646
{
47-
$this->condition = $this->condition ? sprintf('(%s) %s (%s)', $this->condition, $operator, $condition) : $condition;
47+
$this->condition = $this->condition ? \sprintf('(%s) %s (%s)', $this->condition, $operator, $condition) : $condition;
4848

4949
return $this;
5050
}

0 commit comments

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