Skip to content

Commit c1fe1fa

Browse files
committed
minor #32328 [CssSelector] [5.0] Add type-hint whenever possible (Simperfit)
This PR was merged into the 5.0-dev branch. Discussion ---------- [CssSelector] [5.0] Add type-hint whenever possible | Q | A | ------------- | --- | Branch? | 5.0 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | contribute to #32179 <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | none <!-- required for new features --> <!-- Replace this notice by a short README for your feature/bugfix. This will help people understand your PR and can be used as a start for the documentation. Additionally (see https://symfony.com/roadmap): - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against branch 4.4. - Legacy code removals go to the master branch. --> Add type hint to css selector ;). Commits ------- 3e647d4 [CssSelector] [5.0] Add type-hint whenever possible
2 parents f065c41 + 3e647d4 commit c1fe1fa

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/Symfony/Component/CssSelector/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
}

src/Symfony/Component/CssSelector/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)