Mercurial > hg > cmmr2012-drupal-site
comparison vendor/symfony/var-dumper/Cloner/AbstractCloner.php @ 4:a9cd425dd02b
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:11:55 +0000 |
parents | c75dbcec494b |
children |
comparison
equal
deleted
inserted
replaced
3:307d7a7fd348 | 4:a9cd425dd02b |
---|---|
19 * | 19 * |
20 * @author Nicolas Grekas <p@tchwork.com> | 20 * @author Nicolas Grekas <p@tchwork.com> |
21 */ | 21 */ |
22 abstract class AbstractCloner implements ClonerInterface | 22 abstract class AbstractCloner implements ClonerInterface |
23 { | 23 { |
24 public static $defaultCasters = array( | 24 public static $defaultCasters = [ |
25 '__PHP_Incomplete_Class' => array('Symfony\Component\VarDumper\Caster\Caster', 'castPhpIncompleteClass'), | 25 '__PHP_Incomplete_Class' => ['Symfony\Component\VarDumper\Caster\Caster', 'castPhpIncompleteClass'], |
26 | 26 |
27 'Symfony\Component\VarDumper\Caster\CutStub' => array('Symfony\Component\VarDumper\Caster\StubCaster', 'castStub'), | 27 'Symfony\Component\VarDumper\Caster\CutStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castStub'], |
28 'Symfony\Component\VarDumper\Caster\CutArrayStub' => array('Symfony\Component\VarDumper\Caster\StubCaster', 'castCutArray'), | 28 'Symfony\Component\VarDumper\Caster\CutArrayStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castCutArray'], |
29 'Symfony\Component\VarDumper\Caster\ConstStub' => array('Symfony\Component\VarDumper\Caster\StubCaster', 'castStub'), | 29 'Symfony\Component\VarDumper\Caster\ConstStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castStub'], |
30 'Symfony\Component\VarDumper\Caster\EnumStub' => array('Symfony\Component\VarDumper\Caster\StubCaster', 'castEnum'), | 30 'Symfony\Component\VarDumper\Caster\EnumStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castEnum'], |
31 | 31 |
32 'Closure' => array('Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castClosure'), | 32 'Closure' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castClosure'], |
33 'Generator' => array('Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castGenerator'), | 33 'Generator' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castGenerator'], |
34 'ReflectionType' => array('Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castType'), | 34 'ReflectionType' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castType'], |
35 'ReflectionGenerator' => array('Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castReflectionGenerator'), | 35 'ReflectionGenerator' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castReflectionGenerator'], |
36 'ReflectionClass' => array('Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castClass'), | 36 'ReflectionClass' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castClass'], |
37 'ReflectionFunctionAbstract' => array('Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castFunctionAbstract'), | 37 'ReflectionFunctionAbstract' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castFunctionAbstract'], |
38 'ReflectionMethod' => array('Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castMethod'), | 38 'ReflectionMethod' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castMethod'], |
39 'ReflectionParameter' => array('Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castParameter'), | 39 'ReflectionParameter' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castParameter'], |
40 'ReflectionProperty' => array('Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castProperty'), | 40 'ReflectionProperty' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castProperty'], |
41 'ReflectionExtension' => array('Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castExtension'), | 41 'ReflectionExtension' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castExtension'], |
42 'ReflectionZendExtension' => array('Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castZendExtension'), | 42 'ReflectionZendExtension' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castZendExtension'], |
43 | 43 |
44 'Doctrine\Common\Persistence\ObjectManager' => array('Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'), | 44 'Doctrine\Common\Persistence\ObjectManager' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'], |
45 'Doctrine\Common\Proxy\Proxy' => array('Symfony\Component\VarDumper\Caster\DoctrineCaster', 'castCommonProxy'), | 45 'Doctrine\Common\Proxy\Proxy' => ['Symfony\Component\VarDumper\Caster\DoctrineCaster', 'castCommonProxy'], |
46 'Doctrine\ORM\Proxy\Proxy' => array('Symfony\Component\VarDumper\Caster\DoctrineCaster', 'castOrmProxy'), | 46 'Doctrine\ORM\Proxy\Proxy' => ['Symfony\Component\VarDumper\Caster\DoctrineCaster', 'castOrmProxy'], |
47 'Doctrine\ORM\PersistentCollection' => array('Symfony\Component\VarDumper\Caster\DoctrineCaster', 'castPersistentCollection'), | 47 'Doctrine\ORM\PersistentCollection' => ['Symfony\Component\VarDumper\Caster\DoctrineCaster', 'castPersistentCollection'], |
48 | 48 |
49 'DOMException' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castException'), | 49 'DOMException' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castException'], |
50 'DOMStringList' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'), | 50 'DOMStringList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'], |
51 'DOMNameList' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'), | 51 'DOMNameList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'], |
52 'DOMImplementation' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castImplementation'), | 52 'DOMImplementation' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castImplementation'], |
53 'DOMImplementationList' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'), | 53 'DOMImplementationList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'], |
54 'DOMNode' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castNode'), | 54 'DOMNode' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castNode'], |
55 'DOMNameSpaceNode' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castNameSpaceNode'), | 55 'DOMNameSpaceNode' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castNameSpaceNode'], |
56 'DOMDocument' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castDocument'), | 56 'DOMDocument' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDocument'], |
57 'DOMNodeList' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'), | 57 'DOMNodeList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'], |
58 'DOMNamedNodeMap' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'), | 58 'DOMNamedNodeMap' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'], |
59 'DOMCharacterData' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castCharacterData'), | 59 'DOMCharacterData' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castCharacterData'], |
60 'DOMAttr' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castAttr'), | 60 'DOMAttr' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castAttr'], |
61 'DOMElement' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castElement'), | 61 'DOMElement' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castElement'], |
62 'DOMText' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castText'), | 62 'DOMText' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castText'], |
63 'DOMTypeinfo' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castTypeinfo'), | 63 'DOMTypeinfo' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castTypeinfo'], |
64 'DOMDomError' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castDomError'), | 64 'DOMDomError' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDomError'], |
65 'DOMLocator' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castLocator'), | 65 'DOMLocator' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLocator'], |
66 'DOMDocumentType' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castDocumentType'), | 66 'DOMDocumentType' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDocumentType'], |
67 'DOMNotation' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castNotation'), | 67 'DOMNotation' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castNotation'], |
68 'DOMEntity' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castEntity'), | 68 'DOMEntity' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castEntity'], |
69 'DOMProcessingInstruction' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castProcessingInstruction'), | 69 'DOMProcessingInstruction' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castProcessingInstruction'], |
70 'DOMXPath' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castXPath'), | 70 'DOMXPath' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castXPath'], |
71 | 71 |
72 'XmlReader' => array('Symfony\Component\VarDumper\Caster\XmlReaderCaster', 'castXmlReader'), | 72 'XmlReader' => ['Symfony\Component\VarDumper\Caster\XmlReaderCaster', 'castXmlReader'], |
73 | 73 |
74 'ErrorException' => array('Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castErrorException'), | 74 'ErrorException' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castErrorException'], |
75 'Exception' => array('Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castException'), | 75 'Exception' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castException'], |
76 'Error' => array('Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castError'), | 76 'Error' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castError'], |
77 'Symfony\Component\DependencyInjection\ContainerInterface' => array('Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'), | 77 'Symfony\Component\DependencyInjection\ContainerInterface' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'], |
78 'Symfony\Component\HttpFoundation\Request' => array('Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castRequest'), | 78 'Symfony\Component\HttpFoundation\Request' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castRequest'], |
79 'Symfony\Component\VarDumper\Exception\ThrowingCasterException' => array('Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castThrowingCasterException'), | 79 'Symfony\Component\VarDumper\Exception\ThrowingCasterException' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castThrowingCasterException'], |
80 'Symfony\Component\VarDumper\Caster\TraceStub' => array('Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castTraceStub'), | 80 'Symfony\Component\VarDumper\Caster\TraceStub' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castTraceStub'], |
81 'Symfony\Component\VarDumper\Caster\FrameStub' => array('Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castFrameStub'), | 81 'Symfony\Component\VarDumper\Caster\FrameStub' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castFrameStub'], |
82 'Symfony\Component\Debug\Exception\SilencedErrorContext' => array('Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castSilencedErrorContext'), | 82 'Symfony\Component\Debug\Exception\SilencedErrorContext' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castSilencedErrorContext'], |
83 | 83 |
84 'PHPUnit_Framework_MockObject_MockObject' => array('Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'), | 84 'PHPUnit_Framework_MockObject_MockObject' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'], |
85 'Prophecy\Prophecy\ProphecySubjectInterface' => array('Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'), | 85 'Prophecy\Prophecy\ProphecySubjectInterface' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'], |
86 'Mockery\MockInterface' => array('Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'), | 86 'Mockery\MockInterface' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'], |
87 | 87 |
88 'PDO' => array('Symfony\Component\VarDumper\Caster\PdoCaster', 'castPdo'), | 88 'PDO' => ['Symfony\Component\VarDumper\Caster\PdoCaster', 'castPdo'], |
89 'PDOStatement' => array('Symfony\Component\VarDumper\Caster\PdoCaster', 'castPdoStatement'), | 89 'PDOStatement' => ['Symfony\Component\VarDumper\Caster\PdoCaster', 'castPdoStatement'], |
90 | 90 |
91 'AMQPConnection' => array('Symfony\Component\VarDumper\Caster\AmqpCaster', 'castConnection'), | 91 'AMQPConnection' => ['Symfony\Component\VarDumper\Caster\AmqpCaster', 'castConnection'], |
92 'AMQPChannel' => array('Symfony\Component\VarDumper\Caster\AmqpCaster', 'castChannel'), | 92 'AMQPChannel' => ['Symfony\Component\VarDumper\Caster\AmqpCaster', 'castChannel'], |
93 'AMQPQueue' => array('Symfony\Component\VarDumper\Caster\AmqpCaster', 'castQueue'), | 93 'AMQPQueue' => ['Symfony\Component\VarDumper\Caster\AmqpCaster', 'castQueue'], |
94 'AMQPExchange' => array('Symfony\Component\VarDumper\Caster\AmqpCaster', 'castExchange'), | 94 'AMQPExchange' => ['Symfony\Component\VarDumper\Caster\AmqpCaster', 'castExchange'], |
95 'AMQPEnvelope' => array('Symfony\Component\VarDumper\Caster\AmqpCaster', 'castEnvelope'), | 95 'AMQPEnvelope' => ['Symfony\Component\VarDumper\Caster\AmqpCaster', 'castEnvelope'], |
96 | 96 |
97 'ArrayObject' => array('Symfony\Component\VarDumper\Caster\SplCaster', 'castArrayObject'), | 97 'ArrayObject' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castArrayObject'], |
98 'ArrayIterator' => array('Symfony\Component\VarDumper\Caster\SplCaster', 'castArrayIterator'), | 98 'ArrayIterator' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castArrayIterator'], |
99 'SplDoublyLinkedList' => array('Symfony\Component\VarDumper\Caster\SplCaster', 'castDoublyLinkedList'), | 99 'SplDoublyLinkedList' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castDoublyLinkedList'], |
100 'SplFileInfo' => array('Symfony\Component\VarDumper\Caster\SplCaster', 'castFileInfo'), | 100 'SplFileInfo' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castFileInfo'], |
101 'SplFileObject' => array('Symfony\Component\VarDumper\Caster\SplCaster', 'castFileObject'), | 101 'SplFileObject' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castFileObject'], |
102 'SplFixedArray' => array('Symfony\Component\VarDumper\Caster\SplCaster', 'castFixedArray'), | 102 'SplFixedArray' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castFixedArray'], |
103 'SplHeap' => array('Symfony\Component\VarDumper\Caster\SplCaster', 'castHeap'), | 103 'SplHeap' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castHeap'], |
104 'SplObjectStorage' => array('Symfony\Component\VarDumper\Caster\SplCaster', 'castObjectStorage'), | 104 'SplObjectStorage' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castObjectStorage'], |
105 'SplPriorityQueue' => array('Symfony\Component\VarDumper\Caster\SplCaster', 'castHeap'), | 105 'SplPriorityQueue' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castHeap'], |
106 'OuterIterator' => array('Symfony\Component\VarDumper\Caster\SplCaster', 'castOuterIterator'), | 106 'OuterIterator' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castOuterIterator'], |
107 | 107 |
108 'MongoCursorInterface' => array('Symfony\Component\VarDumper\Caster\MongoCaster', 'castCursor'), | 108 'MongoCursorInterface' => ['Symfony\Component\VarDumper\Caster\MongoCaster', 'castCursor'], |
109 | 109 |
110 'Redis' => array('Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedis'), | 110 'Redis' => ['Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedis'], |
111 'RedisArray' => array('Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedisArray'), | 111 'RedisArray' => ['Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedisArray'], |
112 | 112 |
113 'DateTimeInterface' => array('Symfony\Component\VarDumper\Caster\DateCaster', 'castDateTime'), | 113 'DateTimeInterface' => ['Symfony\Component\VarDumper\Caster\DateCaster', 'castDateTime'], |
114 'DateInterval' => array('Symfony\Component\VarDumper\Caster\DateCaster', 'castInterval'), | 114 'DateInterval' => ['Symfony\Component\VarDumper\Caster\DateCaster', 'castInterval'], |
115 'DateTimeZone' => array('Symfony\Component\VarDumper\Caster\DateCaster', 'castTimeZone'), | 115 'DateTimeZone' => ['Symfony\Component\VarDumper\Caster\DateCaster', 'castTimeZone'], |
116 'DatePeriod' => array('Symfony\Component\VarDumper\Caster\DateCaster', 'castPeriod'), | 116 'DatePeriod' => ['Symfony\Component\VarDumper\Caster\DateCaster', 'castPeriod'], |
117 | 117 |
118 ':curl' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castCurl'), | 118 ':curl' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castCurl'], |
119 ':dba' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'), | 119 ':dba' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'], |
120 ':dba persistent' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'), | 120 ':dba persistent' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'], |
121 ':gd' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castGd'), | 121 ':gd' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castGd'], |
122 ':mysql link' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castMysqlLink'), | 122 ':mysql link' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castMysqlLink'], |
123 ':pgsql large object' => array('Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLargeObject'), | 123 ':pgsql large object' => ['Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLargeObject'], |
124 ':pgsql link' => array('Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLink'), | 124 ':pgsql link' => ['Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLink'], |
125 ':pgsql link persistent' => array('Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLink'), | 125 ':pgsql link persistent' => ['Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLink'], |
126 ':pgsql result' => array('Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castResult'), | 126 ':pgsql result' => ['Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castResult'], |
127 ':process' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castProcess'), | 127 ':process' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castProcess'], |
128 ':stream' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castStream'), | 128 ':stream' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castStream'], |
129 ':persistent stream' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castStream'), | 129 ':persistent stream' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castStream'], |
130 ':stream-context' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castStreamContext'), | 130 ':stream-context' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castStreamContext'], |
131 ':xml' => array('Symfony\Component\VarDumper\Caster\XmlResourceCaster', 'castXml'), | 131 ':xml' => ['Symfony\Component\VarDumper\Caster\XmlResourceCaster', 'castXml'], |
132 ); | 132 ]; |
133 | 133 |
134 protected $maxItems = 2500; | 134 protected $maxItems = 2500; |
135 protected $maxString = -1; | 135 protected $maxString = -1; |
136 protected $minDepth = 1; | 136 protected $minDepth = 1; |
137 protected $useExt; | 137 protected $useExt; |
138 | 138 |
139 private $casters = array(); | 139 private $casters = []; |
140 private $prevErrorHandler; | 140 private $prevErrorHandler; |
141 private $classInfo = array(); | 141 private $classInfo = []; |
142 private $filter = 0; | 142 private $filter = 0; |
143 | 143 |
144 /** | 144 /** |
145 * @param callable[]|null $casters A map of casters | 145 * @param callable[]|null $casters A map of casters |
146 * | 146 * |
150 { | 150 { |
151 if (null === $casters) { | 151 if (null === $casters) { |
152 $casters = static::$defaultCasters; | 152 $casters = static::$defaultCasters; |
153 } | 153 } |
154 $this->addCasters($casters); | 154 $this->addCasters($casters); |
155 $this->useExt = extension_loaded('symfony_debug'); | 155 $this->useExt = \extension_loaded('symfony_debug'); |
156 } | 156 } |
157 | 157 |
158 /** | 158 /** |
159 * Adds casters for resources and objects. | 159 * Adds casters for resources and objects. |
160 * | 160 * |
166 * @param callable[] $casters A map of casters | 166 * @param callable[] $casters A map of casters |
167 */ | 167 */ |
168 public function addCasters(array $casters) | 168 public function addCasters(array $casters) |
169 { | 169 { |
170 foreach ($casters as $type => $callback) { | 170 foreach ($casters as $type => $callback) { |
171 $this->casters[strtolower($type)][] = is_string($callback) && false !== strpos($callback, '::') ? explode('::', $callback, 2) : $callback; | 171 $this->casters[strtolower($type)][] = \is_string($callback) && false !== strpos($callback, '::') ? explode('::', $callback, 2) : $callback; |
172 } | 172 } |
173 } | 173 } |
174 | 174 |
175 /** | 175 /** |
176 * Sets the maximum number of items to clone past the minimum depth in nested structures. | 176 * Sets the maximum number of items to clone past the minimum depth in nested structures. |
211 * | 211 * |
212 * @return Data The cloned variable represented by a Data object | 212 * @return Data The cloned variable represented by a Data object |
213 */ | 213 */ |
214 public function cloneVar($var, $filter = 0) | 214 public function cloneVar($var, $filter = 0) |
215 { | 215 { |
216 $this->prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = array()) { | 216 $this->prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = []) { |
217 if (E_RECOVERABLE_ERROR === $type || E_USER_ERROR === $type) { | 217 if (E_RECOVERABLE_ERROR === $type || E_USER_ERROR === $type) { |
218 // Cloner never dies | 218 // Cloner never dies |
219 throw new \ErrorException($msg, 0, $type, $file, $line); | 219 throw new \ErrorException($msg, 0, $type, $file, $line); |
220 } | 220 } |
221 | 221 |
222 if ($this->prevErrorHandler) { | 222 if ($this->prevErrorHandler) { |
223 return call_user_func($this->prevErrorHandler, $type, $msg, $file, $line, $context); | 223 return \call_user_func($this->prevErrorHandler, $type, $msg, $file, $line, $context); |
224 } | 224 } |
225 | 225 |
226 return false; | 226 return false; |
227 }); | 227 }); |
228 $this->filter = $filter; | 228 $this->filter = $filter; |
268 } | 268 } |
269 if (isset($this->classInfo[$class])) { | 269 if (isset($this->classInfo[$class])) { |
270 list($i, $parents, $hasDebugInfo) = $this->classInfo[$class]; | 270 list($i, $parents, $hasDebugInfo) = $this->classInfo[$class]; |
271 } else { | 271 } else { |
272 $i = 2; | 272 $i = 2; |
273 $parents = array(strtolower($class)); | 273 $parents = [strtolower($class)]; |
274 $hasDebugInfo = method_exists($class, '__debugInfo'); | 274 $hasDebugInfo = method_exists($class, '__debugInfo'); |
275 | 275 |
276 foreach (class_parents($class) as $p) { | 276 foreach (class_parents($class) as $p) { |
277 $parents[] = strtolower($p); | 277 $parents[] = strtolower($p); |
278 ++$i; | 278 ++$i; |
281 $parents[] = strtolower($p); | 281 $parents[] = strtolower($p); |
282 ++$i; | 282 ++$i; |
283 } | 283 } |
284 $parents[] = '*'; | 284 $parents[] = '*'; |
285 | 285 |
286 $this->classInfo[$class] = array($i, $parents, $hasDebugInfo); | 286 $this->classInfo[$class] = [$i, $parents, $hasDebugInfo]; |
287 } | 287 } |
288 | 288 |
289 $a = Caster::castObject($obj, $class, $hasDebugInfo); | 289 $a = Caster::castObject($obj, $class, $hasDebugInfo); |
290 | 290 |
291 try { | 291 try { |
295 $a = $callback($obj, $a, $stub, $isNested, $this->filter); | 295 $a = $callback($obj, $a, $stub, $isNested, $this->filter); |
296 } | 296 } |
297 } | 297 } |
298 } | 298 } |
299 } catch (\Exception $e) { | 299 } catch (\Exception $e) { |
300 $a = array((Stub::TYPE_OBJECT === $stub->type ? Caster::PREFIX_VIRTUAL : '').'⚠' => new ThrowingCasterException($e)) + $a; | 300 $a = [(Stub::TYPE_OBJECT === $stub->type ? Caster::PREFIX_VIRTUAL : '').'⚠' => new ThrowingCasterException($e)] + $a; |
301 } | 301 } |
302 | 302 |
303 return $a; | 303 return $a; |
304 } | 304 } |
305 | 305 |
311 * | 311 * |
312 * @return array The resource casted as array | 312 * @return array The resource casted as array |
313 */ | 313 */ |
314 protected function castResource(Stub $stub, $isNested) | 314 protected function castResource(Stub $stub, $isNested) |
315 { | 315 { |
316 $a = array(); | 316 $a = []; |
317 $res = $stub->value; | 317 $res = $stub->value; |
318 $type = $stub->class; | 318 $type = $stub->class; |
319 | 319 |
320 try { | 320 try { |
321 if (!empty($this->casters[':'.$type])) { | 321 if (!empty($this->casters[':'.$type])) { |
322 foreach ($this->casters[':'.$type] as $callback) { | 322 foreach ($this->casters[':'.$type] as $callback) { |
323 $a = $callback($res, $a, $stub, $isNested, $this->filter); | 323 $a = $callback($res, $a, $stub, $isNested, $this->filter); |
324 } | 324 } |
325 } | 325 } |
326 } catch (\Exception $e) { | 326 } catch (\Exception $e) { |
327 $a = array((Stub::TYPE_OBJECT === $stub->type ? Caster::PREFIX_VIRTUAL : '').'⚠' => new ThrowingCasterException($e)) + $a; | 327 $a = [(Stub::TYPE_OBJECT === $stub->type ? Caster::PREFIX_VIRTUAL : '').'⚠' => new ThrowingCasterException($e)] + $a; |
328 } | 328 } |
329 | 329 |
330 return $a; | 330 return $a; |
331 } | 331 } |
332 } | 332 } |