Skip to content

Commit 3bdb51d

Browse files
committed
removed prefix I from IStorage, IJournal, IBulkReader
1 parent c89bf0e commit 3bdb51d

File tree

13 files changed

+68
-20
lines changed

13 files changed

+68
-20
lines changed

src/Bridges/CacheDI/CacheExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ public function loadConfiguration()
3939

4040
if (extension_loaded('pdo_sqlite')) {
4141
$builder->addDefinition($this->prefix('journal'))
42-
->setType(Nette\Caching\Storages\IJournal::class)
42+
->setType(Nette\Caching\Storages\Journal::class)
4343
->setFactory(Nette\Caching\Storages\SQLiteJournal::class, [$dir . '/journal.s3db']);
4444
}
4545

4646
$builder->addDefinition($this->prefix('storage'))
47-
->setType(Nette\Caching\IStorage::class)
47+
->setType(Nette\Caching\Storage::class)
4848
->setFactory(Nette\Caching\Storages\FileStorage::class, [$dir]);
4949

5050
if ($this->name === 'cache') {

src/Bridges/CacheLatte/CacheMacro.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public static function initRuntime(Latte\Runtime\Template $template): void
9595
* @return Nette\Caching\OutputHelper|\stdClass
9696
*/
9797
public static function createCache(
98-
Nette\Caching\IStorage $cacheStorage,
98+
Nette\Caching\Storage $cacheStorage,
9999
string $key,
100100
?array &$parents,
101101
array $args = null

src/Caching/IBulkReader.php renamed to src/Caching/BulkReader.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,14 @@
1313
/**
1414
* Cache storage with a bulk read support.
1515
*/
16-
interface IBulkReader
16+
interface BulkReader
1717
{
1818
/**
1919
* Reads from cache in bulk.
2020
* @return array key => value pairs, missing items are omitted
2121
*/
2222
function bulkRead(array $keys): array;
2323
}
24+
25+
26+
class_exists(IBulkReader::class);

src/Caching/Cache.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ class Cache
3636
/** @internal */
3737
public const NAMESPACE_SEPARATOR = "\x00";
3838

39-
/** @var IStorage */
39+
/** @var Storage */
4040
private $storage;
4141

4242
/** @var string */
4343
private $namespace;
4444

4545

46-
public function __construct(IStorage $storage, string $namespace = null)
46+
public function __construct(Storage $storage, string $namespace = null)
4747
{
4848
$this->storage = $storage;
4949
$this->namespace = $namespace . self::NAMESPACE_SEPARATOR;
@@ -53,7 +53,7 @@ public function __construct(IStorage $storage, string $namespace = null)
5353
/**
5454
* Returns cache storage.
5555
*/
56-
final public function getStorage(): IStorage
56+
final public function getStorage(): Storage
5757
{
5858
return $this->storage;
5959
}
@@ -109,7 +109,7 @@ public function bulkLoad(array $keys, callable $fallback = null): array
109109
}
110110
}
111111
$storageKeys = array_map([$this, 'generateKey'], $keys);
112-
if (!$this->storage instanceof IBulkReader) {
112+
if (!$this->storage instanceof BulkReader) {
113113
$result = array_combine($keys, array_map([$this->storage, 'read'], $storageKeys));
114114
if ($fallback !== null) {
115115
foreach ($result as $key => $value) {

src/Caching/IStorage.php renamed to src/Caching/Storage.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
/**
1414
* Cache storage.
1515
*/
16-
interface IStorage
16+
interface Storage
1717
{
1818
/**
1919
* Read from cache.
@@ -41,3 +41,6 @@ function remove(string $key): void;
4141
*/
4242
function clean(array $conditions): void;
4343
}
44+
45+
46+
class_exists(IStorage::class);

src/Caching/Storages/DevNullStorage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
/**
1616
* Cache dummy storage.
1717
*/
18-
class DevNullStorage implements Nette\Caching\IStorage
18+
class DevNullStorage implements Nette\Caching\Storage
1919
{
2020
use Nette\SmartObject;
2121

src/Caching/Storages/FileStorage.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/**
1717
* Cache file storage.
1818
*/
19-
class FileStorage implements Nette\Caching\IStorage
19+
class FileStorage implements Nette\Caching\Storage
2020
{
2121
use Nette\SmartObject;
2222

@@ -56,14 +56,14 @@ class FileStorage implements Nette\Caching\IStorage
5656
/** @var string */
5757
private $dir;
5858

59-
/** @var IJournal */
59+
/** @var Journal */
6060
private $journal;
6161

6262
/** @var array */
6363
private $locks;
6464

6565

66-
public function __construct(string $dir, IJournal $journal = null)
66+
public function __construct(string $dir, Journal $journal = null)
6767
{
6868
if (!is_dir($dir)) {
6969
throw new Nette\DirectoryNotFoundException("Directory '$dir' not found.");

src/Caching/Storages/IJournal.php renamed to src/Caching/Storages/Journal.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
/**
1414
* Cache journal provider.
1515
*/
16-
interface IJournal
16+
interface Journal
1717
{
1818
/**
1919
* Writes entry information into the journal.
@@ -26,3 +26,6 @@ function write(string $key, array $dependencies): void;
2626
*/
2727
function clean(array $conditions): ?array;
2828
}
29+
30+
31+
class_exists(IJournal::class);

src/Caching/Storages/MemcachedStorage.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/**
1717
* Memcached storage using memcached extension.
1818
*/
19-
class MemcachedStorage implements Nette\Caching\IStorage, Nette\Caching\IBulkReader
19+
class MemcachedStorage implements Nette\Caching\Storage, Nette\Caching\BulkReader
2020
{
2121
use Nette\SmartObject;
2222

@@ -32,7 +32,7 @@ class MemcachedStorage implements Nette\Caching\IStorage, Nette\Caching\IBulkRea
3232
/** @var string */
3333
private $prefix;
3434

35-
/** @var IJournal */
35+
/** @var Journal */
3636
private $journal;
3737

3838

@@ -49,7 +49,7 @@ public function __construct(
4949
string $host = 'localhost',
5050
int $port = 11211,
5151
string $prefix = '',
52-
IJournal $journal = null
52+
Journal $journal = null
5353
) {
5454
if (!static::isAvailable()) {
5555
throw new Nette\NotSupportedException("PHP extension 'memcached' is not loaded.");

src/Caching/Storages/MemoryStorage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
/**
1616
* Memory cache storage.
1717
*/
18-
class MemoryStorage implements Nette\Caching\IStorage
18+
class MemoryStorage implements Nette\Caching\Storage
1919
{
2020
use Nette\SmartObject;
2121

src/Caching/Storages/SQLiteJournal.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/**
1717
* SQLite based journal.
1818
*/
19-
class SQLiteJournal implements IJournal
19+
class SQLiteJournal implements Journal
2020
{
2121
use Nette\SmartObject;
2222

src/Caching/Storages/SQLiteStorage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/**
1717
* SQLite storage.
1818
*/
19-
class SQLiteStorage implements Nette\Caching\IStorage, Nette\Caching\IBulkReader
19+
class SQLiteStorage implements Nette\Caching\Storage, Nette\Caching\BulkReader
2020
{
2121
use Nette\SmartObject;
2222

src/compatibility.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
/**
4+
* This file is part of the Nette Framework (https://nette.org)
5+
* Copyright (c) 2004 David Grudl (https://davidgrudl.com)
6+
*/
7+
8+
declare(strict_types=1);
9+
10+
namespace Nette\Caching;
11+
12+
if (false) {
13+
/** @deprecated use Nette\Caching\BulkReader */
14+
interface IBulkReader extends BulkReader
15+
{
16+
}
17+
} elseif (!interface_exists(IBulkReader::class)) {
18+
class_alias(BulkReader::class, IBulkReader::class);
19+
}
20+
21+
if (false) {
22+
/** @deprecated use Nette\Caching\Storage */
23+
interface IStorage extends Storage
24+
{
25+
}
26+
} elseif (!interface_exists(IStorage::class)) {
27+
class_alias(Storage::class, IStorage::class);
28+
}
29+
30+
namespace Nette\Caching\Storages;
31+
32+
if (false) {
33+
/** @deprecated use Nette\Caching\Storages\Journal */
34+
interface IJournal extends Journal
35+
{
36+
}
37+
} elseif (!interface_exists(IJournal::class)) {
38+
class_alias(Journal::class, IJournal::class);
39+
}

0 commit comments

Comments
 (0)