@@ -12,38 +12,38 @@ class UnexpectedTokenException extends SourceException
1212 /**
1313 * @var string
1414 */
15- private $ sExpected ;
15+ private $ expected ;
1616
1717 /**
1818 * @var string
1919 */
20- private $ sFound ;
20+ private $ found ;
2121
2222 /**
2323 * @var 'literal'|'identifier'|'count'|'expression'|'search'|'custom'
2424 */
25- private $ sMatchType ;
25+ private $ matchType ;
2626
2727 /**
28- * @param 'literal'|'identifier'|'count'|'expression'|'search'|'custom' $sMatchType
28+ * @param 'literal'|'identifier'|'count'|'expression'|'search'|'custom' $matchType
2929 * @param int<0, max> $lineNumber
3030 */
31- public function __construct (string $ sExpected , string $ sFound , string $ sMatchType = 'literal ' , int $ lineNumber = 0 )
31+ public function __construct (string $ expected , string $ found , string $ matchType = 'literal ' , int $ lineNumber = 0 )
3232 {
33- $ this ->sExpected = $ sExpected ;
34- $ this ->sFound = $ sFound ;
35- $ this ->sMatchType = $ sMatchType ;
36- $ sMessage = "Token “ {$ sExpected }” ( {$ sMatchType }) not found. Got “ {$ sFound }”. " ;
37- if ($ this ->sMatchType === 'search ' ) {
38- $ sMessage = "Search for “ {$ sExpected }” returned no results. Context: “ {$ sFound }”. " ;
39- } elseif ($ this ->sMatchType === 'count ' ) {
40- $ sMessage = "Next token was expected to have {$ sExpected } chars. Context: “ {$ sFound }”. " ;
41- } elseif ($ this ->sMatchType === 'identifier ' ) {
42- $ sMessage = "Identifier expected. Got “ {$ sFound }” " ;
43- } elseif ($ this ->sMatchType === 'custom ' ) {
44- $ sMessage = \trim ("$ sExpected $ sFound " );
33+ $ this ->expected = $ expected ;
34+ $ this ->found = $ found ;
35+ $ this ->matchType = $ matchType ;
36+ $ message = "Token “ {$ expected }” ( {$ matchType }) not found. Got “ {$ found }”. " ;
37+ if ($ this ->matchType === 'search ' ) {
38+ $ message = "Search for “ {$ expected }” returned no results. Context: “ {$ found }”. " ;
39+ } elseif ($ this ->matchType === 'count ' ) {
40+ $ message = "Next token was expected to have {$ expected } chars. Context: “ {$ found }”. " ;
41+ } elseif ($ this ->matchType === 'identifier ' ) {
42+ $ message = "Identifier expected. Got “ {$ found }” " ;
43+ } elseif ($ this ->matchType === 'custom ' ) {
44+ $ message = \trim ("$ expected $ found " );
4545 }
4646
47- parent ::__construct ($ sMessage , $ lineNumber );
47+ parent ::__construct ($ message , $ lineNumber );
4848 }
4949}
0 commit comments