Skip to content

Commit 10667d5

Browse files
[DomCrawler] Separate everything into traits
1 parent 2e54bb0 commit 10667d5

Some content is hidden

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

48 files changed

+4519
-2812
lines changed

src/Symfony/Component/DomCrawler/AbstractUriElement.php

Lines 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 = null === 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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ CHANGELOG
44
7.2
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy