Skip to content

Commit

Permalink
[DomCrawler] Add argument $default to Crawler::attr()
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Aug 17, 2023
1 parent 8342592 commit 043715b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ CHANGELOG
---

* Add argument `$normalizeWhitespace` to `Crawler::innerText()`
* Add argument `$default` to `Crawler::attr()`

6.4
---
Expand Down
3 changes: 1 addition & 2 deletions Crawler.php
Original file line number Diff line number Diff line change
Expand Up @@ -504,9 +504,8 @@ public function children(string $selector = null): static
*
* @throws \InvalidArgumentException When current node is empty
*/
public function attr(string $attribute/* , string $default = null */): ?string
public function attr(string $attribute, string $default = null): ?string
{
$default = \func_num_args() > 1 ? func_get_arg(1) : null;
if (!$this->nodes) {
if (null !== $default) {
return $default;
Expand Down

0 comments on commit 043715b

Please sign in to comment.