8000 feature #15907 [DomCrawler] Deprecate methods inherited from SplObjec… · symfony/symfony@6ae7d95 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6ae7d95

Browse files
committed
feature #15907 [DomCrawler] Deprecate methods inherited from SplObjectStorage (stof)
This PR was merged into the 2.8 branch. Discussion ---------- [DomCrawler] Deprecate methods inherited from SplObjectStorage | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | half of #15849 | License | MIT | Doc PR | n/a There is no documentation change to be done for it: we don't document the fact that DomCrawler extends SplObjectStorage (this is an implementation detail which leaked because of using inheritance rather than composition). Commits ------- 997c650 Deprecate methods inherited from SplObjectStorage
2 parents 58ed076 + 997c650 commit 6ae7d95

File tree

1 file changed

+133
-3
lines changed

1 file changed

+133
-3
lines changed

src/Symfony/Component/DomCrawler/Crawler.php

Lines changed: 133 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function __construct($node = null, $currentUri = null, $baseHref = null)
6666
*/
6767
public function clear()
6868
{
69-
$this->removeAll($this);
69+
parent::removeAll($this);
7070
}
7171

7272
/**
@@ -319,9 +319,9 @@ public function addNodes(array $nodes)
319319
public function addNode(\DOMNode $node)
320320
{
321321
if ($node instanceof \DOMDocument) {
322-
$this->attach($node->documentElement);
322+
parent::attach($node->documentElement);
323323
} else {
324-
$this->attach($node);
324+
parent::attach($node);
325325
}
326326
}
327327

@@ -876,6 +876,136 @@ public static function xpathLiteral($s)
876876
return sprintf('concat(%s)', implode($parts, ', '));
877877
}
878878

879+
/**
880+
* @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0.
881+
*/
882+
public function attach($object, $data = null)
883+
{
884+
@trigger_error('The '.__METHOD__.' method is deprecated as of 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
885+
886+
parent::attach($object, $data);
887+
}
888+
889+
/**
890+
* @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0.
891+
*/
892+
public function detach($object)
893+
{
894+
@trigger_error('The '.__METHOD__.' method is deprecated as of 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
895+
896+
parent::detach($object);
897+
}
898+
899+
/**
900+
* @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0.
901+
*/
902+
public function contains($object)
903+
{
904+
@trigger_error('The '.__METHOD__.' method is deprecated as of 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
905+
906+
return parent::contains($object);
907+
}
908+
909+
/**
910+
* @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0.
911+
*/
912+
public function addAll($storage)
913+
{
914+
@trigger_error('The '.__METHOD__.' method is deprecated as of 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
915+
916+
parent::addAll($storage);
917+
}
918+
919+
/**
920+
* @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0.
921+
*/
922+
public function removeAll($storage)
923+
{
924+
@trigger_error('The '.__METHOD__.' method is deprecated as of 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
925+
926+
parent::removeAll($storage);
927+
}
928+
929+
/**
930+
* @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0.
931+
*/
932+
public function removeAllExcept($storage)
933+
{
934+
@trigger_error('The '.__METHOD__.' method is deprecated as of 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
935+
936+
parent::removeAllExcept($storage);
937+
}
938+
939+
/**
940+
* @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0.
941+
*/
942+
public function getInfo()
943+
{
944+
@trigger_error('The '.__METHOD__.' method is deprecated as of 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
945+
946+
return parent::getInfo();
947+
}
948+
949+
/**
950+
* @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0.
951+
*/
952+
public function setInfo($data)
953+
{
954+
@trigger_error('The '.__METHOD__.' method is deprecated as of 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
955+
956+
parent::setInfo($data);
957+
}
958+
959+
/**
960+
* @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0.
961+
*/
962+
public function offsetExists($object)
963+
{
964+
@trigger_error('The '.__METHOD__.' method is deprecated as of 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
965+
966+
return parent::offsetExists($object);
967+
}
968+
969+
/**
970+
* @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0.
971+
*/
972+
public function offsetSet($object, $data = null)
973+
{
974+
@trigger_error('The '.__METHOD__.' method is deprecated as of 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
975+
976+
parent::offsetSet($object, $data);
977+
}
978+
979+
/**
980+
* @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0.
981+
*/
982+
public function offsetUnset($object)
983+
{
984+
@trigger_error('The '.__METHOD__.' method is deprecated as of 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
985+
986+
parent::offsetUnset($object);
987+
}
988+
989+
/**
990+
* @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0.
991+
*/
992+
public function offsetGet($object)
993+
{
994+
@trigger_error('The '.__METHOD__.' method is deprecated as of 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
995+
996+
return parent::offsetGet($object);
997+
}
998+
999+
/**
1000+
* @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0.
1001+
*/
1002+
public function getHash($object)
1003+
{
1004+
// Cannot trigger a deprecation warning here because SplObjectStorage calls this method when attaching an object.
1005+
1006+
return parent::getHash($object);
1007+
}
1008+
8791009
/**
8801010
* Filters the list of nodes with an XPath expression.
8811011
*

0 commit comments

Comments
 (0)
0