Skip to content

Commit

Permalink
minor #28280 [Cache] minor code update to leverage PHP 7.1 (nicolas-g…
Browse files Browse the repository at this point in the history
…rekas)

This PR was merged into the 4.1 branch.

Discussion
----------

[Cache] minor code update to leverage PHP 7.1

| Q             | A
| ------------- | ---
| Branch?       | 4.1
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

c1bf191 [Cache] minor code update to leverage PHP 7.1
  • Loading branch information
fabpot committed Aug 27, 2018
2 parents 620dfde + c1bf191 commit 8e984f8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Symfony/Component/Cache/Adapter/AbstractAdapter.php
Expand Up @@ -52,14 +52,15 @@ function ($key, $value, $isHit) use ($defaultLifetime) {
null,
CacheItem::class
);
$getId = function ($key) { return $this->getId((string) $key); };
$getId = \Closure::fromCallable(array($this, 'getId'));
$this->mergeByLifetime = \Closure::bind(
function ($deferred, $namespace, &$expiredIds) use ($getId) {
$byLifetime = array();
$now = time();
$expiredIds = array();

foreach ($deferred as $key => $item) {
$key = (string) $key;
if (null === $item->expiry) {
$byLifetime[0 < $item->defaultLifetime ? $item->defaultLifetime : 0][$getId($key)] = $item->value;
} elseif ($item->expiry > $now) {
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php
Expand Up @@ -36,7 +36,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, PruneableInterface, R
private $knownTagVersions = array();
private $knownTagVersionsTtl;

public function __construct(AdapterInterface $itemsPool, AdapterInterface $tagsPool = null, $knownTagVersionsTtl = 0.15)
public function __construct(AdapterInterface $itemsPool, AdapterInterface $tagsPool = null, float $knownTagVersionsTtl = 0.15)
{
$this->pool = $itemsPool;
$this->tags = $tagsPool ?: $itemsPool;
Expand Down

0 comments on commit 8e984f8

Please sign in to comment.