Differences Between: [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403]
1 <?php 2 3 namespace Sabberworm\CSS\Parsing; 4 5 /** 6 * Thrown if the CSS parsers encounters a token it did not expect 7 */ 8 class UnexpectedTokenException extends SourceException { 9 private $sExpected; 10 private $sFound; 11 // Possible values: literal, identifier, count, expression, search 12 private $sMatchType; 13 14 public function __construct($sExpected, $sFound, $sMatchType = 'literal', $iLineNo = 0) { 15 $this->sExpected = $sExpected; 16 $this->sFound = $sFound; 17 $this->sMatchType = $sMatchType; 18 $sMessage = "Token “{$sExpected}” ({$sMatchType}) not found. Got “{$sFound}”."; 19 if($this->sMatchType === 'search') { 20 $sMessage = "Search for “{$sExpected}” returned no results. Context: “{$sFound}”."; 21 } else if($this->sMatchType === 'count') { 22 $sMessage = "Next token was expected to have {$sExpected} chars. Context: “{$sFound}”."; 23 } else if($this->sMatchType === 'identifier') { 24 $sMessage = "Identifier expected. Got “{$sFound}”"; 25 } else if($this->sMatchType === 'custom') { 26 $sMessage = trim("$sExpected $sFound"); 27 } 28 29 parent::__construct($sMessage, $iLineNo); 30 } 31 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body