Skip to content

Commit 002d3ae

Browse files
Merge branch '3.4' into 4.0
* 3.4: Fix Clidumper tests Enable the fixer enforcing fully-qualified calls for compiler-optimized functions Apply fixers Disable the native_constant_invocation fixer until it can be scoped Update the list of excluded files for the CS fixer
2 parents 0383a1a + 64a32d5 commit 002d3ae

14 files changed

+28
-28
lines changed

Node/AbstractNode.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ abstract class AbstractNode implements NodeInterface
3434
public function getNodeName(): string
3535
{
3636
if (null === $this->nodeName) {
37-
$this->nodeName = preg_replace('~.*\\\\([^\\\\]+)Node$~', '$1', get_called_class());
37+
$this->nodeName = preg_replace('~.*\\\\([^\\\\]+)Node$~', '$1', \get_called_class());
3838
}
3939

4040
return $this->nodeName;

Parser/Handler/HashHandler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function handle(Reader $reader, TokenStream $stream): bool
5151

5252
$value = $this->escaping->escapeUnicode($match[1]);
5353
$stream->push(new Token(Token::TYPE_HASH, $value, $reader->getPosition()));
54-
$reader->moveForward(strlen($match[0]));
54+
$reader->moveForward(\strlen($match[0]));
5555

5656
return true;
5757
}

Parser/Handler/IdentifierHandler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function handle(Reader $reader, TokenStream $stream): bool
5151

5252
$value = $this->escaping->escapeUnicode($match[0]);
5353
$stream->push(new Token(Token::TYPE_IDENTIFIER, $value, $reader->getPosition()));
54-
$reader->moveForward(strlen($match[0]));
54+
$reader->moveForward(\strlen($match[0]));
5555

5656
return true;
5757
}

Parser/Handler/NumberHandler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function handle(Reader $reader, TokenStream $stream): bool
4747
}
4848

4949
$stream->push(new Token(Token::TYPE_NUMBER, $match[0], $reader->getPosition()));
50-
$reader->moveForward(strlen($match[0]));
50+
$reader->moveForward(\strlen($match[0]));
5151

5252
return true;
5353
}

Parser/Handler/StringHandler.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function handle(Reader $reader, TokenStream $stream): bool
4747
{
4848
$quote = $reader->getSubstring(1);
4949

50-
if (!in_array($quote, array("'", '"'))) {
50+
if (!\in_array($quote, array("'", '"'))) {
5151
return false;
5252
}
5353

@@ -59,18 +59,18 @@ public function handle(Reader $reader, TokenStream $stream): bool
5959
}
6060

6161
// check unclosed strings
62-
if (strlen($match[0]) === $reader->getRemainingLength()) {
62+
if (\strlen($match[0]) === $reader->getRemainingLength()) {
6363
throw SyntaxErrorException::unclosedString($reader->getPosition() - 1);
6464
}
6565

6666
// check quotes pairs validity
67-
if ($quote !== $reader->getSubstring(1, strlen($match[0]))) {
67+
if ($quote !== $reader->getSubstring(1, \strlen($match[0]))) {
6868
throw SyntaxErrorException::unclosedString($reader->getPosition() - 1);
6969
}
7070

7171
$string = $this->escaping->escapeUnicodeAndNewLine($match[0]);
7272
$stream->push(new Token(Token::TYPE_STRING, $string, $reader->getPosition()));
73-
$reader->moveForward(strlen($match[0]) + 1);
73+
$reader->moveForward(\strlen($match[0]) + 1);
7474

7575
return true;
7676
}

Parser/Handler/WhitespaceHandler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function handle(Reader $reader, TokenStream $stream): bool
3939
}
4040

4141
$stream->push(new Token(Token::TYPE_WHITESPACE, $match[0], $reader->getPosition()));
42-
$reader->moveForward(strlen($match[0]));
42+
$reader->moveForward(\strlen($match[0]));
4343

4444
return true;
4545
}

Parser/Parser.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ private function parseSimpleSelector(TokenStream $stream, bool $insideNegation =
150150
{
151151
$stream->skipWhitespace();
152152

153-
$selectorStart = count($stream->getUsed());
153+
$selectorStart = \count($stream->getUsed());
154154
$result = $this->parseElementNode($stream);
155155
$pseudoElement = null;
156156

@@ -187,7 +187,7 @@ private function parseSimpleSelector(TokenStream $stream, bool $insideNegation =
187187
}
188188

189189
$identifier = $stream->getNextIdentifier();
190-
if (in_array(strtolower($identifier), array('first-line', 'first-letter', 'before', 'after'))) {
190+
if (\in_array(strtolower($identifier), array('first-line', 'first-letter', 'before', 'after'))) {
191191
// Special case: CSS 2.1 pseudo-elements can have a single ':'.
192192
// Any new pseudo-element must have two.
193193
$pseudoElement = $identifier;
@@ -253,7 +253,7 @@ private function parseSimpleSelector(TokenStream $stream, bool $insideNegation =
253253
}
254254
}
255255

256-
if (count($stream->getUsed()) === $selectorStart) {
256+
if (\count($stream->getUsed()) === $selectorStart) {
257257
throw SyntaxErrorException::unexpectedToken('selector', $stream->getPeek());
258258
}
259259

Parser/Reader.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Reader
3030
public function __construct(string $source)
3131
{
3232
$this->source = $source;
33-
$this->length = strlen($source);
33+
$this->length = \strlen($source);
3434
}
3535

3636
public function isEOF(): bool

Parser/Token.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function isDelimiter(array $values = array()): bool
7272
return true;
7373
}
7474

75-
return in_array($this->value, $values);
75+
return \in_array($this->value, $values);
7676
}
7777

7878
public function isWhitespace(): bool

Parser/Tokenizer/TokenizerEscaping.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ private function replaceUnicodeSequences(string $value): string
5050
$c = hexdec($match[1]);
5151

5252
if (0x80 > $c %= 0x200000) {
53-
return chr($c);
53+
return \chr($c);
5454
}
5555
if (0x800 > $c) {
56-
return chr(0xC0 | $c >> 6).chr(0x80 | $c & 0x3F);
56+
return \chr(0xC0 | $c >> 6).\chr(0x80 | $c & 0x3F);
5757
}
5858
if (0x10000 > $c) {
59-
return chr(0xE0 | $c >> 12).chr(0x80 | $c >> 6 & 0x3F).chr(0x80 | $c & 0x3F);
59+
return \chr(0xE0 | $c >> 12).\chr(0x80 | $c >> 6 & 0x3F).\chr(0x80 | $c & 0x3F);
6060
}
6161
}, $value);
6262
}

