Skip to content

Commit 88eb050

Browse files
authored
Merge pull request #285 from oliverklee/cleanup/types-charset
Add type annotations for `Charset`
2 parents 7a1d8eb + c9f46a7 commit 88eb050

File tree

1 file changed

+31
-5
lines changed

1 file changed

+31
-5
lines changed

src/Property/Charset.php

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22

33
namespace Sabberworm\CSS\Property;
44

5+
use Sabberworm\CSS\Comment\Comment;
56
use Sabberworm\CSS\OutputFormat;
67

78
/**
8-
* Class representing an @charset rule.
9+
* Class representing an `@charset` rule.
10+
*
911
* The following restrictions apply:
10-
* May not be found in any CSSList other than the Document.
11-
* May only appear at the very top of a Document’s contents.
12-
* Must not appear more than once.
12+
* - May not be found in any CSSList other than the Document.
13+
* - May only appear at the very top of a Document’s contents.
14+
* - Must not appear more than once.
1315
*/
1416
class Charset implements AtRule
1517
{
@@ -24,7 +26,7 @@ class Charset implements AtRule
2426
protected $iLineNo;
2527

2628
/**
27-
* @var array
29+
* @var array<array-key, Comment>
2830
*/
2931
protected $aComments;
3032

@@ -47,16 +49,27 @@ public function getLineNo()
4749
return $this->iLineNo;
4850
}
4951

52+
/**
53+
* @param string $sCharset
54+
*
55+
* @return void
56+
*/
5057
public function setCharset($sCharset)
5158
{
5259
$this->sCharset = $sCharset;
5360
}
5461

62+
/**
63+
* @return string
64+
*/
5565
public function getCharset()
5666
{
5767
return $this->sCharset;
5868
}
5969

70+
/**
71+
* @return string
72+
*/
6073
public function __toString()
6174
{
6275
return $this->render(new OutputFormat());
@@ -88,16 +101,29 @@ public function atRuleArgs()
88101
return $this->sCharset;
89102
}
90103

104+
/**
105+
* @param array<array-key, Comment> $aComments
106+
*
107+
* @return void
108+
*/
91109
public function addComments(array $aComments)
92110
{
93111
$this->aComments = array_merge($this->aComments, $aComments);
94112
}
95113

114+
/**
115+
* @return array<array-key, Comment>
116+
*/
96117
public function getComments()
97118
{
98119
return $this->aComments;
99120
}
100121

122+
/**
123+
* @param array<array-key, Comment> $aComments
124+
*
125+
* @return void
126+
*/
101127
public function setComments(array $aComments)
102128
{
103129
$this->aComments = $aComments;

0 commit comments

Comments
 (0)