# acymailing/11.0.5/back/Libraries/Sabberworm/CSS/src/Parsing/UnexpectedTokenException.php

AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress, version 11.0.5. 32 lines.

- Page: https://pluginprobe.com/plugins/acymailing/11.0.5/code/back/Libraries/Sabberworm/CSS/src/Parsing/UnexpectedTokenException.php
- Raw: https://pluginprobe.com/plugins/acymailing/11.0.5/raw/back/Libraries/Sabberworm/CSS/src/Parsing/UnexpectedTokenException.php
- Modified: 2026-06-09T07:53:26+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/acymailing/11.0.5/code/back/Libraries/Sabberworm/CSS/src/Parsing/UnexpectedTokenException.php#L10-L20`.

```php
<?php

declare(strict_types=1);

namespace AcyMailing\Libraries\Sabberworm\CSS\Parsing;

/**
 * Thrown if the CSS parser encounters a token it did not expect.
 */
class UnexpectedTokenException extends SourceException
{
    /**
     * @param 'literal'|'identifier'|'count'|'expression'|'search'|'custom' $matchType
     * @param int<1, max>|null $lineNumber
     */
    public function __construct(string $expected, string $found, string $matchType = 'literal', ?int $lineNumber = null)
    {
        $message = "Token “{$expected}” ({$matchType}) not found. Got “{$found}”.";
        if ($matchType === 'search') {
            $message = "Search for “{$expected}” returned no results. Context: “{$found}”.";
        } elseif ($matchType === 'count') {
            $message = "Next token was expected to have {$expected} chars. Context: “{$found}”.";
        } elseif ($matchType === 'identifier') {
            $message = "Identifier expected. Got “{$found}”";
        } elseif ($matchType === 'custom') {
            $message = \trim("$expected $found");
        }

        parent::__construct($message, $lineNumber);
    }
}

```
