Skip to content

Commit 6a15f06

Browse files
committed
coding style: fixes in code
1 parent 562d411 commit 6a15f06

File tree

6 files changed

+21
-21
lines changed

6 files changed

+21
-21
lines changed

src/Caching/Cache.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,10 @@ public function save($key, $data, array $dependencies = null)
173173
$this->storage->lock($key);
174174
try {
175175
$data = call_user_func_array($data, [&$dependencies]);
176-
} catch (\Throwable $e) {
176+
} catch (\Exception $e) {
177177
$this->storage->remove($key);
178178
throw $e;
179-
} catch (\Exception $e) {
179+
} catch (\Throwable $e) {
180180
$this->storage->remove($key);
181181
throw $e;
182182
}
@@ -186,7 +186,7 @@ public function save($key, $data, array $dependencies = null)
186186
$this->storage->remove($key);
187187
} else {
188188
$dependencies = $this->completeDependencies($dependencies);
189-
if (isset($dependencies[Cache::EXPIRATION]) && $dependencies[Cache::EXPIRATION] <= 0) {
189+
if (isset($dependencies[self::EXPIRATION]) && $dependencies[self::EXPIRATION] <= 0) {
190190
$this->storage->remove($key);
191191
} else {
192192
$this->storage->write($key, $data, $dependencies);

tests/Caching/Cache.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function clean(array $conditions)
4040

4141
class BulkReadTestStorage extends TestStorage implements IBulkReader
4242
{
43-
function bulkRead(array $keys)
43+
public function bulkRead(array $keys)
4444
{
4545
$result = [];
4646
foreach ($keys as $key) {

tests/Storages/FileStorage.call.phpt

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ require __DIR__ . '/../bootstrap.php';
1414

1515
class Mock
1616
{
17-
function mockFunction($x, $y)
17+
public function mockFunction($x, $y)
1818
{
1919
$GLOBALS['called'] = true;
2020
return $x + $y;
2121
}
2222

2323

24-
function __sleep()
24+
public function __sleep()
2525
{
2626
throw new Exception;
2727
}

tests/Storages/FileStorage.tags.phpt

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ $cache->clean([
5555
0 => 'non-existent1',
5656
1 => 'non-existent2',
5757
3 => 'one',
58-
5 => 'non-existent3'
59-
]
58+
5 => 'non-existent3',
59+
],
6060
]);
6161

6262
Assert::null($cache->load('key1'));

tests/Storages/FileStorage.wrap.phpt

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function mockFunction($x, $y)
2121

2222
class Test
2323
{
24-
function mockMethod($x, $y)
24+
public function mockMethod($x, $y)
2525
{
2626
$GLOBALS['called'] = true;
2727
return $x + $y;

tests/Storages/IJournalTestCase.php

+12-12
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ final public function testDifferentCleaning()
162162
final public function testSpecialChars()
163163
{
164164
$this->journal->write('ok_test7ščřžýáíé', [
165-
Cache::TAGS => ['čšřýýá', 'ýřžčýž']
165+
Cache::TAGS => ['čšřýýá', 'ýřžčýž'],
166166
]);
167167

168168
Assert::same([
@@ -174,10 +174,10 @@ final public function testSpecialChars()
174174
final public function testDuplicatedSameTags()
175175
{
176176
$this->journal->write('ok_test_a', [
177-
Cache::TAGS => ['homepage']
177+
Cache::TAGS => ['homepage'],
178178
]);
179179
$this->journal->write('ok_test_a', [
180-
Cache::TAGS => ['homepage']
180+
Cache::TAGS => ['homepage'],
181181
]);
182182
Assert::same([
183183
'ok_test_a',
@@ -188,11 +188,11 @@ final public function testDuplicatedSameTags()
188188
final public function testDuplicatedSamePriority()
189189
{
190190
$this->journal->write('ok_test_b', [
191-
Cache::PRIORITY => 12
191+
Cache::PRIORITY => 12,
192192
]);
193193

194194
$this->journal->write('ok_test_b', [
195-
Cache::PRIORITY => 12
195+
Cache::PRIORITY => 12,
196196
]);
197197

198198
Assert::same([
@@ -204,11 +204,11 @@ final public function testDuplicatedSamePriority()
204204
final public function testDuplicatedDifferentTags()
205205
{
206206
$this->journal->write('ok_test_ba', [
207-
Cache::TAGS => ['homepage']
207+
Cache::TAGS => ['homepage'],
208208
]);
209209

210210
$this->journal->write('ok_test_ba', [
211-
Cache::TAGS => ['homepage2']
211+
Cache::TAGS => ['homepage2'],
212212
]);
213213

214214
Assert::same([
@@ -223,11 +223,11 @@ final public function testDuplicatedDifferentTags()
223223
final public function testDuplicatedTwoDifferentTags()
224224
{
225225
$this->journal->write('ok_test_baa', [
226-
Cache::TAGS => ['homepage', 'aąa']
226+
Cache::TAGS => ['homepage', 'aąa'],
227227
]);
228228

229229
$this->journal->write('ok_test_baa', [
230-
Cache::TAGS => ['homepage2', 'aaa']
230+
Cache::TAGS => ['homepage2', 'aaa'],
231231
]);
232232

233233
Assert::same([
@@ -242,11 +242,11 @@ final public function testDuplicatedTwoDifferentTags()
242242
final public function testDuplicatedDifferentPriorities()
243243
{
244244
$this->journal->write('ok_test_bb', [
245-
Cache::PRIORITY => 10
245+
Cache::PRIORITY => 10,
246246
]);
247247

248248
$this->journal->write('ok_test_bb', [
249-
Cache::PRIORITY => 20
249+
Cache::PRIORITY => 20,
250250
]);
251251

252252
Assert::same([
@@ -261,7 +261,7 @@ final public function testDuplicatedDifferentPriorities()
261261
final public function testCleanAll()
262262
{
263263
$this->journal->write('ok_test_all_tags', [
264-
Cache::TAGS => ['test:all', 'test:all']
264+
Cache::TAGS => ['test:all', 'test:all'],
265265
]);
266266

267267
$this->journal->write('ok_test_all_priority', [

0 commit comments

Comments
 (0)