Tests/Parser/Handler/AbstractHandlerTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ protected function assertRemainingContent(Reader $reader, $remainingContent)
6363
$this->assertEquals(0, $reader->getRemainingLength());
6464
$this->assertTrue($reader->isEOF());
6565
} else {
66-
$this->assertEquals(strlen($remainingContent), $reader->getRemainingLength());
66+
$this->assertEquals(\strlen($remainingContent), $reader->getRemainingLength());
6767
$this->assertEquals(0, $reader->getOffset($remainingContent));
6868
}
6969
}

Tests/XPath/TranslatorTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ public function testXmlLang($css, array $elementsId)
3737
$translator = new Translator();
3838
$document = new \SimpleXMLElement(file_get_contents(__DIR__.'/Fixtures/lang.xml'));
3939
$elements = $document->xpath($translator->cssToXPath($css));
40-
$this->assertCount(count($elementsId), $elements);
40+
$this->assertCount(\count($elementsId), $elements);
4141
foreach ($elements as $element) {
42-
$this->assertTrue(in_array($element->attributes()->id, $elementsId));
42+
$this->assertTrue(\in_array($element->attributes()->id, $elementsId));
4343
}
4444
}
4545

@@ -54,10 +54,10 @@ public function testHtmlIds($css, array $elementsId)
5454
$document->loadHTMLFile(__DIR__.'/Fixtures/ids.html');
5555
$document = simplexml_import_dom($document);
5656
$elements = $document->xpath($translator->cssToXPath($css));
57-
$this->assertCount(count($elementsId), $elementsId);
57+
$this->assertCount(\count($elementsId), $elementsId);
5858
foreach ($elements as $element) {
5959
if (null !== $element->attributes()->id) {
60-
$this->assertTrue(in_array($element->attributes()->id, $elementsId));
60+
$this->assertTrue(\in_array($element->attributes()->id, $elementsId));
6161
}
6262
}
6363
libxml_clear_errors();

XPath/Extension/AttributeMatchingExtension.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function translateSuffixMatch(XPathExpr $xpath, string $attribute, ?strin
8686
return $xpath->addCondition($value ? sprintf(
8787
'%1$s and substring(%1$s, string-length(%1$s)-%2$s) = %3$s',
8888
$attribute,
89-
strlen($value) - 1,
89+
\strlen($value) - 1,
9090
Translator::getXpathLiteral($value)
9191
) : '0');
9292
}

XPath/Translator.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public function nodeToXPath(NodeInterface $node): XPathExpr
155155
throw new ExpressionErrorException(sprintf('Node "%s" not supported.', $node->getNodeName()));
156156
}
157157

158-
return call_user_func($this->nodeTranslators[$node->getNodeName()], $node, $this);
158+
return \call_user_func($this->nodeTranslators[$node->getNodeName()], $node, $this);
159159
}
160160

161161
/**
@@ -167,7 +167,7 @@ public function addCombination(string $combiner, NodeInterface $xpath, NodeInter
167167
throw new ExpressionErrorException(sprintf('Combiner "%s" not supported.', $combiner));
168168
}
169169

170-
return call_user_func($this->combinationTranslators[$combiner], $this->nodeToXPath($xpath), $this->nodeToXPath($combinedXpath));
170+
return \call_user_func($this->combinationTranslators[$combiner], $this->nodeToXPath($xpath), $this->nodeToXPath($combinedXpath));
171171
}
172172

173173
/**
@@ -179,7 +179,7 @@ public function addFunction(XPathExpr $xpath, FunctionNode $function): XPathExpr
179179
throw new ExpressionErrorException(sprintf('Function "%s" not supported.', $function->getName()));
180180
}
181181

182-
return call_user_func($this->functionTranslators[$function->getName()], $xpath, $function);
182+
return \call_user_func($this->functionTranslators[$function->getName()], $xpath, $function);
183183
}
184184

185185
/**
@@ -191,7 +191,7 @@ public function addPseudoClass(XPathExpr $xpath, string $pseudoClass): XPathExpr
191191
throw new ExpressionErrorException(sprintf('Pseudo-class "%s" not supported.', $pseudoClass));
192192
}
193193

194-
return call_user_func($this->pseudoClassTranslators[$pseudoClass], $xpath);
194+
return \call_user_func($this->pseudoClassTranslators[$pseudoClass], $xpath);
195195
}
196196

197197
/**
@@ -203,7 +203,7 @@ public function addAttributeMatching(XPathExpr $xpath, string $operator, string
203203
throw new ExpressionErrorException(sprintf('Attribute matcher operator "%s" not supported.', $operator));
204204
}
205205

206-
return call_user_func($this->attributeMatchingTranslators[$operator], $xpath, $attribute, $value);
206+
return \call_user_func($this->attributeMatchingTranslators[$operator], $xpath, $attribute, $value);
207207
}
208208

209209
/**

0 commit comments

Comments
 (0)