8000 review · symfony/symfony@26eefb3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 26eefb3

Browse files
committed
review
1 parent 27ba278 commit 26eefb3

File tree

5 files changed

+21
-30
lines changed

5 files changed

+21
-30
lines changed

src/Symfony/Component/CssSelector/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CHANGELOG
22
=========
33

4-
6.3.0
4+
6.3
55
-----
66

77
* Added support for `:is()`

src/Symfony/Component/CssSelector/Node/MatchingNode.php

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,13 @@
2323
*/
2424
class MatchingNode extends AbstractNode
2525
{
26-
private NodeInterface $selector;
27-
/** @var array<NodeInterface> */
28-
private array $arguments;
29-
30-
public function __construct(NodeInterface $selector, array $arguments = [])
31-
{
32-
$this->selector = $selector;
33-
$this->arguments = $arguments;
26+
/**
27+
* @param array<NodeInterface> $arguments
28+
*/
29+
public function __construct(
30+
private readonly NodeInterface $selector,
31+
private readonly array $arguments = []
32+
) {
3433
}
3534

3635
public function getSelector(): NodeInterface
@@ -43,9 +42,6 @@ public function getArguments(): array
4342
return $this->arguments;
4443
}
4544

46-
/**
47-
* {@inheritdoc}
48-
*/
4945
public function getSpecificity(): Specificity
5046
{
5147
return array_reduce(
@@ -58,7 +54,7 @@ public function getSpecificity(): Specificity
5854
public function __toString(): string
5955
{
6056
$selectorArguments = array_map(
61-
static fn(NodeInterface $n): string => ltrim((string) $n, '*'),
57+
static fn (NodeInterface $n): string => ltrim((string) $n, '*'),
6258
$this->getArguments()
6359
);
6460

src/Symfony/Component/CssSelector/Node/SpecificityAdjustmentNode.php

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,13 @@
2323
*/
2424
class SpecificityAdjustmentNode extends AbstractNode
2525
{
26-
private NodeInterface $selector;
27-
/** @var array<NodeInterface> */
28-
private array $arguments;
29-
30-
public function __construct(NodeInterface $selector, array $arguments = [])
31-
{
32-
$this->selector = $selector;
33-
$this->arguments = $arguments;
26+
/**
27+
* @param array<NodeInterface> $arguments
28+
*/
29+
public function __construct(
30+
private readonly NodeInterface $selector,
31+
private readonly array $arguments = []
32+
) {
3433
}
3534

3635
public function getSelector(): NodeInterface
@@ -43,9 +42,6 @@ public function getArguments(): array
4342
return $this->arguments;
4443
}
4544

46-
/**
47-
* {@inheritdoc}
48-
*/
4945
public function getSpecificity(): Specificity
5046
{
5147
return new Specificity(0, 0, 0);
@@ -54,7 +50,7 @@ public function getSpecificity(): Specificity
5450
public function __toString(): string
5551
{
5652
$selectorArguments = array_map(
57-
static fn(NodeInterface $n): string => ltrim((string) $n, '*'),
53+
static fn (NodeInterface $n): string => ltrim((string) $n, '*'),
5854
$this->getArguments()
5955
);
6056

src/Symfony/Component/CssSelector/Parser/Parser.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use Symfony\Component\CssSelector\Exception\SyntaxErrorException;
1515
use Symfony\Component\CssSelector\Node;
1616
use Symfony\Component\CssSelector\Parser\Tokenizer\Tokenizer;
17-
use Symfony\Component\HttpFoundation\File\Stream;
1817

1918
/**
2019
* CSS selector parser.
@@ -269,7 +268,7 @@ private function parseSimpleSelector(TokenStream $stream, bool $insideNegation =
269268
private function parseSimpleSelectorArguments(TokenStream $stream): array
270269
{
271270
$arguments = [];
272-
while(true) {
271+
while (true) {
273272
[$result, $pseudoElement] = $this->parseSimpleSelector($stream, true);
274273
if ($pseudoElement) {
275274
throw SyntaxErrorException::pseudoElementFound($pseudoElement, 'function');

src/Symfony/Component/CssSelector/XPath/XPathExpr.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ public function getElement(): string
4646
/**
4747
* @return $this
4848
*/
49-
public function addCondition(string $condition/*, string $conjuction = 'and'*/): static
49+
public function addCondition(string $condition/* , string $conjunction = 'and' */): static
5050
{
51-
$conjuction = 2 <= \func_num_args() ? func_get_arg(1) : 'and';
52-
$this->condition = $this->condition ? sprintf('(%s) %s (%s)', $this->condition, $conjuction, $condition) : $condition;
51+
$conjunction = 2 <= \func_num_args() ? func_get_arg(1) : 'and';
52+
$this->condition = $this->condition ? sprintf('(%s) %s (%s)', $this->condition, $conjunction, $condition) : $condition;
5353

5454
return $this;
5555
}

0 commit comments

Comments
 (0)
0