13
13
14
14
use Doctrine \Common \Annotations \AnnotationReader ;
15
15
use PHPUnit \Framework \TestCase ;
16
+ use Symfony \Component \PropertyInfo \Extractor \PhpDocExtractor ;
17
+ use Symfony \Component \PropertyInfo \Type ;
16
18
use Symfony \Component \Serializer \Exception \NotNormalizableValueException ;
17
19
use Symfony \Component \Serializer \Mapping \Factory \ClassMetadataFactory ;
18
20
use Symfony \Component \Serializer \Mapping \Loader \AnnotationLoader ;
@@ -118,17 +120,17 @@ public function testDenormalizeCollectionDecodedFromXmlWithTwoChildren()
118
120
119
121
private function getDenormalizerForDummyCollection ()
120
122
{
121
- $ extractor = $ this ->getMockBuilder (' Symfony\Component\PropertyInfo\Extractor\ PhpDocExtractor' )->getMock ();
123
+ $ extractor = $ this ->getMockBuilder (PhpDocExtractor::class )->getMock ();
122
124
$ extractor ->method ('getTypes ' )
123
125
->will ($ this ->onConsecutiveCalls (
124
126
array (
125
- new \ Symfony \ Component \ PropertyInfo \ Type (
127
+ new Type (
126
128
'array ' ,
127
129
false ,
128
130
null ,
129
131
true ,
130
- new \ Symfony \ Component \ PropertyInfo \ Type ('int ' ),
131
- new \ Symfony \ Component \ PropertyInfo \ Type ('object ' , false , DummyChild::class)
132
+ new Type ('int ' ),
133
+ new Type ('object ' , false , DummyChild::class)
132
134
),
133
135
),
134
136
null
@@ -209,13 +211,12 @@ class DummyChild
209
211
public $ bar ;
210
212
}
211
213
212
- class SerializerCollectionDummy implements \ Symfony \ Component \ Serializer \ SerializerInterface, \ Symfony \ Component \ Serializer \ Normalizer \ DenormalizerInterface
214
+ class SerializerCollectionDummy implements SerializerInterface, DenormalizerInterface
213
215
{
214
- /** @var \Symfony\Component\Serializer\Normalizer\DenormalizerInterface */
215
216
private $ normalizers ;
216
217
217
218
/**
218
- * @param $normalizers
219
+ * @param DenormalizerInterface[] $normalizers
219
220
*/
220
221
public function __construct ($ normalizers )
221
222
{
@@ -233,7 +234,7 @@ public function deserialize($data, $type, $format, array $context = array())
233
234
public function denormalize ($ data , $ type , $ format = null , array $ context = array ())
234
235
{
235
236
foreach ($ this ->normalizers as $ normalizer ) {
236
- if ($ normalizer instanceof \ Symfony \ Component \ Serializer \ Normalizer \ DenormalizerInterface && $ normalizer ->supportsDenormalization ($ data , $ type , $ format , $ context )) {
237
+ if ($ normalizer instanceof DenormalizerInterface && $ normalizer ->supportsDenormalization ($ data , $ type , $ format , $ context )) {
237
238
return $ normalizer ->denormalize ($ data , $ type , $ format , $ context );
238
239
}
239
240
}
@@ -245,7 +246,7 @@ public function supportsDenormalization($data, $type, $format = null)
245
246
}
246
247
}
247
248
248
- class AbstractObjectNormalizerCollectionDummy extends \ Symfony \ Component \ Serializer \ Normalizer \ AbstractObjectNormalizer
249
+ class AbstractObjectNormalizerCollectionDummy extends AbstractObjectNormalizer
249
250
{
250
251
protected function extractAttributes ($ object , $ format = null , array $ context = array ())
251
252
{
@@ -265,7 +266,7 @@ protected function isAllowedAttribute($classOrObject, $attribute, $format = null
265
266
return true ;
266
267
}
267
268
268
- public function instantiateObject (array &$ data , $ class , array &$ context , \ReflectionClass $ reflectionClass , $ allowedAttributes , $ format = null )
269
+ public function instantiateObject (array &$ data , $ class , array &$ context , \ReflectionClass $ reflectionClass , $ allowedAttributes , string $ format = null )
269
270
{
270
271
return parent ::instantiateObject ($ data , $ class , $ context , $ reflectionClass , $ allowedAttributes , $ format );
271
272
}
0 commit comments