Skip to content

Commit ba2e533

Browse files
committed
[CssSelector] [5.0] Add type-hint whenever possible
1 parent 7afcfcc commit ba2e533

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

CssSelectorConverter.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,9 @@ public function __construct(bool $html = true)
5353
* Optionally, a prefix can be added to the resulting XPath
5454
* expression with the $prefix parameter.
5555
*
56-
* @param string $cssExpr The CSS expression
57-
* @param string $prefix An optional prefix for the XPath expression
58-
*
5956
* @return string
6057
*/
61-
public function toXPath($cssExpr, $prefix = 'descendant-or-self::')
58+
public function toXPath(string $cssExpr, string $prefix = 'descendant-or-self::')
6259
{
6360
return $this->translator->cssToXPath($cssExpr, $prefix);
6461
}

Exception/SyntaxErrorException.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class SyntaxErrorException extends ParseException
2929
*
3030
* @return self
3131
*/
32-
public static function unexpectedToken($expectedValue, Token $foundToken)
32+
public static function unexpectedToken(string $expectedValue, Token $foundToken)
3333
{
3434
return new self(sprintf('Expected %s, but %s found.', $expectedValue, $foundToken));
3535
}
@@ -40,7 +40,7 @@ public static function unexpectedToken($expectedValue, Token $foundToken)
4040
*
4141
* @return self
4242
*/
43-
public static function pseudoElementFound($pseudoElement, $unexpectedLocation)
43+
public static function pseudoElementFound(string $pseudoElement, string $unexpectedLocation)
4444
{
4545
return new self(sprintf('Unexpected pseudo-element "::%s" found %s.', $pseudoElement, $unexpectedLocation));
4646
}
@@ -50,7 +50,7 @@ public static function pseudoElementFound($pseudoElement, $unexpectedLocation)
5050
*
5151
* @return self
5252
*/
53-
public static function unclosedString($position)
53+
public static function unclosedString(int $position)
5454
{
5555
return new self(sprintf('Unclosed/invalid string at %s.', $position));
5656
}

0 commit comments

Comments
 (0)