From 238a7baffbb1062bfe5672125a7f6b4abb81be29 Mon Sep 17 00:00:00 2001 From: Kevin Bond Date: Tue, 26 Sep 2023 14:15:13 -0400 Subject: [PATCH] Allow Symfony 7.0 --- composer.json | 20 ++++++++++---------- src/DomCrawler/Crawler.php | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/composer.json b/composer.json index f0271aef..a7dbc2a9 100644 --- a/composer.json +++ b/composer.json @@ -21,13 +21,13 @@ "ext-dom": "*", "ext-libxml": "*", "php-webdriver/webdriver": "^1.8.2", - "symfony/browser-kit": "^5.3 || ^6.0", - "symfony/dependency-injection": "^5.3 || ^6.0", + "symfony/browser-kit": "^5.3 || ^6.0 || ^7.0", + "symfony/dependency-injection": "^5.3 || ^6.0 || ^7.0", "symfony/deprecation-contracts": "^2.4 || ^3", - "symfony/dom-crawler": "^5.3 || ^6.0", - "symfony/http-client": "^5.3 || ^6.0", - "symfony/http-kernel": "^5.3 || ^6.0", - "symfony/process": "^5.3 || ^6.0" + "symfony/dom-crawler": "^5.3 || ^6.0 || ^7.0", + "symfony/http-client": "^5.3 || ^6.0 || ^7.0", + "symfony/http-kernel": "^5.3 || ^6.0 || ^7.0", + "symfony/process": "^5.3 || ^6.0 || ^7.0" }, "autoload": { "psr-4": { "Symfony\\Component\\Panther\\": "src/" } @@ -44,9 +44,9 @@ "sort-packages": true }, "require-dev": { - "symfony/css-selector": "^5.3 || ^6.0", - "symfony/framework-bundle": "^5.3 || ^6.0", - "symfony/mime": "^5.3 || ^6.0", - "symfony/phpunit-bridge": "^5.3 || ^6.0" + "symfony/css-selector": "^5.3 || ^6.0 || ^7.0", + "symfony/framework-bundle": "^5.3 || ^6.0 || ^7.0", + "symfony/mime": "^5.3 || ^6.0 || ^7.0", + "symfony/phpunit-bridge": "^5.3 || ^6.0 || ^7.0" } } diff --git a/src/DomCrawler/Crawler.php b/src/DomCrawler/Crawler.php index 9fe6a4f4..5798d50d 100644 --- a/src/DomCrawler/Crawler.php +++ b/src/DomCrawler/Crawler.php @@ -188,14 +188,14 @@ public function children(string $selector = null): static return $this->createSubCrawlerFromXpath($xpath); } - public function attr($attribute): ?string + public function attr($attribute, $default = null): ?string { $element = $this->getElementOrThrow(); if ('_text' === $attribute) { return $this->text(); } - return (string) $element->getAttribute($attribute); + return $element->getAttribute($attribute) ?? $default; } public function nodeName(): string