Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 94af00e

Browse files
[DomCrawler] Add argument $default to Crawler::attr()
1 parent 83e102b commit 94af00e

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

UPGRADE-7.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ DomCrawler
156156
----------
157157

158158
* Add argument `$normalizeWhitespace` to `Crawler::innerText()`
159+
* Add argument `$default` to `Crawler::attr()`
159160

160161
ExpressionLanguage
161162
------------------

src/Symfony/Component/DomCrawler/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CHANGELOG
55
---
66

77
* Add argument `$normalizeWhitespace` to `Crawler::innerText()`
8+
* Add argument `$default` to `Crawler::attr()`
89

910
6.4
1011
---

src/Symfony/Component/DomCrawler/Crawler.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,9 +504,8 @@ public function children(string $selector = null): static
504504
*
505505
* @throws \InvalidArgumentException When current node is empty
506506
*/
507-
public function attr(string $attribute/* , string $default = null */): ?string
507+
public function attr(string $attribute, string $default = null): ?string
508508
{
509-
$default = \func_num_args() > 1 ? func_get_arg(1) : null;
510509
if (!$this->nodes) {
511510
if (null !== $default) {
512511
return $default;

0 commit comments

Comments
 (0)