Skip to content

Commit ad68f73

Browse files
committed
bug #54925 [VarDumper]  adapt namespace changes for new DOM extension classes (xabbuh)
This PR was merged into the 7.1 branch. Discussion ---------- [VarDumper]  adapt namespace changes for new DOM extension classes | Q | A | ------------- | --- | Branch? | 7.1 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | | License | MIT related to php/php-src#14171 Commits ------- 7e25a46 adapt namespace changes for new DOM extension classes
2 parents 744e54b + 7e25a46 commit ad68f73

File tree

3 files changed

+55
-55
lines changed

3 files changed

+55
-55
lines changed

src/Symfony/Component/VarDumper/Caster/DOMCaster.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class DOMCaster
6363
\XML_NAMESPACE_DECL_NODE => 'XML_NAMESPACE_DECL_NODE',
6464
];
6565

66-
public static function castException(\DOMException|\DOM\Exception $e, array $a, Stub $stub, bool $isNested): array
66+
public static function castException(\DOMException|\Dom\Exception $e, array $a, Stub $stub, bool $isNested): array
6767
{
6868
$k = Caster::PREFIX_PROTECTED.'code';
6969
if (isset($a[$k], self::ERROR_CODES[$a[$k]])) {
@@ -82,7 +82,7 @@ public static function castLength($dom, array $a, Stub $stub, bool $isNested): a
8282
return $a;
8383
}
8484

85-
public static function castImplementation(\DOMImplementation|\DOM\Implementation $dom, array $a, Stub $stub, bool $isNested): array
85+
public static function castImplementation(\DOMImplementation|\Dom\Implementation $dom, array $a, Stub $stub, bool $isNested): array
8686
{
8787
$a += [
8888
Caster::PREFIX_VIRTUAL.'Core' => '1.0',
@@ -92,7 +92,7 @@ public static function castImplementation(\DOMImplementation|\DOM\Implementation
9292
return $a;
9393
}
9494

95-
public static function castNode(\DOMNode|\DOM\Node $dom, array $a, Stub $stub, bool $isNested): array
95+
public static function castNode(\DOMNode|\Dom\Node $dom, array $a, Stub $stub, bool $isNested): array
9696
{
9797
$a += [
9898
'nodeName' => $dom->nodeName,
@@ -109,7 +109,7 @@ public static function castNode(\DOMNode|\DOM\Node $dom, array $a, Stub $stub, b
109109
'textContent' => new CutStub($dom->textContent),
110110
];
111111

112-
if ($dom instanceof \DOMNode || $dom instanceof \DOM\Element) {
112+
if ($dom instanceof \DOMNode || $dom instanceof \Dom\Element) {
113113
$a += [
114114
'attributes' => $dom->attributes,
115115
'namespaceURI' => $dom->namespaceURI,
@@ -171,7 +171,7 @@ public static function castDocument(\DOMDocument $dom, array $a, Stub $stub, boo
171171
return $a;
172172
}
173173

174-
public static function castXMLDocument(\DOM\XMLDocument $dom, array $a, Stub $stub, bool $isNested, int $filter = 0): array
174+
public static function castXMLDocument(\Dom\XMLDocument $dom, array $a, Stub $stub, bool $isNested, int $filter = 0): array
175175
{
176176
$a += [
177177
'doctype' => $dom->doctype,
@@ -195,7 +195,7 @@ public static function castXMLDocument(\DOM\XMLDocument $dom, array $a, Stub $st
195195
return $a;
196196
}
197197

198-
public static function castHTMLDocument(\DOM\HTMLDocument $dom, array $a, Stub $stub, bool $isNested, int $filter = 0): array
198+
public static function castHTMLDocument(\Dom\HTMLDocument $dom, array $a, Stub $stub, bool $isNested, int $filter = 0): array
199199
{
200200
$a += [
201201
'doctype' => $dom->doctype,
@@ -212,7 +212,7 @@ public static function castHTMLDocument(\DOM\HTMLDocument $dom, array $a, Stub $
212212
return $a;
213213
}
214214

215-
public static function castCharacterData(\DOMCharacterData|\DOM\CharacterData $dom, array $a, Stub $stub, bool $isNested): array
215+
public static function castCharacterData(\DOMCharacterData|\Dom\CharacterData $dom, array $a, Stub $stub, bool $isNested): array
216216
{
217217
$a += [
218218
'data' => $dom->data,
@@ -222,7 +222,7 @@ public static function castCharacterData(\DOMCharacterData|\DOM\CharacterData $d
222222
return $a;
223223
}
224224

225-
public static function castAttr(\DOMAttr|\DOM\Attr $dom, array $a, Stub $stub, bool $isNested): array
225+
public static function castAttr(\DOMAttr|\Dom\Attr $dom, array $a, Stub $stub, bool $isNested): array
226226
{
227227
$a += [
228228
'name' => $dom->name,
@@ -240,7 +240,7 @@ public static function castAttr(\DOMAttr|\DOM\Attr $dom, array $a, Stub $stub, b
240240
return $a;
241241
}
242242

243-
public static function castElement(\DOMElement|\DOM\Element $dom, array $a, Stub $stub, bool $isNested): array
243+
public static function castElement(\DOMElement|\Dom\Element $dom, array $a, Stub $stub, bool $isNested): array
244244
{
245245
$a += [
246246
'tagName' => $dom->tagName,
@@ -255,7 +255,7 @@ public static function castElement(\DOMElement|\DOM\Element $dom, array $a, Stub
255255
return $a;
256256
}
257257

258-
public static function castText(\DOMText|\DOM\Text $dom, array $a, Stub $stub, bool $isNested): array
258+
public static function castText(\DOMText|\Dom\Text $dom, array $a, Stub $stub, bool $isNested): array
259259
{
260260
$a += [
261261
'wholeText' => $dom->wholeText,
@@ -264,7 +264,7 @@ public static function castText(\DOMText|\DOM\Text $dom, array $a, Stub $stub, b
264264
return $a;
265265
}
266266

267-
public static function castDocumentType(\DOMDocumentType|\DOM\DocumentType $dom, array $a, Stub $stub, bool $isNested): array
267+
public static function castDocumentType(\DOMDocumentType|\Dom\DocumentType $dom, array $a, Stub $stub, bool $isNested): array
268268
{
269269
$a += [
270270
'name' => $dom->name,
@@ -278,7 +278,7 @@ public static function castDocumentType(\DOMDocumentType|\DOM\DocumentType $dom,
278278
return $a;
279279
}
280280

281-
public static function castNotation(\DOMNotation|\DOM\Notation $dom, array $a, Stub $stub, bool $isNested): array
281+
public static function castNotation(\DOMNotation|\Dom\Notation $dom, array $a, Stub $stub, bool $isNested): array
282282
{
283283
$a += [
284284
'publicId' => $dom->publicId,
@@ -288,7 +288,7 @@ public static function castNotation(\DOMNotation|\DOM\Notation $dom, array $a, S
288288
return $a;
289289
}
290290

291-
public static function castEntity(\DOMEntity|\DOM\Entity $dom, array $a, Stub $stub, bool $isNested): array
291+
public static function castEntity(\DOMEntity|\Dom\Entity $dom, array $a, Stub $stub, bool $isNested): array
292292
{
293293
$a += [
294294
'publicId' => $dom->publicId,
@@ -302,7 +302,7 @@ public static function castEntity(\DOMEntity|\DOM\Entity $dom, array $a, Stub $s
302302
return $a;
303303
}
304304

305-
public static function castProcessingInstruction(\DOMProcessingInstruction|\DOM\ProcessingInstruction $dom, array $a, Stub $stub, bool $isNested): array
305+
public static function castProcessingInstruction(\DOMProcessingInstruction|\Dom\ProcessingInstruction $dom, array $a, Stub $stub, bool $isNested): array
306306
{
307307
$a += [
308308
'target' => $dom->target,
@@ -312,7 +312,7 @@ public static function castProcessingInstruction(\DOMProcessingInstruction|\DOM\
312312
return $a;
313313
}
314314

315-
public static function castXPath(\DOMXPath|\DOM\XPath $dom, array $a, Stub $stub, bool $isNested): array
315+
public static function castXPath(\DOMXPath|\Dom\XPath $dom, array $a, Stub $stub, bool $isNested): array
316316
{
317317
$a += [
318318
'document' => $dom->document,

src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,38 +54,38 @@ abstract class AbstractCloner implements ClonerInterface
5454
'Doctrine\Persistence\ObjectManager' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
5555

5656
'DOMException' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castException'],
57-
'DOM\Exception' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castException'],
57+
'Dom\Exception' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castException'],
5858
'DOMStringList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'],
5959
'DOMNameList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'],
6060
'DOMImplementation' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castImplementation'],
61-
'DOM\Implementation' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castImplementation'],
61+
'Dom\Implementation' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castImplementation'],
6262
'DOMImplementationList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'],
6363
'DOMNode' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castNode'],
64-
'DOM\Node' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castNode'],
64+
'Dom\Node' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castNode'],
6565
'DOMNameSpaceNode' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castNameSpaceNode'],
6666
'DOMDocument' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDocument'],
67-
'DOM\XMLDocument' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castXMLDocument'],
68-
'DOM\HTMLDocument' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castHTMLDocument'],
67+
'Dom\XMLDocument' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castXMLDocument'],
68+
'Dom\HTMLDocument' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castHTMLDocument'],
6969
'DOMNodeList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'],
70-
'DOM\NodeList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'],
70+
'Dom\NodeList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'],
7171
'DOMNamedNodeMap' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'],
72-
'DOM\DTDNamedNodeMap' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'],
72+
'Dom\DTDNamedNodeMap' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'],
7373
'DOMCharacterData' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castCharacterData'],
74-
'DOM\CharacterData' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castCharacterData'],
74+
'Dom\CharacterData' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castCharacterData'],
7575
'DOMAttr' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castAttr'],
76-
'DOM\Attr' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castAttr'],
76+
'Dom\Attr' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castAttr'],
7777
'DOMElement' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castElement'],
78-
'DOM\Element' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castElement'],
78+
'Dom\Element' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castElement'],
7979
'DOMText' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castText'],
80-
'DOM\Text' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castText'],
80+
'Dom\Text' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castText'],
8181
'DOMDocumentType' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDocumentType'],
82-
'DOM\DocumentType' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDocumentType'],
82+
'Dom\DocumentType' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDocumentType'],
8383
'DOMNotation' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castNotation'],
84-
'DOM\Notation' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castNotation'],
84+
'Dom\Notation' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castNotation'],
8585
'DOMEntity' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castEntity'],
86-
'DOM\Entity' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castEntity'],
86+
'Dom\Entity' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castEntity'],
8787
'DOMProcessingInstruction' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castProcessingInstruction'],
88-
'DOM\ProcessingInstruction' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castProcessingInstruction'],
88+
'Dom\ProcessingInstruction' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castProcessingInstruction'],
8989
'DOMXPath' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castXPath'],
9090

9191
'XMLReader' => ['Symfony\Component\VarDumper\Caster\XmlReaderCaster', 'castXmlReader'],

src/Symfony/Component/VarDumper/Tests/Caster/DOMCasterTest.php

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ public function testCastImplementation()
3737
*/
3838
public function testCastModernImplementation()
3939
{
40-
$implementation = new \DOM\Implementation();
40+
$implementation = new \Dom\Implementation();
4141

4242
$this->assertDumpEquals(<<<'EODUMP'
43-
DOM\Implementation {
43+
Dom\Implementation {
4444
Core: "1.0"
4545
XML: "2.0"
4646
}
@@ -72,14 +72,14 @@ public function testCastNode()
7272
*/
7373
public function testCastModernNode()
7474
{
75-
$doc = \DOM\XMLDocument::createFromString('<foo><bar/></foo>');
75+
$doc = \Dom\XMLDocument::createFromString('<foo><bar/></foo>');
7676
$node = $doc->documentElement->firstChild;
7777

7878
$this->assertDumpMatchesFormat(<<<'EODUMP'
79-
DOM\Element {%A
79+
Dom\Element {%A
8080
+baseURI: ? string
8181
+isConnected: ? bool
82-
+ownerDocument: ? ?DOM\Document
82+
+ownerDocument: ? ?Dom\Document
8383
%A}
8484
EODUMP,
8585
$node
@@ -110,10 +110,10 @@ public function testCastDocument()
110110
*/
111111
public function testCastXMLDocument()
112112
{
113-
$doc = \DOM\XMLDocument::createFromString('<foo><bar/></foo>');
113+
$doc = \Dom\XMLDocument::createFromString('<foo><bar/></foo>');
114114

115115
$this->assertDumpMatchesFormat(<<<'EODUMP'
116-
DOM\XMLDocument {%A
116+
Dom\XMLDocument {%A
117117
xml: """
118118
<?xml version="1.0" encoding="UTF-8"?>\n
119119
<foo>\n
@@ -131,10 +131,10 @@ public function testCastXMLDocument()
131131
*/
132132
public function testCastHTMLDocument()
133133
{
134-
$doc = \DOM\HTMLDocument::createFromString('<!DOCTYPE html><html><body><p>foo</p></body></html>');
134+
$doc = \Dom\HTMLDocument::createFromString('<!DOCTYPE html><html><body><p>foo</p></body></html>');
135135

136136
$this->assertDumpMatchesFormat(<<<'EODUMP'
137-
DOM\HTMLDocument {%A
137+
Dom\HTMLDocument {%A
138138
html: "<!DOCTYPE html><html><head></head><body><p>foo</p></body></html>"
139139
}
140140
EODUMP,
@@ -160,9 +160,9 @@ public function testCastText()
160160
*/
161161
public function testCastModernText()
162162
{
163-
$text = \DOM\HTMLDocument::createEmpty()->createTextNode('foo');
163+
$text = \Dom\HTMLDocument::createEmpty()->createTextNode('foo');
164164
$this->assertDumpMatchesFormat(<<<'EODUMP'
165-
DOM\Text {%A
165+
Dom\Text {%A
166166
+wholeText: ? string
167167
}
168168
EODUMP,
@@ -192,13 +192,13 @@ public function testCastAttr()
192192
*/
193193
public function testCastModernAttr()
194194
{
195-
$attr = \DOM\HTMLDocument::createEmpty()->createAttribute('attr');
195+
$attr = \Dom\HTMLDocument::createEmpty()->createAttribute('attr');
196196

197197
$this->assertDumpMatchesFormat(<<<'EODUMP'
198-
DOM\Attr {%A
198+
Dom\Attr {%A
199199
+name: ? string
200200
+value: ? string
201-
+ownerElement: ? ?DOM\Element
201+
+ownerElement: ? ?Dom\Element
202202
+specified: true
203203
}
204204
EODUMP,
@@ -224,10 +224,10 @@ public function testCastElement()
224224
*/
225225
public function testCastModernElement()
226226
{
227-
$attr = \DOM\HTMLDocument::createEmpty()->createElement('foo');
227+
$attr = \Dom\HTMLDocument::createEmpty()->createElement('foo');
228228

229229
$this->assertDumpMatchesFormat(<<<'EODUMP'
230-
DOM\Element {%A
230+
Dom\Element {%A
231231
+tagName: ? string
232232
%A}
233233
EODUMP,
@@ -259,14 +259,14 @@ public function testCastDocumentType()
259259
*/
260260
public function testCastModernDocumentType()
261261
{
262-
$implementation = new \DOM\Implementation();
262+
$implementation = new \Dom\Implementation();
263263
$type = $implementation->createDocumentType('html', 'publicId', 'systemId');
264264

265265
$this->assertDumpMatchesFormat(<<<'EODUMP'
266-
DOM\DocumentType {%A
266+
Dom\DocumentType {%A
267267
+name: ? string
268-
+entities: ? DOM\DTDNamedNodeMap
269-
+notations: ? DOM\DTDNamedNodeMap
268+
+entities: ? Dom\DtdNamedNodeMap
269+
+notations: ? Dom\DtdNamedNodeMap
270270
+publicId: ? string
271271
+systemId: ? string
272272
+internalSubset: ? ?string
@@ -295,10 +295,10 @@ public function testCastProcessingInstruction()
295295
*/
296296
public function testCastModernProcessingInstruction()
297297
{
298-
$entity = \DOM\HTMLDocument::createEmpty()->createProcessingInstruction('target', 'data');
298+
$entity = \Dom\HTMLDocument::createEmpty()->createProcessingInstruction('target', 'data');
299299

300300
$this->assertDumpMatchesFormat(<<<'EODUMP'
301-
DOM\ProcessingInstruction {%A
301+
Dom\ProcessingInstruction {%A
302302
+data: ? string
303303
+length: ? int
304304
+target: ? string
@@ -327,11 +327,11 @@ public function testCastXPath()
327327
*/
328328
public function testCastModernXPath()
329329
{
330-
$entity = new \DOM\XPath(\DOM\HTMLDocument::createEmpty());
330+
$entity = new \Dom\XPath(\Dom\HTMLDocument::createEmpty());
331331

332332
$this->assertDumpEquals(<<<'EODUMP'
333-
DOM\XPath {
334-
+document: ? DOM\Document
333+
Dom\XPath {
334+
+document: ? Dom\Document
335335
+registerNodeNamespaces: ? bool
336336
}
337337
EODUMP,

0 commit comments

Comments
 (0)