Skip to content

Commit

Permalink
coding style: fixes in code
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Jul 11, 2017
1 parent 562d411 commit 6a15f06
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions src/Caching/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@ public function save($key, $data, array $dependencies = null)
$this->storage->lock($key);
try {
$data = call_user_func_array($data, [&$dependencies]);
} catch (\Throwable $e) {
} catch (\Exception $e) {
$this->storage->remove($key);
throw $e;
} catch (\Exception $e) {
} catch (\Throwable $e) {
$this->storage->remove($key);
throw $e;
}
Expand All @@ -186,7 +186,7 @@ public function save($key, $data, array $dependencies = null)
$this->storage->remove($key);
} else {
$dependencies = $this->completeDependencies($dependencies);
if (isset($dependencies[Cache::EXPIRATION]) && $dependencies[Cache::EXPIRATION] <= 0) {
if (isset($dependencies[self::EXPIRATION]) && $dependencies[self::EXPIRATION] <= 0) {
$this->storage->remove($key);
} else {
$this->storage->write($key, $data, $dependencies);
Expand Down
2 changes: 1 addition & 1 deletion tests/Caching/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function clean(array $conditions)

class BulkReadTestStorage extends TestStorage implements IBulkReader
{
function bulkRead(array $keys)
public function bulkRead(array $keys)
{
$result = [];
foreach ($keys as $key) {
Expand Down
4 changes: 2 additions & 2 deletions tests/Storages/FileStorage.call.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ require __DIR__ . '/../bootstrap.php';

class Mock
{
function mockFunction($x, $y)
public function mockFunction($x, $y)
{
$GLOBALS['called'] = true;
return $x + $y;
}


function __sleep()
public function __sleep()
{
throw new Exception;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Storages/FileStorage.tags.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ $cache->clean([
0 => 'non-existent1',
1 => 'non-existent2',
3 => 'one',
5 => 'non-existent3'
]
5 => 'non-existent3',
],
]);

Assert::null($cache->load('key1'));
Expand Down
2 changes: 1 addition & 1 deletion tests/Storages/FileStorage.wrap.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function mockFunction($x, $y)

class Test
{
function mockMethod($x, $y)
public function mockMethod($x, $y)
{
$GLOBALS['called'] = true;
return $x + $y;
Expand Down
24 changes: 12 additions & 12 deletions tests/Storages/IJournalTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ final public function testDifferentCleaning()
final public function testSpecialChars()
{
$this->journal->write('ok_test7ščřžýáíé', [
Cache::TAGS => ['čšřýýá', 'ýřžčýž']
Cache::TAGS => ['čšřýýá', 'ýřžčýž'],
]);

Assert::same([
Expand All @@ -174,10 +174,10 @@ final public function testSpecialChars()
final public function testDuplicatedSameTags()
{
$this->journal->write('ok_test_a', [
Cache::TAGS => ['homepage']
Cache::TAGS => ['homepage'],
]);
$this->journal->write('ok_test_a', [
Cache::TAGS => ['homepage']
Cache::TAGS => ['homepage'],
]);
Assert::same([
'ok_test_a',
Expand All @@ -188,11 +188,11 @@ final public function testDuplicatedSameTags()
final public function testDuplicatedSamePriority()
{
$this->journal->write('ok_test_b', [
Cache::PRIORITY => 12
Cache::PRIORITY => 12,
]);

$this->journal->write('ok_test_b', [
Cache::PRIORITY => 12
Cache::PRIORITY => 12,
]);

Assert::same([
Expand All @@ -204,11 +204,11 @@ final public function testDuplicatedSamePriority()
final public function testDuplicatedDifferentTags()
{
$this->journal->write('ok_test_ba', [
Cache::TAGS => ['homepage']
Cache::TAGS => ['homepage'],
]);

$this->journal->write('ok_test_ba', [
Cache::TAGS => ['homepage2']
Cache::TAGS => ['homepage2'],
]);

Assert::same([
Expand All @@ -223,11 +223,11 @@ final public function testDuplicatedDifferentTags()
final public function testDuplicatedTwoDifferentTags()
{
$this->journal->write('ok_test_baa', [
Cache::TAGS => ['homepage', 'aąa']
Cache::TAGS => ['homepage', 'aąa'],
]);

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

Assert::same([
Expand All @@ -242,11 +242,11 @@ final public function testDuplicatedTwoDifferentTags()
final public function testDuplicatedDifferentPriorities()
{
$this->journal->write('ok_test_bb', [
Cache::PRIORITY => 10
Cache::PRIORITY => 10,
]);

$this->journal->write('ok_test_bb', [
Cache::PRIORITY => 20
Cache::PRIORITY => 20,
]);

Assert::same([
Expand All @@ -261,7 +261,7 @@ final public function testDuplicatedDifferentPriorities()
final public function testCleanAll()
{
$this->journal->write('ok_test_all_tags', [
Cache::TAGS => ['test:all', 'test:all']
Cache::TAGS => ['test:all', 'test:all'],
]);

$this->journal->write('ok_test_all_priority', [
Expand Down

0 comments on commit 6a15f06

Please sign in to comment.