Skip to content

Commit 02c3bab

Browse files
Merge branch '4.4'
* 4.4: (26 commits) cs fix [Validator] sync NO and NB translations [Cache] improve perf of pruning for fs-based adapters [Cache] cs fix [Cache] clean tags folder on invalidation [Cache] remove implicit dependency on symfony/filesystem Allow to set cookie_samesite to 'none' [Dotenv] support setting default env var values [VarDumper] fix array key error for class SymfonyCaster [Cache] Improve RedisTagAwareAdapter invalidation logic & requirements Adds missing translations for no nb [HttpKernel] fix $dotenvVars in data collector Add the missing translations for the Swedish ("sv") locale Prevent ProgressBar redraw when message is same [DI] enable improved syntax for defining method calls in Yaml 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 ...
2 parents 8e15765 + 0961866 commit 02c3bab

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

Crawler.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -571,17 +571,19 @@ public function nodeName()
571571
/**
572572
* Returns the text of the first node of the list.
573573
*
574-
* @param mixed $default When provided and the current node is empty, this value is returned and no exception is thrown
575-
* @param bool $normalizeWhitespace Whether whitespaces should be trimmed and normalized to single spaces
574+
* Pass true as the 2nd argument to normalize whitespaces.
575+
*
576+
* @param string|null $default When not null: the value to return when the current node is empty
577+
* @param bool $normalizeWhitespace Whether whitespaces should be trimmed and normalized to single spaces
576578
*
577579
* @return string The node value
578580
*
579581
* @throws \InvalidArgumentException When current node is empty
580582
*/
581-
public function text($default = null, bool $normalizeWhitespace = false)
583+
public function text(string $default = null, bool $normalizeWhitespace = false)
582584
{
583585
if (!$this->nodes) {
584-
if (0 < \func_num_args()) {
586+
if (null !== $default) {
585587
return $default;
586588
}
587589

@@ -600,16 +602,16 @@ public function text($default = null, bool $normalizeWhitespace = false)
600602
/**
601603
* Returns the first node of the list as HTML.
602604
*
603-
* @param mixed $default When provided and the current node is empty, this value is returned and no exception is thrown
605+
* @param string|null $default When not null: the value to return when the current node is empty
604606
*
605607
* @return string The node html
606608
*
607609
* @throws \InvalidArgumentException When current node is empty
608610
*/
609-
public function html($default = null)
611+
public function html(string $default = null)
610612
{
611613
if (!$this->nodes) {
612-
if (0 < \func_num_args()) {
614+
if (null !== $default) {
613615
return $default;
614616
}
615617

0 commit comments

Comments
 (0)