8000 [DomCrawler] Removed deprecated code · symfony/symfony@acca1aa · GitHub
[go: up one dir, main page]

Skip to content

Commit acca1aa

Browse files
[DomCrawler] Removed deprecated code
1 parent 526144a commit acca1aa

File tree

3 files changed

+5
-39
lines changed

3 files changed

+5
-39
lines changed

src/Symfony/Component/DomCrawler/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
6.0
5+
---
6+
7+
* Remove `Crawler::parents()` method, use `ancestors()` instead
8+
49
5.3
510
---
611

src/Symfony/Component/DomCrawler/Crawler.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -493,20 +493,6 @@ public function previousAll()
493493
return $this->createSubCrawler($this->sibling($this->getNode(0), 'previousSibling'));
494494
}
495495

496-
/**
497-
* Returns the parent nodes of the current selection.
498-
*
499-
* @return static
500-
*
501- 8000
* @throws \InvalidArgumentException When current node is empty
502-
*/
503-
public function parents()
504-
{
505-
trigger_deprecation('symfony/dom-crawler', '5.3', 'The %s() method is deprecated, use ancestors() instead.', __METHOD__);
506-
507-
return $this->ancestors();
508-
}
509-
510496
/**
511497
* Returns the ancestors of the current selection.
512498
*

src/Symfony/Component/DomCrawler/Tests/AbstractCrawlerTest.php

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,31 +1088,6 @@ public function testFilteredChildren()
10881088
$this->assertEquals(1, $foo->children('.ipsum')->count());
10891089
}
10901090

1091-
/**
1092-
* @group legacy
1093-
*/
1094-
public function testParents()
1095-
{
1096-
$this->expectDeprecation('Since symfony/dom-crawler 5.3: The Symfony\Component\DomCrawler\Crawler::parents() method is deprecated, use ancestors() instead.');
1097-
1098-
$crawler = $this->createTestCrawler()->filterXPath('//li[1]');
1099-
$this->assertNotSame($crawler, $crawler->parents(), '->parents() returns a new instance of a crawler');
1100-
$this->assertInstanceOf(Crawler::class, $crawler->parents(), '->parents() returns a new instance of a crawler');
1101-
1102-
$nodes = $crawler->parents();
1103-
$this->assertEquals(3, $nodes->count());
1104-
1105-
$nodes = $this->createTestCrawler()->filterXPath('//html')->parents();
1106-
$this->assertEquals(0, $nodes->count());
1107-
1108-
try {
1109-
$this->createTestCrawler()->filterXPath('//ol')->parents();
1110-
$this->fail('->parents() throws an \InvalidArgumentException if the node list is empty');
1111-
} catch (\InvalidArgumentException $e) {
1112-
$this->assertTrue(true, '->parents() throws an \InvalidArgumentException if the node list is empty');
1113-
}
1114-
}
1115-
11161091
public function testAncestors()
11171092
{
11181093
$crawler = $this->createTestCrawler()->filterXPath('//li[1]');

0 commit comments

Comments
 (0)
0