1111
1212 use DOMDocument ;
1313 use DOMElement ;
14- use DOMNode ;
15- use LogicException ;
1614 use PhpCss \Ast ;
1715
1816 /**
@@ -25,12 +23,12 @@ class Explain extends Overload {
2523 /**
2624 * @var DOMDocument
2725 */
28- private $ _document = NULL ;
26+ private $ _document ;
2927
3028 /**
31- * @var DOMElement
29+ * @var DOMElement|DOMDocument
3230 */
33- private $ _current = NULL ;
31+ private $ _current ;
3432
3533 public function __construct () {
3634 $ this ->clear ();
@@ -51,15 +49,16 @@ public function __toString() {
5149 }
5250
5351 /**
54- * @param $name
52+ * @param string $name
5553 * @param string $content
5654 * @param array $attributes
57- * @return DOMNode
55+ * @param string $contentType
56+ * @return DOMElement
5857 */
5958 private function appendElement (
60- $ name , $ content = '' , array $ attributes = [], $ contentType = 'text '
61- ): DOMNode {
62- $ result = $ this ->_document ->createElementNs ($ this ->_xmlns , $ name );
59+ string $ name , string $ content = '' , array $ attributes = [], string $ contentType = 'text '
60+ ): DOMElement {
61+ $ result = $ this ->_document ->createElementNS ($ this ->_xmlns , $ name );
6362 if (!empty ($ content )) {
6463 $ text = $ result ->appendChild (
6564 $ this ->_document ->createElementNs ($ this ->_xmlns , $ contentType )
@@ -82,10 +81,9 @@ private function appendElement(
8281 }
8382
8483 /**
85- * @param $content
86- * @return DOMNode
84+ * @param string $content
8785 */
88- private function appendText ($ content ): DOMNode {
86+ private function appendText (string $ content ): void {
8987 $ text = $ this ->_current ->appendChild (
9088 $ this ->_document ->createElementNs ($ this ->_xmlns , 'text ' )
9189 );
@@ -98,7 +96,6 @@ private function appendText($content): DOMNode {
9896 $ this ->_document ->createTextNode ($ content )
9997 );
10098 }
101- return $ text ;
10299 }
103100
104101 /**
@@ -128,7 +125,6 @@ private function end(): bool {
128125 * If the buffer already contains data, throw an exception.
129126 *
130127 * @return boolean
131- * @throws LogicException
132128 */
133129 public function visitEnterSelectorGroup (): bool {
134130 $ this ->start ($ this ->appendElement ('selector-group ' ));
0 commit comments