21
21
abstract class AbstractCloner implements ClonerInterface
22
22
{
23
23
public static $ defaultCasters = array (
24
- 'o: Symfony\Component\VarDumper\Caster\CasterStub ' => 'Symfony\Component\VarDumper\Caster\StubCaster::castStub ' ,
25
-
26
- 'o: Closure ' => 'Symfony\Component\VarDumper\Caster\ReflectionCaster::castClosure ' ,
27
- 'o: Reflector ' => 'Symfony\Component\VarDumper\Caster\ReflectionCaster::castReflector ' ,
28
-
29
- 'o: Doctrine\Common\Persistence\ObjectManager ' => 'Symfony\Component\VarDumper\Caster\StubCaster::castNestedFat ' ,
30
- 'o: Doctrine\Common\Proxy\Proxy ' => 'Symfony\Component\VarDumper\Caster\DoctrineCaster::castCommonProxy ' ,
31
- 'o: Doctrine\ORM\Proxy\Proxy ' => 'Symfony\Component\VarDumper\Caster\DoctrineCaster::castOrmProxy ' ,
32
- 'o: Doctrine\ORM\PersistentCollection ' => 'Symfony\Component\VarDumper\Caster\DoctrineCaster::castPersistentCollection ' ,
33
-
34
- 'o: DOMException ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castException ' ,
35
- 'o: DOMStringList ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castLength ' ,
36
- 'o: DOMNameList ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castLength ' ,
37
- 'o: DOMImplementation ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castImplementation ' ,
38
- 'o: DOMImplementationList ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castLength ' ,
39
- 'o: DOMNode ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castNode ' ,
40
- 'o: DOMNameSpaceNode ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castNameSpaceNode ' ,
41
- 'o: DOMDocument ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castDocument ' ,
42
- 'o: DOMNodeList ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castLength ' ,
43
- 'o: DOMNamedNodeMap ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castLength ' ,
44
- 'o: DOMCharacterData ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castCharacterData ' ,
45
- 'o: DOMAttr ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castAttr ' ,
46
- 'o: DOMElement ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castElement ' ,
47
- 'o: DOMText ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castText ' ,
48
- 'o: DOMTypeinfo ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castTypeinfo ' ,
49
- 'o: DOMDomError ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castDomError ' ,
50
- 'o: DOMLocator ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castLocator ' ,
51
- 'o: DOMDocumentType ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castDocumentType ' ,
52
- 'o: DOMNotation ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castNotation ' ,
53
- 'o: DOMEntity ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castEntity ' ,
54
- 'o: DOMProcessingInstruction ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castProcessingInstruction ' ,
55
- 'o: DOMXPath ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castXPath ' ,
56
-
57
- 'o: ErrorException ' => 'Symfony\Component\VarDumper\Caster\ExceptionCaster::castErrorException ' ,
58
- 'o: Exception ' => 'Symfony\Component\VarDumper\Caster\ExceptionCaster::castException ' ,
59
- 'o: Symfony\Component\DependencyInjection\ContainerInterface '
24
+ 'Symfony\Component\VarDumper\Caster\CasterStub ' => 'Symfony\Component\VarDumper\Caster\StubCaster::castStub ' ,
25
+
26
+ 'Closure ' => 'Symfony\Component\VarDumper\Caster\ReflectionCaster::castClosure ' ,
27
+ 'Reflector ' => 'Symfony\Component\VarDumper\Caster\ReflectionCaster::castReflector ' ,
28
+
29
+ 'Doctrine\Common\Persistence\ObjectManager ' => 'Symfony\Component\VarDumper\Caster\StubCaster::castNestedFat ' ,
30
+ 'Doctrine\Common\Proxy\Proxy ' => 'Symfony\Component\VarDumper\Caster\DoctrineCaster::castCommonProxy ' ,
31
+ 'Doctrine\ORM\Proxy\Proxy ' => 'Symfony\Component\VarDumper\Caster\DoctrineCaster::castOrmProxy ' ,
32
+ 'Doctrine\ORM\PersistentCollection ' => 'Symfony\Component\VarDumper\Caster\DoctrineCaster::castPersistentCollection ' ,
33
+
34
+ 'DOMException ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castException ' ,
35
+ 'DOMStringList ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castLength ' ,
36
+ 'DOMNameList ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castLength ' ,
37
+ 'DOMImplementation ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castImplementation ' ,
38
+ 'DOMImplementationList ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castLength ' ,
39
+ 'DOMNode ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castNode ' ,
40
+ 'DOMNameSpaceNode ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castNameSpaceNode ' ,
41
+ 'DOMDocument ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castDocument ' ,
42
+ 'DOMNodeList ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castLength ' ,
43
+ 'DOMNamedNodeMap ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castLength ' ,
44
+ 'DOMCharacterData ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castCharacterData ' ,
45
+ 'DOMAttr ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castAttr ' ,
46
+ 'DOMElement ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castElement ' ,
47
+ 'DOMText ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castText ' ,
48
+ 'DOMTypeinfo ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castTypeinfo ' ,
49
+ 'DOMDomError ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castDomError ' ,
50
+ 'DOMLocator ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castLocator ' ,
51
+ 'DOMDocumentType ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castDocumentType ' ,
52
+ 'DOMNotation ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castNotation ' ,
53
+ 'DOMEntity ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castEntity ' ,
54
+ 'DOMProcessingInstruction ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castProcessingInstruction ' ,
55
+ 'DOMXPath ' => 'Symfony\Component\VarDumper\Caster\DOMCaster::castXPath ' ,
56
+
57
+ 'ErrorException ' => 'Symfony\Component\VarDumper\Caster\ExceptionCaster::castErrorException ' ,
58
+ 'Exception ' => 'Symfony\Component\VarDumper\Caster\ExceptionCaster::castException ' ,
59
+ 'Symfony\Component\DependencyInjection\ContainerInterface '
60
60
=> 'Symfony\Component\VarDumper\Caster\StubCaster::castNestedFat ' ,
61
- 'o: Symfony\Component\VarDumper\Exception\ThrowingCasterException '
61
+ 'Symfony\Component\VarDumper\Exception\ThrowingCasterException '
62
62
=> 'Symfony\Component\VarDumper\Caster\ExceptionCaster::castThrowingCasterException ' ,
63
63
64
- 'o: PDO ' => 'Symfony\Component\VarDumper\Caster\PdoCaster::castPdo ' ,
65
- 'o: PDOStatement ' => 'Symfony\Component\VarDumper\Caster\PdoCaster::castPdoStatement ' ,
66
-
67
- 'o: ArrayObject ' => 'Symfony\Component\VarDumper\Caster\SplCaster::castArrayObject ' ,
68
- 'o: SplDoublyLinkedList ' => 'Symfony\Component\VarDumper\Caster\SplCaster::castDoublyLinkedList ' ,
69
- 'o: SplFixedArray ' => 'Symfony\Component\VarDumper\Caster\SplCaster::castFixedArray ' ,
70
- 'o: SplHeap ' => 'Symfony\Component\VarDumper\Caster\SplCaster::castHeap ' ,
71
- 'o: SplObjectStorage ' => 'Symfony\Component\VarDumper\Caster\SplCaster::castObjectStorage ' ,
72
- 'o: SplPriorityQueue ' => 'Symfony\Component\VarDumper\Caster\SplCaster::castHeap ' ,
73
-
74
- 'r :curl ' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castCurl ' ,
75
- 'r :dba ' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castDba ' ,
76
- 'r :dba persistent ' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castDba ' ,
77
- 'r :gd ' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castGd ' ,
78
- 'r :mysql link ' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castMysqlLink ' ,
79
- 'r :process ' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castProcess ' ,
80
- 'r :stream ' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castStream ' ,
81
- 'r :stream-context ' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castStreamContext ' ,
64
+ 'PDO ' => 'Symfony\Component\VarDumper\Caster\PdoCaster::castPdo ' ,
65
+ 'PDOStatement ' => 'Symfony\Component\VarDumper\Caster\PdoCaster::castPdoStatement ' ,
66
+
67
+ 'ArrayObject ' => 'Symfony\Component\VarDumper\Caster\SplCaster::castArrayObject ' ,
68
+ 'SplDoublyLinkedList ' => 'Symfony\Component\VarDumper\Caster\SplCaster::castDoublyLinkedList ' ,
69
+ 'SplFixedArray ' => 'Symfony\Component\VarDumper\Caster\SplCaster::castFixedArray ' ,
70
+ 'SplHeap ' => 'Symfony\Component\VarDumper\Caster\SplCaster::castHeap ' ,
71
+ 'SplObjectStorage ' => 'Symfony\Component\VarDumper\Caster\SplCaster::castObjectStorage ' ,
72
+ 'SplPriorityQueue ' => 'Symfony\Component\VarDumper\Caster\SplCaster::castHeap ' ,
73
+
74
+ ':curl ' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castCurl ' ,
75
+ ':dba ' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castDba ' ,
76
+ ':dba persistent ' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castDba ' ,
77
+ ':gd ' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castGd ' ,
78
+ ':mysql link ' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castMysqlLink ' ,
79
+ ':process ' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castProcess ' ,
80
+ ':stream ' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castStream ' ,
81
+ ':stream-context ' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castStreamContext ' ,
82
82
);
83
83
84
84
protected $ maxItems = 250 ;
@@ -107,8 +107,7 @@ public function __construct(array $casters = null)
107
107
*
108
108
* Maps resources or objects types to a callback.
109
109
* Types are in the key, with a callable caster for value.
110
- * Objects class are to be prefixed with a `o:`,
111
- * resources type are to be prefixed with a `r:`,
110
+ * Resource types are to be prefixed with a `:`,
112
111
* see e.g. static::$defaultCasters.
113
112
*
114
113
* @param callable[] $casters A map of casters.
@@ -193,7 +192,7 @@ protected function castObject($obj, Stub $stub, $isNested)
193
192
$ class ,
194
193
method_exists ($ class , '__debugInfo ' ),
195
194
new \ReflectionClass ($ class ),
196
- array_reverse (array ($ class => $ class ) + class_parents ($ class ) + class_implements ($ class ) + array ( ' * ' => ' * ' ) ),
195
+ array_reverse (array ($ class => $ class ) + class_parents ($ class ) + class_implements ($ class )),
197
196
);
198
197
199
198
$ this ->classInfo [$ class ] = $ classInfo ;
@@ -213,7 +212,7 @@ protected function castObject($obj, Stub $stub, $isNested)
213
212
}
214
213
215
214
foreach ($ classInfo [3 ] as $ p ) {
216
- if (!empty ($ this ->casters [$ p = ' o: ' . strtolower ($ p )])) {
215
+ if (!empty ($ this ->casters [$ p = strtolower ($ p )])) {
217
216
foreach ($ this ->casters [$ p ] as $ p ) {
218
217
$ a = $ this ->callCaster ($ p , $ obj , $ a , $ stub , $ isNested );
219
218
}
@@ -237,8 +236,8 @@ protected function castResource($res, Stub $stub, $isNested)
237
236
$ a = array ();
238
237
$ type = $ stub ->class ;
239
238
240
- if (!empty ($ this ->casters ['r : ' .$ type ])) {
241
- foreach ($ this ->casters ['r : ' .$ type ] as $ c ) {
239
+ if (!empty ($ this ->casters [': ' .$ type ])) {
240
+ foreach ($ this ->casters [': ' .$ type ] as $ c ) {
242
241
$ a = $ this ->callCaster ($ c , $ res , $ a , $ stub , $ isNested );
243
242
}
244
243
}
0 commit comments