Skip to content

Commit

Permalink
Implement new argument differently
Browse files Browse the repository at this point in the history
So it doesn't break backwards compatibility, as requested in
#48684 (comment)
  • Loading branch information
otsch committed Jan 10, 2023
1 parent c96ab99 commit 88a2575
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Symfony/Component/DomCrawler/Crawler.php
Original file line number Diff line number Diff line change
Expand Up @@ -561,9 +561,13 @@ public function text(string $default = null, bool $normalizeWhitespace = true):

/**
* Returns only the inner text that is the direct descendent of the current node, excluding any child nodes.
*
* @param bool $normalizeWhitespace
*/
public function innerText(bool $normalizeWhitespace = true): string
public function innerText(): string
{
$normalizeWhitespace = 1 <= func_num_args() ? func_get_arg(0) : true;

foreach ($this->getNode(0)->childNodes as $childNode) {
if (\XML_TEXT_NODE === $childNode->nodeType && '' !== trim($childNode->nodeValue)) {
return $normalizeWhitespace ? $this->normalizeWhitespace($childNode->nodeValue) : $childNode->nodeValue;
Expand Down

0 comments on commit 88a2575

Please sign in to comment.