Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6fde3a6

Browse filesBrowse files
[DomCrawler] Separate everything into traits
1 parent 2435855 commit 6fde3a6
Copy full SHA for 6fde3a6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner

48 files changed

+4517
-2703
lines changed

‎src/Symfony/Component/DomCrawler/AbstractUriElement.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DomCrawler/AbstractUriElement.php
+7-41Lines changed: 7 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,22 @@
1818
*/
1919
abstract class AbstractUriElement
2020
{
21-
/**
22-
* @deprecated since Symfony 7.1, use `$domeNode` instead
23-
*/
2421
protected \DOMElement $node;
25-
protected \DOMElement|\DOM\Element $domNode;
2622
protected ?string $method;
2723

2824
/**
29-
* @param \DOMElement|\DOM\Element $node A \DOMElement or a \DOM\Element instance
30-
* @param string|null $currentUri The URI of the page where the link is embedded (or the base href)
31-
* @param string|null $method The method to use for the link (GET by default)
25+
* @param \DOMElement $node A \DOMElement instance
26+
* @param string|null $currentUri The URI of the page where the link is embedded (or the base href)
27+
* @param string|null $method The method to use for the link (GET by default)
3228
*
3329
* @throws \InvalidArgumentException if the node is not a link
3430
*/
3531
public function __construct(
36-
\DOMElement|\DOM\Element $node,
32+
\DOMElement $node,
3733
protected ?string $currentUri = null,
3834
?string $method = 'GET',
3935
) {
40-
$this->setDomNode($node);
36+
$this->setNode($node);
4137
$this->method = $method ? strtoupper($method) : null;
4238

4339
$elementUriIsRelative = !parse_url(trim($this->getRawUri()), \PHP_URL_SCHEME);
@@ -47,26 +43,12 @@ public function __construct(
4743
}
4844
}
4945

50-
/**
51-
* @deprecated since Symfony 7.1, use `getDomNode()` instead
52-
*/
53-
public function getNode(): \DOMElement
54-
{
55-
trigger_deprecation('symfony/dom-crawler', '7.1', 'The "%s()" method is deprecated, use "%s::getDomNode()" instead.', __METHOD__, __CLASS__);
56-
57-
if ($this->domNode instanceof \DOM\Element) {
58-
throw new \LogicException('The node is not an instance of legacy \DOMElement. Use "getDomNode()" instead.');
59-
}
60-
61-
return $this->domNode;
62-
}
63-
6446
/**
6547
* Gets the node associated with this link.
6648
*/
67-
public function getDomNode(): \DOMElement|\DOM\Element
49+
public function getNode(): \DOMElement
6850
{
69-
return $this->domNode;
51+
return $this->node;
7052
}
7153

7254
/**
@@ -126,20 +108,4 @@ protected function canonicalizePath(string $path): string
126108
* @throws \LogicException If given node is not an anchor
127109
*/
128110
abstract protected function setNode(\DOMElement $node): void;
129-
130-
/**
131-
* Sets current \DOMElement or \DOM\Element instance.
132-
*
133-
* @param \DOMElement|\DOM\Element $node A \DOMElement or \DOM\Element instance
134-
*
135-
* @throws \LogicException If given node is not an anchor
136-
*/
137-
protected function setDomNode(\DOMElement|\DOM\Element $node): void
138-
{
139-
$this->domNode = $node;
140-
141-
if ($node instanceof \DOMElement) {
142-
$this->setNode($node);
143-
}
144-
}
145111
}

‎src/Symfony/Component/DomCrawler/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/DomCrawler/CHANGELOG.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
CHANGELOG
22
=========
33

4-
7.2
4+
7.3
55
---
66

7-
* Add `DomCrawler` to parse HTML and XML with native capabilities
7+
* Add `NativeCrawler\*` classes to parse HTML and XML with native PHP parser
88

99
7.0
1010
---

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.