Merge branch '4.1'

* 4.1:
  [Serializer] fix CS
  [Cache] Fix expiry comparisons in array-based pools
This commit is contained in:
Nicolas Grekas 2018-06-11 16:10:14 +02:00
commit dca80ff177

View File

@ -13,6 +13,8 @@ namespace Symfony\Component\Serializer\Tests\Normalizer;
use Doctrine\Common\Annotations\AnnotationReader; use Doctrine\Common\Annotations\AnnotationReader;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor;
use Symfony\Component\PropertyInfo\Type;
use Symfony\Component\Serializer\Exception\NotNormalizableValueException; use Symfony\Component\Serializer\Exception\NotNormalizableValueException;
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory; use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;
use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader; use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
@ -118,17 +120,17 @@ class AbstractObjectNormalizerTest extends TestCase
private function getDenormalizerForDummyCollection() private function getDenormalizerForDummyCollection()
{ {
$extractor = $this->getMockBuilder('Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor')->getMock(); $extractor = $this->getMockBuilder(PhpDocExtractor::class)->getMock();
$extractor->method('getTypes') $extractor->method('getTypes')
->will($this->onConsecutiveCalls( ->will($this->onConsecutiveCalls(
array( array(
new \Symfony\Component\PropertyInfo\Type( new Type(
'array', 'array',
false, false,
null, null,
true, true,
new \Symfony\Component\PropertyInfo\Type('int'), new Type('int'),
new \Symfony\Component\PropertyInfo\Type('object', false, DummyChild::class) new Type('object', false, DummyChild::class)
), ),
), ),
null null
@ -209,13 +211,12 @@ class DummyChild
public $bar; public $bar;
} }
class SerializerCollectionDummy implements \Symfony\Component\Serializer\SerializerInterface, \Symfony\Component\Serializer\Normalizer\DenormalizerInterface class SerializerCollectionDummy implements SerializerInterface, DenormalizerInterface
{ {
/** @var \Symfony\Component\Serializer\Normalizer\DenormalizerInterface */
private $normalizers; private $normalizers;
/** /**
* @param $normalizers * @param DenormalizerInterface[] $normalizers
*/ */
public function __construct($normalizers) public function __construct($normalizers)
{ {
@ -233,7 +234,7 @@ class SerializerCollectionDummy implements \Symfony\Component\Serializer\Seriali
public function denormalize($data, $type, $format = null, array $context = array()) public function denormalize($data, $type, $format = null, array $context = array())
{ {
foreach ($this->normalizers as $normalizer) { foreach ($this->normalizers as $normalizer) {
if ($normalizer instanceof \Symfony\Component\Serializer\Normalizer\DenormalizerInterface && $normalizer->supportsDenormalization($data, $type, $format, $context)) { if ($normalizer instanceof DenormalizerInterface && $normalizer->supportsDenormalization($data, $type, $format, $context)) {
return $normalizer->denormalize($data, $type, $format, $context); return $normalizer->denormalize($data, $type, $format, $context);
} }
} }
@ -245,7 +246,7 @@ class SerializerCollectionDummy implements \Symfony\Component\Serializer\Seriali
} }
} }
class AbstractObjectNormalizerCollectionDummy extends \Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer class AbstractObjectNormalizerCollectionDummy extends AbstractObjectNormalizer
{ {
protected function extractAttributes($object, $format = null, array $context = array()) protected function extractAttributes($object, $format = null, array $context = array())
{ {
@ -265,7 +266,7 @@ class AbstractObjectNormalizerCollectionDummy extends \Symfony\Component\Seriali
return true; return true;
} }
public function instantiateObject(array &$data, $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes, $format = null) public function instantiateObject(array &$data, $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes, string $format = null)
{ {
return parent::instantiateObject($data, $class, $context, $reflectionClass, $allowedAttributes, $format); return parent::instantiateObject($data, $class, $context, $reflectionClass, $allowedAttributes, $format);
} }