@@ -411,7 +411,7 @@ public function addTextNode(string $text, bool $escHtmlEntities = true) {
411411 *
412412 *
413413 */
414- public function anchor ($ body = null , array $ attributes = []) : HTMLNode {
414+ public function anchor (string | HTMLNode $ body , array $ attributes = []) : HTMLNode {
415415 $ href = null ;
416416
417417 $ href = $ attributes ['href ' ] ?? '' ;
@@ -576,7 +576,7 @@ public function build(array $arrOfChildren) {
576576 * method is called on.
577577 *
578578 */
579- public function cell ($ cellBody = null , string $ cellType = 'td ' , array $ attributes = []) : HTMLNode {
579+ public function cell (string | HTMLNode $ cellBody = '' , string $ cellType = 'td ' , array $ attributes = []) : HTMLNode {
580580 if ($ this ->getNodeName () == 'tr ' ) {
581581 $ cell = new TableCell ($ cellType , $ cellBody );
582582 $ cell ->setAttributes ($ attributes );
@@ -1519,7 +1519,7 @@ public function label($body, array $attributes = []) : HTMLNode {
15191519 */
15201520 public function li ($ itemBody , array $ attributes = []) : HTMLNode {
15211521 if ($ this ->getNodeName () == 'ul ' || $ this ->getNodeName () == 'ol ' ) {
1522- $ item = new ListItem ();
1522+ $ item = new ListItem (null );
15231523
15241524 if ($ itemBody instanceof HTMLNode) {
15251525 $ item ->addChild ($ itemBody );
@@ -1645,7 +1645,7 @@ public function open() : string {
16451645 *
16461646 *
16471647 */
1648- public function paragraph ($ body = null , array $ attributes = [], bool $ escEntities = true ) : HTMLNode {
1648+ public function paragraph (string | HTMLNode $ body = '' , array $ attributes = [], bool $ escEntities = true ) : HTMLNode {
16491649 $ paragraph = new Paragraph ();
16501650
16511651 if ($ body instanceof HTMLNode) {
@@ -1826,7 +1826,7 @@ public function section($title, int $headingLvl = 1, array $attributes = []) : H
18261826 * method is called on.
18271827 *
18281828 */
1829- public function setAttribute (string $ name , $ val = null ) : HTMLNode {
1829+ public function setAttribute (string $ name , mixed $ val = null ) : HTMLNode {
18301830 $ trimmedName = trim ($ name );
18311831 $ attrValType = gettype ($ val );
18321832 $ trimmedVal = null ;
@@ -1855,7 +1855,7 @@ public function setAttribute(string $name, $val = null) : HTMLNode {
18551855 } else if ($ val === null ) {
18561856 $ this ->attributes [$ trimmedName ] = null ;
18571857 } else if ($ attrValType == 'string ' ) {
1858- $ this ->attributes [$ trimmedName ] = $ trimmedVal ;
1858+ $ this ->attributes [$ trimmedName ] = $ trimmedVal ;
18591859 } else if (in_array ($ attrValType , ['double ' , 'integer ' ])) {
18601860 $ this ->attributes [$ trimmedName ] = $ val ;
18611861 } else if ($ attrValType == 'boolean ' ) {
@@ -2390,7 +2390,7 @@ private function closeAsCode(array $FO) : string {
23902390 * @param LinkedList $chNodes
23912391 * @return null|HTMLNode Description
23922392 */
2393- private function getChildByIDHelper (string $ val ,LinkedList $ chNodes = null ) {
2393+ private function getChildByIDHelper (string $ val , ? LinkedList $ chNodes ) {
23942394 $ chCount = $ chNodes !== null ? $ chNodes ->size () : 0 ;
23952395
23962396 for ($ x = 0 ; $ x < $ chCount ; $ x ++) {
@@ -2671,7 +2671,7 @@ private function reduceTab() {
26712671 }
26722672 private function removeChHelper ($ node ) {
26732673 if ($ node instanceof HTMLNode) {
2674- $ node ->setParentHelper ();
2674+ $ node ->setParentHelper (null );
26752675
26762676 return $ node ;
26772677 }
@@ -2684,7 +2684,7 @@ private function removeChHelper($node) {
26842684 *
26852685 *
26862686 */
2687- private function setParentHelper (HTMLNode $ node = null ) {
2687+ private function setParentHelper (? HTMLNode $ node ) {
26882688 $ this ->parentNode = $ node ;
26892689 }
26902690 /**
0 commit comments