From acca1aac246526165bfa733d04f5ecab01bab260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malte=20Schlu=CC=88ter?= Date: Fri, 21 May 2021 11:33:58 +0200 Subject: [PATCH] [DomCrawler] Removed deprecated code --- src/Symfony/Component/DomCrawler/CHANGELOG.md | 5 ++++ src/Symfony/Component/DomCrawler/Crawler.php | 14 ----------- .../DomCrawler/Tests/AbstractCrawlerTest.php | 25 ------------------- 3 files changed, 5 insertions(+), 39 deletions(-) diff --git a/src/Symfony/Component/DomCrawler/CHANGELOG.md b/src/Symfony/Component/DomCrawler/CHANGELOG.md index 3262b4a562d3d..65e011d37a612 100644 --- a/src/Symfony/Component/DomCrawler/CHANGELOG.md +++ b/src/Symfony/Component/DomCrawler/CHANGELOG.md @@ -1,6 +1,11 @@ CHANGELOG ========= +6.0 +--- + + * Remove `Crawler::parents()` method, use `ancestors()` instead + 5.3 --- diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php index 37b5fe37f0fc7..085c092e8f6cf 100644 --- a/src/Symfony/Component/DomCrawler/Crawler.php +++ b/src/Symfony/Component/DomCrawler/Crawler.php @@ -493,20 +493,6 @@ public function previousAll() return $this->createSubCrawler($this->sibling($this->getNode(0), 'previousSibling')); } - /** - * Returns the parent nodes of the current selection. - * - * @return static - * - * @throws \InvalidArgumentException When current node is empty - */ - public function parents() - { - trigger_deprecation('symfony/dom-crawler', '5.3', 'The %s() method is deprecated, use ancestors() instead.', __METHOD__); - - return $this->ancestors(); - } - /** * Returns the ancestors of the current selection. * diff --git a/src/Symfony/Component/DomCrawler/Tests/AbstractCrawlerTest.php b/src/Symfony/Component/DomCrawler/Tests/AbstractCrawlerTest.php index 77183348e9932..a614718a53c04 100644 --- a/src/Symfony/Component/DomCrawler/Tests/AbstractCrawlerTest.php +++ b/src/Symfony/Component/DomCrawler/Tests/AbstractCrawlerTest.php @@ -1088,31 +1088,6 @@ public function testFilteredChildren() $this->assertEquals(1, $foo->children('.ipsum')->count()); } - /** - * @group legacy - */ - public function testParents() - { - $this->expectDeprecation('Since symfony/dom-crawler 5.3: The Symfony\Component\DomCrawler\Crawler::parents() method is deprecated, use ancestors() instead.'); - - $crawler = $this->createTestCrawler()->filterXPath('//li[1]'); - $this->assertNotSame($crawler, $crawler->parents(), '->parents() returns a new instance of a crawler'); - $this->assertInstanceOf(Crawler::class, $crawler->parents(), '->parents() returns a new instance of a crawler'); - - $nodes = $crawler->parents(); - $this->assertEquals(3, $nodes->count()); - - $nodes = $this->createTestCrawler()->filterXPath('//html')->parents(); - $this->assertEquals(0, $nodes->count()); - - try { - $this->createTestCrawler()->filterXPath('//ol')->parents(); - $this->fail('->parents() throws an \InvalidArgumentException if the node list is empty'); - } catch (\InvalidArgumentException $e) { - $this->assertTrue(true, '->parents() throws an \InvalidArgumentException if the node list is empty'); - } - } - public function testAncestors() { $crawler = $this->createTestCrawler()->filterXPath('//li[1]');