Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c1ba38e

Browse files
Merge branch '4.0' into 4.1
* 4.0: [Serializer] fix CS [Cache] Fix expiry comparisons in array-based pools
2 parents 6660161 + b7d04a8 commit c1ba38e

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

src/Symfony/Component/Cache/Tests/Fixtures/ArrayCache.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ protected function doContains($id)
2121

2222
$expiry = $this->data[$id][1];
2323

24-
return !$expiry || time() <= $expiry || !$this->doDelete($id);
24+
return !$expiry || time() < $expiry || !$this->doDelete($id);
2525
}
2626

2727
protected function doSave($id, $data, $lifeTime = 0)

src/Symfony/Component/Cache/Traits/ArrayTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function hasItem($key)
4444
{
4545
CacheItem::validateKey($key);
4646

47-
return isset($this->expiries[$key]) && ($this->expiries[$key] >= time() || !$this->deleteItem($key));
47+
return isset($this->expiries[$key]) && ($this->expiries[$key] > time() || !$this->deleteItem($key));
4848
}
4949

5050
/**
@@ -81,7 +81,7 @@ private function generateItems(array $keys, $now, $f)
8181
{
8282
foreach ($keys as $i => $key) {
8383
try {
84-
if (!$isHit = isset($this->expiries[$key]) && ($this->expiries[$key] >= $now || !$this->deleteItem($key))) {
84+
if (!$isHit = isset($this->expiries[$key]) && ($this->expiries[$key] > $now || !$this->deleteItem($key))) {
8585
$this->values[$key] = $value = null;
8686
} elseif (!$this->storeSerialized) {
8787
$value = $this->values[$key];

src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
use Doctrine\Common\Annotations\AnnotationReader;
1515
use PHPUnit\Framework\TestCase;
16+
use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor;
17+
use Symfony\Component\PropertyInfo\Type;
1618
use Symfony\Component\Serializer\Exception\NotNormalizableValueException;
1719
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;
1820
use 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

Comments
 (0)