wp-user-avatar
/
third-party
/
vendor
/
symfony
/
css-selector
/
Exception
/
SyntaxErrorException.php
ExceptionInterface.php
2 months ago
ExpressionErrorException.php
2 months ago
InternalErrorException.php
2 months ago
ParseException.php
2 months ago
SyntaxErrorException.php
2 months ago
SyntaxErrorException.php
60 lines
| 1 | <?php |
| 2 | |
| 3 | /* |
| 4 | * This file is part of the Symfony package. |
| 5 | * |
| 6 | * (c) Fabien Potencier <fabien@symfony.com> |
| 7 | * |
| 8 | * For the full copyright and license information, please view the LICENSE |
| 9 | * file that was distributed with this source code. |
| 10 | */ |
| 11 | namespace ProfilePressVendor\Symfony\Component\CssSelector\Exception; |
| 12 | |
| 13 | use ProfilePressVendor\Symfony\Component\CssSelector\Parser\Token; |
| 14 | /** |
| 15 | * ParseException is thrown when a CSS selector syntax is not valid. |
| 16 | * |
| 17 | * This component is a port of the Python cssselect library, |
| 18 | * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. |
| 19 | * |
| 20 | * @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com> |
| 21 | */ |
| 22 | class SyntaxErrorException extends ParseException |
| 23 | { |
| 24 | /** |
| 25 | * @return self |
| 26 | */ |
| 27 | public static function unexpectedToken(string $expectedValue, Token $foundToken) |
| 28 | { |
| 29 | return new self(sprintf('Expected %s, but %s found.', $expectedValue, $foundToken)); |
| 30 | } |
| 31 | /** |
| 32 | * @return self |
| 33 | */ |
| 34 | public static function pseudoElementFound(string $pseudoElement, string $unexpectedLocation) |
| 35 | { |
| 36 | return new self(sprintf('Unexpected pseudo-element "::%s" found %s.', $pseudoElement, $unexpectedLocation)); |
| 37 | } |
| 38 | /** |
| 39 | * @return self |
| 40 | */ |
| 41 | public static function unclosedString(int $position) |
| 42 | { |
| 43 | return new self(sprintf('Unclosed/invalid string at %s.', $position)); |
| 44 | } |
| 45 | /** |
| 46 | * @return self |
| 47 | */ |
| 48 | public static function nestedNot() |
| 49 | { |
| 50 | return new self('Got nested ::not().'); |
| 51 | } |
| 52 | /** |
| 53 | * @return self |
| 54 | */ |
| 55 | public static function stringAsFunctionArgument() |
| 56 | { |
| 57 | return new self('String not allowed as function argument.'); |
| 58 | } |
| 59 | } |
| 60 |