PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.1.0
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.1.0
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
← All changes | back/Libraries/Sabberworm/CSS/src/Parsing/UnexpectedTokenException.php +16 -36 10.1.4 → 11.1.0 View file →
@@ -1,8 +1,10 @@
1 1 <?php
2 2
3 -namespace Sabberworm\CSS\Parsing;
3 +declare(strict_types=1);
4 4
5 +namespace AcyMailing\Libraries\Sabberworm\CSS\Parsing;
6 +
5 7 /**
6 8 * Thrown if the CSS parser encounters a token it did not expect.
7 9 */
8 10 class UnexpectedTokenException extends SourceException
@@ -7,45 +9,23 @@
7 9 */
8 10 class UnexpectedTokenException extends SourceException
9 11 {
10 12 /**
11 - * @var string
13 + * @param 'literal'|'identifier'|'count'|'expression'|'search'|'custom' $matchType
14 + * @param int<1, max>|null $lineNumber
12 15 */
13 - private $sExpected;
14 -
15 - /**
16 - * @var string
17 - */
18 - private $sFound;
19 -
20 - /**
21 - * Possible values: literal, identifier, count, expression, search
22 - *
23 - * @var string
24 - */
25 - private $sMatchType;
26 -
27 - /**
28 - * @param string $sExpected
29 - * @param string $sFound
30 - * @param string $sMatchType
31 - * @param int $iLineNo
32 - */
33 - public function __construct($sExpected, $sFound, $sMatchType = 'literal', $iLineNo = 0)
16 + public function __construct(string $expected, string $found, string $matchType = 'literal', ?int $lineNumber = null)
34 17 {
35 - $this->sExpected = $sExpected;
36 - $this->sFound = $sFound;
37 - $this->sMatchType = $sMatchType;
38 - $sMessage = "Token “{$sExpected}” ({$sMatchType}) not found. Got “{$sFound}”.";
39 - if ($this->sMatchType === 'search') {
40 - $sMessage = "Search for “{$sExpected}” returned no results. Context: “{$sFound}”.";
41 - } elseif ($this->sMatchType === 'count') {
42 - $sMessage = "Next token was expected to have {$sExpected} chars. Context: “{$sFound}”.";
43 - } elseif ($this->sMatchType === 'identifier') {
44 - $sMessage = "Identifier expected. Got “{$sFound}”";
45 - } elseif ($this->sMatchType === 'custom') {
46 - $sMessage = trim("$sExpected $sFound");
18 + $message = "Token “{$expected}” ({$matchType}) not found. Got “{$found}”.";
19 + if ($matchType === 'search') {
20 + $message = "Search for “{$expected}” returned no results. Context: “{$found}”.";
21 + } elseif ($matchType === 'count') {
22 + $message = "Next token was expected to have {$expected} chars. Context: “{$found}”.";
23 + } elseif ($matchType === 'identifier') {
24 + $message = "Identifier expected. Got “{$found}”";
25 + } elseif ($matchType === 'custom') {
26 + $message = \trim("$expected $found");
47 27 }
48 28
49 - parent::__construct($sMessage, $iLineNo);
29 + parent::__construct($message, $lineNumber);
50 30 }
51 31 }