minor #23505 [Cache] add constructor docblocks for clarity (xabbuh)

This PR was merged into the 3.3 branch.

Discussion
----------

[Cache] add constructor docblocks for clarity

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

Commits
-------

d1ce5322a6 [Cache] add constructor docblocks for clarity
This commit is contained in:
Fabien Potencier 2017-07-17 14:07:22 +02:00
commit 80efd8f950
7 changed files with 33 additions and 0 deletions

View File

@ -30,6 +30,10 @@ abstract class AbstractCache implements CacheInterface, LoggerAwareInterface
private $defaultLifetime;
/**
* @param string $namespace
* @param int $defaultLifetime
*/
protected function __construct($namespace = '', $defaultLifetime = 0)
{
$this->defaultLifetime = max(0, (int) $defaultLifetime);

View File

@ -17,6 +17,11 @@ class ApcuCache extends AbstractCache
{
use ApcuTrait;
/**
* @param string $namespace
* @param int $defaultLifetime
* @param string|null $version
*/
public function __construct($namespace = '', $defaultLifetime = 0, $version = null)
{
$this->init($namespace, $defaultLifetime, $version);

View File

@ -18,6 +18,11 @@ class DoctrineCache extends AbstractCache
{
use DoctrineTrait;
/**
* @param CacheProvider $provider
* @param string $namespace
* @param int $defaultLifetime
*/
public function __construct(CacheProvider $provider, $namespace = '', $defaultLifetime = 0)
{
parent::__construct('', $defaultLifetime);

View File

@ -17,6 +17,11 @@ class FilesystemCache extends AbstractCache
{
use FilesystemTrait;
/**
* @param string $namespace
* @param int $defaultLifetime
* @param string|null $directory
*/
public function __construct($namespace = '', $defaultLifetime = 0, $directory = null)
{
parent::__construct('', $defaultLifetime);

View File

@ -19,6 +19,11 @@ class MemcachedCache extends AbstractCache
protected $maxIdLength = 250;
/**
* @param \Memcached $client
* @param string $namespace
* @param int $defaultLifetime
*/
public function __construct(\Memcached $client, $namespace = '', $defaultLifetime = 0)
{
$this->init($client, $namespace, $defaultLifetime);

View File

@ -18,6 +18,13 @@ class PhpFilesCache extends AbstractCache
{
use PhpFilesTrait;
/**
* @param string $namespace
* @param int $defaultLifetime
* @param string|null $directory
*
* @throws CacheException if OPcache is not enabled
*/
public function __construct($namespace = '', $defaultLifetime = 0, $directory = null)
{
if (!static::isSupported()) {

View File

@ -19,6 +19,8 @@ class RedisCache extends AbstractCache
/**
* @param \Redis|\RedisArray|\RedisCluster|\Predis\Client $redisClient
* @param string $namespace
* @param int $defaultLifetime
*/
public function __construct($redisClient, $namespace = '', $defaultLifetime = 0)
{