From e96add478738a251928b9d53fa0d3838d421299f Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 27 Sep 2019 19:18:47 +0200 Subject: [PATCH] [Crawler] document $default as string|null --- src/Symfony/Component/DomCrawler/Crawler.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php index 2fa18191abed5..b783c19a8e892 100644 --- a/src/Symfony/Component/DomCrawler/Crawler.php +++ b/src/Symfony/Component/DomCrawler/Crawler.php @@ -554,17 +554,17 @@ public function nodeName() /** * Returns the node value of the first node of the list. * - * @param mixed $default When provided and the current node is empty, this value is returned and no exception is thrown + * @param string|null $default When not null: the value to return when the current node is empty * * @return string The node value * * @throws \InvalidArgumentException When current node is empty */ - public function text(/* $default = null */) + public function text(/* string $default = null */) { if (!$this->nodes) { - if (0 < \func_num_args()) { - return func_get_arg(0); + if (0 < \func_num_args() && null !== func_get_arg(0)) { + return (string) func_get_arg(0); } throw new \InvalidArgumentException('The current node list is empty.'); @@ -576,17 +576,17 @@ public function text(/* $default = null */) /** * Returns the first node of the list as HTML. * - * @param mixed $default When provided and the current node is empty, this value is returned and no exception is thrown + * @param string|null $default When not null: the value to return when the current node is empty * * @return string The node html * * @throws \InvalidArgumentException When current node is empty */ - public function html(/* $default = null */) + public function html(/* string $default = null */) { if (!$this->nodes) { - if (0 < \func_num_args()) { - return func_get_arg(0); + if (0 < \func_num_args() && null !== func_get_arg(0)) { + return (string) func_get_arg(0); } throw new \InvalidArgumentException('The current node list is empty.'); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy