From 3e647d42893002fd3354567e33a4cf840db6c324 Mon Sep 17 00:00:00 2001 From: Amrouche Hamza Date: Wed, 3 Jul 2019 07:34:46 +0200 Subject: [PATCH] [CssSelector] [5.0] Add type-hint whenever possible --- src/Symfony/Component/CssSelector/CssSelectorConverter.php | 5 +---- .../CssSelector/Exception/SyntaxErrorException.php | 6 +++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Component/CssSelector/CssSelectorConverter.php b/src/Symfony/Component/CssSelector/CssSelectorConverter.php index d1aeb7eb1702e..82064424e2618 100644 --- a/src/Symfony/Component/CssSelector/CssSelectorConverter.php +++ b/src/Symfony/Component/CssSelector/CssSelectorConverter.php @@ -53,12 +53,9 @@ public function __construct(bool $html = true) * Optionally, a prefix can be added to the resulting XPath * expression with the $prefix parameter. * - * @param string $cssExpr The CSS expression - * @param string $prefix An optional prefix for the XPath expression - * * @return string */ - public function toXPath($cssExpr, $prefix = 'descendant-or-self::') + public function toXPath(string $cssExpr, string $prefix = 'descendant-or-self::') { return $this->translator->cssToXPath($cssExpr, $prefix); } diff --git a/src/Symfony/Component/CssSelector/Exception/SyntaxErrorException.php b/src/Symfony/Component/CssSelector/Exception/SyntaxErrorException.php index cb3158a5536dc..34906b114b9b3 100644 --- a/src/Symfony/Component/CssSelector/Exception/SyntaxErrorException.php +++ b/src/Symfony/Component/CssSelector/Exception/SyntaxErrorException.php @@ -29,7 +29,7 @@ class SyntaxErrorException extends ParseException * * @return self */ - public static function unexpectedToken($expectedValue, Token $foundToken) + public static function unexpectedToken(string $expectedValue, Token $foundToken) { return new self(sprintf('Expected %s, but %s found.', $expectedValue, $foundToken)); } @@ -40,7 +40,7 @@ public static function unexpectedToken($expectedValue, Token $foundToken) * * @return self */ - public static function pseudoElementFound($pseudoElement, $unexpectedLocation) + public static function pseudoElementFound(string $pseudoElement, string $unexpectedLocation) { return new self(sprintf('Unexpected pseudo-element "::%s" found %s.', $pseudoElement, $unexpectedLocation)); } @@ -50,7 +50,7 @@ public static function pseudoElementFound($pseudoElement, $unexpectedLocation) * * @return self */ - public static function unclosedString($position) + public static function unclosedString(int $position) { return new self(sprintf('Unclosed/invalid string at %s.', $position)); }