From 997c650c1c43139847b4e82871925ed31db514ef Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Sat, 26 Sep 2015 11:44:29 +0200 Subject: [PATCH] Deprecate methods inherited from SplObjectStorage --- src/Symfony/Component/DomCrawler/Crawler.php | 136 ++++++++++++++++++- 1 file changed, 133 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php index 30b82579346f1..38881d2f97bb0 100644 --- a/src/Symfony/Component/DomCrawler/Crawler.php +++ b/src/Symfony/Component/DomCrawler/Crawler.php @@ -66,7 +66,7 @@ public function __construct($node = null, $currentUri = null, $baseHref = null) */ public function clear() { - $this->removeAll($this); + parent::removeAll($this); } /** @@ -319,9 +319,9 @@ public function addNodes(array $nodes) public function addNode(\DOMNode $node) { if ($node instanceof \DOMDocument) { - $this->attach($node->documentElement); + parent::attach($node->documentElement); } else { - $this->attach($node); + parent::attach($node); } } @@ -876,6 +876,136 @@ public static function xpathLiteral($s) return sprintf('concat(%s)', implode($parts, ', ')); } + /** + * @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0. + */ + public function attach($object, $data = null) + { + @trigger_error('The '.__METHOD__.' method is deprecated as of 2.8 and will be removed in 3.0.', E_USER_DEPRECATED); + + parent::attach($object, $data); + } + + /** + * @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0. + */ + public function detach($object) + { + @trigger_error('The '.__METHOD__.' method is deprecated as of 2.8 and will be removed in 3.0.', E_USER_DEPRECATED); + + parent::detach($object); + } + + /** + * @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0. + */ + public function contains($object) + { + @trigger_error('The '.__METHOD__.' method is deprecated as of 2.8 and will be removed in 3.0.', E_USER_DEPRECATED); + + return parent::contains($object); + } + + /** + * @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0. + */ + public function addAll($storage) + { + @trigger_error('The '.__METHOD__.' method is deprecated as of 2.8 and will be removed in 3.0.', E_USER_DEPRECATED); + + parent::addAll($storage); + } + + /** + * @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0. + */ + public function removeAll($storage) + { + @trigger_error('The '.__METHOD__.' method is deprecated as of 2.8 and will be removed in 3.0.', E_USER_DEPRECATED); + + parent::removeAll($storage); + } + + /** + * @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0. + */ + public function removeAllExcept($storage) + { + @trigger_error('The '.__METHOD__.' method is deprecated as of 2.8 and will be removed in 3.0.', E_USER_DEPRECATED); + + parent::removeAllExcept($storage); + } + + /** + * @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0. + */ + public function getInfo() + { + @trigger_error('The '.__METHOD__.' method is deprecated as of 2.8 and will be removed in 3.0.', E_USER_DEPRECATED); + + return parent::getInfo(); + } + + /** + * @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0. + */ + public function setInfo($data) + { + @trigger_error('The '.__METHOD__.' method is deprecated as of 2.8 and will be removed in 3.0.', E_USER_DEPRECATED); + + parent::setInfo($data); + } + + /** + * @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0. + */ + public function offsetExists($object) + { + @trigger_error('The '.__METHOD__.' method is deprecated as of 2.8 and will be removed in 3.0.', E_USER_DEPRECATED); + + return parent::offsetExists($object); + } + + /** + * @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0. + */ + public function offsetSet($object, $data = null) + { + @trigger_error('The '.__METHOD__.' method is deprecated as of 2.8 and will be removed in 3.0.', E_USER_DEPRECATED); + + parent::offsetSet($object, $data); + } + + /** + * @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0. + */ + public function offsetUnset($object) + { + @trigger_error('The '.__METHOD__.' method is deprecated as of 2.8 and will be removed in 3.0.', E_USER_DEPRECATED); + + parent::offsetUnset($object); + } + + /** + * @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0. + */ + public function offsetGet($object) + { + @trigger_error('The '.__METHOD__.' method is deprecated as of 2.8 and will be removed in 3.0.', E_USER_DEPRECATED); + + return parent::offsetGet($object); + } + + /** + * @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0. + */ + public function getHash($object) + { + // Cannot trigger a deprecation warning here because SplObjectStorage calls this method when attaching an object. + + return parent::getHash($object); + } + /** * Filters the list of nodes with an XPath expression. *