• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

MyIntervals / PHP-CSS-Parser / 13101877788

02 Feb 2025 07:39PM UTC coverage: 45.742%. Remained the same
13101877788

Pull #875

github

web-flow
Merge 2307bc140 into cde73cd57
Pull Request #875: [TASK] Add native type declarations to `OutputFormat`

3 of 3 new or added lines in 1 file covered. (100.0%)

811 of 1773 relevant lines covered (45.74%)

12.43 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Parsing/UnexpectedTokenException.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Sabberworm\CSS\Parsing;
6

7
/**
8
 * Thrown if the CSS parser encounters a token it did not expect.
9
 */
10
class UnexpectedTokenException extends SourceException
11
{
12
    /**
13
     * @var string
14
     */
15
    private $sExpected;
16

17
    /**
18
     * @var string
19
     */
20
    private $sFound;
21

22
    /**
23
     * Possible values: literal, identifier, count, expression, search
24
     *
25
     * @var string
26
     */
27
    private $sMatchType;
28

29
    /**
30
     * @param string $sExpected
31
     * @param string $sFound
32
     * @param string $sMatchType
33
     * @param int $lineNumber
34
     */
35
    public function __construct($sExpected, $sFound, $sMatchType = 'literal', $lineNumber = 0)
×
36
    {
37
        $this->sExpected = $sExpected;
×
38
        $this->sFound = $sFound;
×
39
        $this->sMatchType = $sMatchType;
×
40
        $sMessage = "Token “{$sExpected}” ({$sMatchType}) not found. Got “{$sFound}”.";
×
41
        if ($this->sMatchType === 'search') {
×
42
            $sMessage = "Search for “{$sExpected}” returned no results. Context: “{$sFound}”.";
×
43
        } elseif ($this->sMatchType === 'count') {
×
44
            $sMessage = "Next token was expected to have {$sExpected} chars. Context: “{$sFound}”.";
×
45
        } elseif ($this->sMatchType === 'identifier') {
×
46
            $sMessage = "Identifier expected. Got “{$sFound}”";
×
47
        } elseif ($this->sMatchType === 'custom') {
×
48
            $sMessage = \trim("$sExpected $sFound");
×
49
        }
50

51
        parent::__construct($sMessage, $lineNumber);
×
52
    }
×
53
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc