1313
1414use Doctrine \Common \Annotations \AnnotationReader ;
1515use PHPUnit \Framework \TestCase ;
16+ use Symfony \Component \PropertyInfo \Extractor \PhpDocExtractor ;
17+ use Symfony \Component \PropertyInfo \Type ;
1618use Symfony \Component \Serializer \Exception \NotNormalizableValueException ;
1719use Symfony \Component \Serializer \Mapping \Factory \ClassMetadataFactory ;
1820use Symfony \Component \Serializer \Mapping \Loader \AnnotationLoader ;
@@ -118,17 +120,17 @@ public function testDenormalizeCollectionDecodedFromXmlWithTwoChildren()
118120
119121 private function getDenormalizerForDummyCollection ()
120122 {
121- $ extractor = $ this ->getMockBuilder (' Symfony\Component\PropertyInfo\Extractor\ PhpDocExtractor' )->getMock ();
123+ $ extractor = $ this ->getMockBuilder (PhpDocExtractor::class )->getMock ();
122124 $ extractor ->method ('getTypes ' )
123125 ->will ($ this ->onConsecutiveCalls (
124126 array (
125- new \ Symfony \ Component \ PropertyInfo \ Type (
127+ new Type (
126128 'array ' ,
127129 false ,
128130 null ,
129131 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)
132134 ),
133135 ),
134136 null
@@ -209,13 +211,12 @@ class DummyChild
209211 public $ bar ;
210212}
211213
212- class SerializerCollectionDummy implements \ Symfony \ Component \ Serializer \ SerializerInterface, \ Symfony \ Component \ Serializer \ Normalizer \ DenormalizerInterface
214+ class SerializerCollectionDummy implements SerializerInterface, DenormalizerInterface
213215{
214- /** @var \Symfony\Component\Serializer\Normalizer\DenormalizerInterface */
215216 private $ normalizers ;
216217
217218 /**
218- * @param $normalizers
219+ * @param DenormalizerInterface[] $normalizers
219220 */
220221 public function __construct ($ normalizers )
221222 {
@@ -233,7 +234,7 @@ public function deserialize($data, $type, $format, array $context = array())
233234 public function denormalize ($ data , $ type , $ format = null , array $ context = array ())
234235 {
235236 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 )) {
237238 return $ normalizer ->denormalize ($ data , $ type , $ format , $ context );
238239 }
239240 }
@@ -245,7 +246,7 @@ public function supportsDenormalization($data, $type, $format = null)
245246 }
246247}
247248
248- class AbstractObjectNormalizerCollectionDummy extends \ Symfony \ Component \ Serializer \ Normalizer \ AbstractObjectNormalizer
249+ class AbstractObjectNormalizerCollectionDummy extends AbstractObjectNormalizer
249250{
250251 protected function extractAttributes ($ object , $ format = null , array $ context = array ())
251252 {
@@ -265,7 +266,7 @@ protected function isAllowedAttribute($classOrObject, $attribute, $format = null
265266 return true ;
266267 }
267268
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 )
269270 {
270271 return parent ::instantiateObject ($ data , $ class , $ context , $ reflectionClass , $ allowedAttributes , $ format );
271272 }
0 commit comments