Skip to content

Commit

Permalink
Add missing PHPDoc annotation for Doctrine Cache implementations
Browse files Browse the repository at this point in the history
This fixes the following deprecations produced by Symfony:
* User Deprecated: Method "Doctrine\Common\Cache\Cache::fetch()" might add "mixed" as a native return type declaration in the future. Do the same in implementation "Aws\DoctrineCacheAdapter" now to avoid errors or add an explicit @return annotation to suppress this message.
* User Deprecated: Method "Doctrine\Common\Cache\Cache::save()" might add "bool" as a native return type declaration in the future. Do the same in implementation "Aws\DoctrineCacheAdapter" now to avoid errors or add an explicit @return annotation to suppress this message.
* User Deprecated: Method "Doctrine\Common\Cache\Cache::delete()" might add "bool" as a native return type declaration in the future. Do the same in implementation "Aws\DoctrineCacheAdapter" now to avoid errors or add an explicit @return annotation to suppress this message.
* User Deprecated: Method "Doctrine\Common\Cache\Cache::contains()" might add "bool" as a native return type declaration in the future. Do the same in implementation "Aws\DoctrineCacheAdapter" now to avoid errors or add an explicit @return annotation to suppress this message.
* User Deprecated: Method "Doctrine\Common\Cache\Cache::getStats()" might add "?array" as a native return type declaration in the future. Do the same in implementation "Aws\DoctrineCacheAdapter" now to avoid errors or add an explicit @return annotation to suppress this message.
  • Loading branch information
samuel-nogueira-kununu committed Nov 2, 2023
1 parent b1a52f8 commit f34f034
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .changes/nextrelease/enhancement-add-phpdoc-doctrine-cache
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
{
"type": "enhancement",
"category": "",
"description": "Add missing PHPDoc annotation for Doctrine Cache implementations."
}
]
15 changes: 15 additions & 0 deletions src/DoctrineCacheAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ public function get($key)
return $this->cache->fetch($key);
}

/**
* @return mixed
*/
public function fetch($key)
{
return $this->get($key);
Expand All @@ -28,6 +31,9 @@ public function set($key, $value, $ttl = 0)
return $this->cache->save($key, $value, $ttl);
}

/**
* @return bool
*/
public function save($key, $value, $ttl = 0)
{
return $this->set($key, $value, $ttl);
Expand All @@ -38,16 +44,25 @@ public function remove($key)
return $this->cache->delete($key);
}

/**
* @return bool
*/
public function delete($key)
{
return $this->remove($key);
}

/**
* @return bool
*/
public function contains($key)
{
return $this->cache->contains($key);
}

/**
* @return mixed[]|null
*/
public function getStats()
{
return $this->cache->getStats();
Expand Down

0 comments on commit f34f034

Please sign in to comment.