Skip to content

Commit b2768c4

Browse files
committed
Add type annotations for the parsing exception classes
1 parent 1218187 commit b2768c4

File tree

4 files changed

+36
-5
lines changed

4 files changed

+36
-5
lines changed

src/Parsing/OutputException.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@
33
namespace Sabberworm\CSS\Parsing;
44

55
/**
6-
* Thrown if the CSS parsers attempts to print something invalid
6+
* Thrown if the CSS parser attempts to print something invalid.
77
*/
88
class OutputException extends SourceException
99
{
10+
/**
11+
* @param string $sMessage
12+
* @param int $iLineNo
13+
*/
1014
public function __construct($sMessage, $iLineNo = 0)
1115
{
1216
parent::__construct($sMessage, $iLineNo);

src/Parsing/SourceException.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,15 @@
44

55
class SourceException extends \Exception
66
{
7+
/**
8+
* @var int
9+
*/
710
private $iLineNo;
811

12+
/**
13+
* @param string $sMessage
14+
* @param int $iLineNo
15+
*/
916
public function __construct($sMessage, $iLineNo = 0)
1017
{
1118
$this->iLineNo = $iLineNo;
@@ -15,6 +22,9 @@ public function __construct($sMessage, $iLineNo = 0)
1522
parent::__construct($sMessage);
1623
}
1724

25+
/**
26+
* @return int
27+
*/
1828
public function getLineNo()
1929
{
2030
return $this->iLineNo;

src/Parsing/UnexpectedEOFException.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
namespace Sabberworm\CSS\Parsing;
44

55
/**
6-
* Thrown if the CSS parsers encounters end of file it did not expect
7-
* Extends UnexpectedTokenException in order to preserve backwards compatibility
6+
* Thrown if the CSS parser encounters end of file it did not expect.
7+
*
8+
* Extends `UnexpectedTokenException` in order to preserve backwards compatibility.
89
*/
910
class UnexpectedEOFException extends UnexpectedTokenException
1011
{

src/Parsing/UnexpectedTokenException.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,33 @@
33
namespace Sabberworm\CSS\Parsing;
44

55
/**
6-
* Thrown if the CSS parsers encounters a token it did not expect
6+
* Thrown if the CSS parser encounters a token it did not expect.
77
*/
88
class UnexpectedTokenException extends SourceException
99
{
10+
/**
11+
* @var string
12+
*/
1013
private $sExpected;
1114

15+
/**
16+
* @var string
17+
*/
1218
private $sFound;
1319

14-
// Possible values: literal, identifier, count, expression, search
20+
/**
21+
* Possible values: literal, identifier, count, expression, search
22+
*
23+
* @var string
24+
*/
1525
private $sMatchType;
1626

27+
/**
28+
* @param string $sExpected
29+
* @param string $sFound
30+
* @param string $sMatchType
31+
* @param int $iLineNo
32+
*/
1733
public function __construct($sExpected, $sFound, $sMatchType = 'literal', $iLineNo = 0)
1834
{
1935
$this->sExpected = $sExpected;

0 commit comments

Comments
 (0)