*/
public function createDistributed(string $type = null): ICanCache
{
- if ($type === Type\APCuCache::$NAME) {
+ if ($type === Type\APCuCache::NAME) {
throw new InvalidCacheDriverException('apcu doesn\'t support distributed caching.');
}
*/
class APCuCache extends AbstractCache implements ICanCacheInMemory
{
- public static $NAME = 'apcu';
+ const NAME = 'apcu';
use CompareSetTrait;
use CompareDeleteTrait;
*/
abstract class AbstractCache implements ICanCache
{
- public static $NAME = '';
+ const NAME = '';
/**
* @var string The hostname
/** {@inheritDoc} */
public function getName(): string
{
- return static::$NAME;
+ return static::NAME;
}
}
*/
class ArrayCache extends AbstractCache implements ICanCacheInMemory
{
- public static $NAME = 'array';
+ const NAME = 'array';
use CompareDeleteTrait;
*/
class DatabaseCache extends AbstractCache implements ICanCache
{
- public static $NAME = 'database';
+ const NAME = 'database';
/**
* @var Database
*/
class MemcacheCache extends AbstractCache implements ICanCacheInMemory
{
- static $NAME = 'memcached';
+ const NAME = 'memcached';
use CompareSetTrait;
use CompareDeleteTrait;
*/
class MemcachedCache extends AbstractCache implements ICanCacheInMemory
{
- static $NAME = 'memcached';
+ const NAME = 'memcached';
use CompareSetTrait;
use CompareDeleteTrait;
*/
class RedisCache extends AbstractCache implements ICanCacheInMemory
{
- public static $NAME = 'redis';
+ const NAME = 'redis';
/**
* @var Redis
public function testGetName()
{
- if (property_exists($this->instance, '$NAME')) {
- self::assertEquals($this->instance::$NAME, $this->instance->getName());
+ if (defined(get_class($this->instance) . '::NAME')) {
+ self::assertEquals($this->instance::NAME, $this->instance->getName());
} else {
self::expectNotToPerformAssertions();
}