@@ -554,17 +554,17 @@ public function nodeName()
554
554
/**
555
555
* Returns the node value of the first node of the list.
556
556
*
557
- * @param mixed $default When provided and the current node is empty, this value is returned and no exception is thrown
557
+ * @param string|null $default When not null: the value to return when the current node is empty
558
558
*
559
559
* @return string The node value
560
560
*
561
561
* @throws \InvalidArgumentException When current node is empty
562
562
*/
563
- public function text (/* $default = null */ )
563
+ public function text (/* string $default = null */ )
564
564
{
565
565
if (!$ this ->nodes ) {
566
- if (0 < \func_num_args ()) {
567
- return func_get_arg (0 );
566
+ if (0 < \func_num_args () && null !== func_get_arg ( 0 ) ) {
567
+ return ( string ) func_get_arg (0 );
568
568
}
569
569
570
570
throw new \InvalidArgumentException ('The current node list is empty. ' );
@@ -576,17 +576,17 @@ public function text(/* $default = null */)
576
576
/**
577
577
* Returns the first node of the list as HTML.
578
578
*
579
- * @param mixed $default When provided and the current node is empty, this value is returned and no exception is thrown
579
+ * @param string|null $default When not null: the value to return when the current node is empty
580
580
*
581
581
* @return string The node html
582
582
*
583
583
* @throws \InvalidArgumentException When current node is empty
584
584
*/
585
- public function html (/* $default = null */ )
585
+ public function html (/* string $default = null */ )
586
586
{
587
587
if (!$ this ->nodes ) {
588
- if (0 < \func_num_args ()) {
589
- return func_get_arg (0 );
588
+ if (0 < \func_num_args () && null !== func_get_arg ( 0 ) ) {
589
+ return ( string ) func_get_arg (0 );
590
590
}
591
591
592
592
throw new \InvalidArgumentException ('The current node list is empty. ' );
0 commit comments