Skip to content

Commit 0961866

Browse files
Merge branch '4.3' into 4.4
* 4.3: [Cache] clean tags folder on invalidation [Cache] remove implicit dependency on symfony/filesystem Allow to set cookie_samesite to 'none' [VarDumper] fix array key error for class SymfonyCaster Adds missing translations for no nb [HttpKernel] fix $dotenvVars in data collector Add the missing translations for the Swedish ("sv") locale bumped Symfony version to 4.3.6 updated VERSION for 4.3.5 updated CHANGELOG for 4.3.5 bumped Symfony version to 3.4.33 updated VERSION for 3.4.32 update CONTRIBUTORS for 3.4.32 updated CHANGELOG for 3.4.32 [Messenger] DoctrineTransport: ensure auto setup is only done once [Form][DateTimeImmutableToDateTimeTransformer] Preserve microseconds and use \DateTime::createFromImmutable() when available [Crawler] document $default as string|null
2 parents 117563a + e9f7b4d commit 0961866

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Crawler.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -595,18 +595,18 @@ public function nodeName()
595595
*
596596
* Pass true as the 2nd argument to normalize whitespaces.
597597
*
598-
* @param mixed $default When provided and the current node is empty, this value is returned and no exception is thrown
599-
* @param bool $normalizeWhitespace Whether whitespaces should be trimmed and normalized to single spaces
598+
* @param string|null $default When not null: the value to return when the current node is empty
599+
* @param bool $normalizeWhitespace Whether whitespaces should be trimmed and normalized to single spaces
600600
*
601601
* @return string The node value
602602
*
603603
* @throws \InvalidArgumentException When current node is empty
604604
*/
605-
public function text(/* $default = null, bool $normalizeWhitespace = false */)
605+
public function text(/* string $default = null, bool $normalizeWhitespace = false */)
606606
{
607607
if (!$this->nodes) {
608-
if (0 < \func_num_args()) {
609-
return func_get_arg(0);
608+
if (0 < \func_num_args() && null !== func_get_arg(0)) {
609+
return (string) func_get_arg(0);
610610
}
611611

612612
throw new \InvalidArgumentException('The current node list is empty.');
@@ -624,17 +624,17 @@ public function text(/* $default = null, bool $normalizeWhitespace = false */)
624624
/**
625625
* Returns the first node of the list as HTML.
626626
*
627-
* @param mixed $default When provided and the current node is empty, this value is returned and no exception is thrown
627+
* @param string|null $default When not null: the value to return when the current node is empty
628628
*
629629
* @return string The node html
630630
*
631631
* @throws \InvalidArgumentException When current node is empty
632632
*/
633-
public function html(/* $default = null */)
633+
public function html(/* string $default = null */)
634634
{
635635
if (!$this->nodes) {
636-
if (0 < \func_num_args()) {
637-
return func_get_arg(0);
636+
if (0 < \func_num_args() && null !== func_get_arg(0)) {
637+
return (string) func_get_arg(0);
638638
}
639639

640640
throw new \InvalidArgumentException('The current node list is empty.');

0 commit comments

Comments
 (0)