Skip to content

Commit e39e8c2

Browse files
committed
[DomCrawler] Fix return type Crawler:: discoverNamespace()
Based on 3.x behavior
1 parent bdcc357 commit e39e8c2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Symfony/Component/DomCrawler/Crawler.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1110,7 +1110,7 @@ private function createDOMXPath(\DOMDocument $document, array $prefixes = array(
11101110
/**
11111111
* @throws \InvalidArgumentException
11121112
*/
1113-
private function discoverNamespace(\DOMXPath $domxpath, string $prefix): string
1113+
private function discoverNamespace(\DOMXPath $domxpath, string $prefix): ?string
11141114
{
11151115
if (isset($this->namespaces[$prefix])) {
11161116
return $this->namespaces[$prefix];
@@ -1122,6 +1122,8 @@ private function discoverNamespace(\DOMXPath $domxpath, string $prefix): string
11221122
if ($node = $namespaces->item(0)) {
11231123
return $node->nodeValue;
11241124
}
1125+
1126+
return null;
11251127
}
11261128

11271129
private function findNamespacePrefixes(string $xpath): array

0 commit comments

Comments
 (0)