@@ -19,7 +19,7 @@ class Import implements AtRule
1919 private $ location ;
2020
2121 /**
22- * @var string
22+ * @var string|null
2323 */
2424 private $ mediaQuery ;
2525
@@ -38,10 +38,9 @@ class Import implements AtRule
3838 protected $ comments = [];
3939
4040 /**
41- * @param string $mediaQuery
4241 * @param int<0, max> $lineNumber
4342 */
44- public function __construct (URL $ location , $ mediaQuery , int $ lineNumber = 0 )
43+ public function __construct (URL $ location , ? string $ mediaQuery , int $ lineNumber = 0 )
4544 {
4645 $ this ->location = $ location ;
4746 $ this ->mediaQuery = $ mediaQuery ;
@@ -56,18 +55,12 @@ public function getLineNo(): int
5655 return $ this ->lineNumber ;
5756 }
5857
59- /**
60- * @param URL $location
61- */
62- public function setLocation ($ location ): void
58+ public function setLocation (URL $ location ): void
6359 {
6460 $ this ->location = $ location ;
6561 }
6662
67- /**
68- * @return URL
69- */
70- public function getLocation ()
63+ public function getLocation (): URL
7164 {
7265 return $ this ->location ;
7366 }
@@ -95,14 +88,15 @@ public function atRuleName(): string
9588 }
9689
9790 /**
98- * @return array<int, URL| string>
91+ * @return array{0: URL, 1?: non-empty- string}
9992 */
10093 public function atRuleArgs (): array
10194 {
10295 $ result = [$ this ->location ];
103- if ($ this ->mediaQuery ) {
104- \array_push ( $ result, $ this ->mediaQuery ) ;
96+ if (\is_string ( $ this ->mediaQuery ) && $ this -> mediaQuery !== '' ) {
97+ $ result[] = $ this ->mediaQuery ;
10598 }
99+
106100 return $ result ;
107101 }
108102
@@ -130,10 +124,7 @@ public function setComments(array $comments): void
130124 $ this ->comments = $ comments ;
131125 }
132126
133- /**
134- * @return string
135- */
136- public function getMediaQuery ()
127+ public function getMediaQuery (): ?string
137128 {
138129 return $ this ->mediaQuery ;
139130 }
0 commit comments