Skip to content

Commit 1694385

Browse files
committed
CS fixes in accordance with PSR2, except when in conflict with the PEAR CS.
1 parent 79b57bb commit 1694385

File tree

10 files changed

+70
-40
lines changed

10 files changed

+70
-40
lines changed

extrasetup.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@
2525
= $phpDir . DIRECTORY_SEPARATOR . $pkg . '.php';
2626
}
2727
}
28-
chdir($oldCwd);
28+
chdir($oldCwd);

packagexmlsetup.php

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,18 @@
4040

4141

4242
$package->files['tests/bootstrap.php'] = array_merge_recursive(
43-
$package->files['tests/bootstrap.php']->getArrayCopy(), $srcDirTask
43+
$package->files['tests/bootstrap.php']->getArrayCopy(),
44+
$srcDirTask
4445
);
4546

4647
$package->files['docs/phpdoc.dist.xml'] = array_merge_recursive(
47-
$package->files['docs/phpdoc.dist.xml']->getArrayCopy(), $srcDirTask
48+
$package->files['docs/phpdoc.dist.xml']->getArrayCopy(),
49+
$srcDirTask
4850
);
4951

5052
$package->files['docs/doxygen.ini'] = array_merge_recursive(
51-
$package->files['docs/doxygen.ini']->getArrayCopy(), $srcDirTask,
53+
$package->files['docs/doxygen.ini']->getArrayCopy(),
54+
$srcDirTask,
5255
array(
5356
'tasks:replace' => array(
5457
array(
@@ -70,22 +73,25 @@
7073
] = array_merge_recursive(
7174
$compatible->files[
7275
"test/{$package->channel}/{$package->name}/bootstrap.php"
73-
]->getArrayCopy(), $srcDirTask
76+
]->getArrayCopy(),
77+
$srcDirTask
7478
);
7579

7680
$compatible->files[
7781
"doc/{$package->channel}/{$package->name}/phpdoc.dist.xml"
7882
] = array_merge_recursive(
7983
$compatible->files[
8084
"doc/{$package->channel}/{$package->name}/phpdoc.dist.xml"
81-
]->getArrayCopy(), $srcDirTask
85+
]->getArrayCopy(),
86+
$srcDirTask
8287
);
8388

8489
$compatible->files["doc/{$package->channel}/{$package->name}/doxygen.ini"]
8590
= array_merge_recursive(
8691
$compatible->files[
8792
"doc/{$package->channel}/{$package->name}/doxygen.ini"
88-
]->getArrayCopy(), $srcDirTask,
93+
]->getArrayCopy(),
94+
$srcDirTask,
8995
array(
9096
'tasks:replace' => array(
9197
array(
@@ -113,7 +119,8 @@
113119
$filename = $path->getPathname();
114120

115121
$package->files[$filename] = array_merge_recursive(
116-
$package->files[$filename]->getArrayCopy(), $srcFileTasks
122+
$package->files[$filename]->getArrayCopy(),
123+
$srcFileTasks
117124
);
118125

119126
if ($hasCompatible) {
@@ -124,4 +131,4 @@
124131
);
125132
}
126133
}
127-
chdir($oldCwd);
134+
chdir($oldCwd);

src/PEAR2/Cache/SHM.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ final public static function factory($persistentId)
5858
}
5959
}
6060
throw new SHM\InvalidArgumentException(
61-
'No appropriate adapter available', 1
61+
'No appropriate adapter available',
62+
1
6263
);
6364
}
6465

@@ -92,7 +93,8 @@ final public static function registerAdapter($adapter, $prepend = false)
9293
) {
9394
if ($prepend) {
9495
self::$_adapters = array_merge(
95-
array($adapter), self::$_adapters
96+
array($adapter),
97+
self::$_adapters
9698
);
9799
} else {
98100
self::$_adapters[] = $adapter;
@@ -331,4 +333,4 @@ abstract public function clear();
331333

332334
SHM::registerAdapter('\\' . __NAMESPACE__ . '\SHM\Adapter\Placebo');
333335
SHM::registerAdapter('\\' . __NAMESPACE__ . '\SHM\Adapter\Wincache');
334-
SHM::registerAdapter('\\' . __NAMESPACE__ . '\SHM\Adapter\APC');
336+
SHM::registerAdapter('\\' . __NAMESPACE__ . '\SHM\Adapter\APC');

src/PEAR2/Cache/SHM/Adapter/APC.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ public function __construct($persistentId)
7777
static::$locksBackup[$this->persistentId] = array();
7878
}
7979
register_shutdown_function(
80-
get_called_class() . '::releaseLocks', $this->persistentId, true
80+
get_called_class() . '::releaseLocks',
81+
$this->persistentId,
82+
true
8183
);
8284
}
8385

@@ -170,7 +172,9 @@ public function unlock($key)
170172
$success = apc_delete($lock);
171173
if ($success) {
172174
unset(static::$locksBackup[$this->persistentId][array_search(
173-
$key, static::$locksBackup[$this->persistentId], true
175+
$key,
176+
static::$locksBackup[$this->persistentId],
177+
true
174178
)]);
175179
return true;
176180
}
@@ -241,7 +245,8 @@ public function get($key)
241245
throw new SHM\InvalidArgumentException(
242246
'Unable to fetch key. ' .
243247
'Key has either just now expired or (if no TTL was set) ' .
244-
'is possibly in a race condition with another request.', 100
248+
'is possibly in a race condition with another request.',
249+
100
245250
);
246251
}
247252
return $value;
@@ -276,7 +281,9 @@ public function delete($key)
276281
public function inc($key, $step = 1)
277282
{
278283
$newValue = apc_inc(
279-
$this->persistentId . 'd ' . $key, (int) $step, $success
284+
$this->persistentId . 'd ' . $key,
285+
(int) $step,
286+
$success
280287
);
281288
if (!$success) {
282289
throw new SHM\InvalidArgumentException(
@@ -302,7 +309,9 @@ public function inc($key, $step = 1)
302309
public function dec($key, $step = 1)
303310
{
304311
$newValue = apc_dec(
305-
$this->persistentId . 'd ' . $key, (int) $step, $success
312+
$this->persistentId . 'd ' . $key,
313+
(int) $step,
314+
$success
306315
);
307316
if (!$success) {
308317
throw new SHM\InvalidArgumentException(
@@ -387,4 +396,4 @@ public function getIterator($filter = null, $keysOnly = false)
387396
}
388397
return $result;
389398
}
390-
}
399+
}

src/PEAR2/Cache/SHM/Adapter/Placebo.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,9 @@ public function unlock($key)
143143
return false;
144144
}
145145
unset(static::$locksBackup[$this->persistentId][array_search(
146-
$key, static::$locksBackup[$this->persistentId], true
146+
$key,
147+
static::$locksBackup[$this->persistentId],
148+
true
147149
)]);
148150
return true;
149151
}
@@ -213,7 +215,8 @@ public function get($key)
213215
return static::$data[$this->persistentId][$key];
214216
}
215217
throw new SHM\InvalidArgumentException(
216-
'Unable to fetch key. No such key.', 200
218+
'Unable to fetch key. No such key.',
219+
200
217220
);
218221
}
219222

@@ -344,4 +347,4 @@ public function getIterator($filter = null, $keysOnly = false)
344347
}
345348
return $keysOnly ? array_keys($result) : $result;
346349
}
347-
}
350+
}

src/PEAR2/Cache/SHM/Adapter/Wincache.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,9 @@ public function unlock($key)
158158
);
159159
if ($result) {
160160
unset(static::$locksBackup[$this->persistentId][array_search(
161-
$key, static::$locksBackup[$this->persistentId], true
161+
$key,
162+
static::$locksBackup[$this->persistentId],
163+
true
162164
)]);
163165
}
164166
return $result;
@@ -224,7 +226,8 @@ public function get($key)
224226
$value = wincache_ucache_get($this->persistentId . $key, $success);
225227
if (!$success) {
226228
throw new SHM\InvalidArgumentException(
227-
'Unable to fetch key. No such key, or key has expired.', 300
229+
'Unable to fetch key. No such key, or key has expired.',
230+
300
228231
);
229232
}
230233
return $value;
@@ -257,7 +260,9 @@ public function delete($key)
257260
public function inc($key, $step = 1)
258261
{
259262
$newValue = wincache_ucache_inc(
260-
$this->persistentId . $key, (int) $step, $success
263+
$this->persistentId . $key,
264+
(int) $step,
265+
$success
261266
);
262267
if (!$success) {
263268
throw new SHM\InvalidArgumentException(
@@ -283,7 +288,9 @@ public function inc($key, $step = 1)
283288
public function dec($key, $step = 1)
284289
{
285290
$newValue = wincache_ucache_dec(
286-
$this->persistentId . $key, (int) $step, $success
291+
$this->persistentId . $key,
292+
(int) $step,
293+
$success
287294
);
288295
if (!$success) {
289296
throw new SHM\InvalidArgumentException(
@@ -366,5 +373,4 @@ public function getIterator($filter = null, $keysOnly = false)
366373
}
367374
return $result;
368375
}
369-
370-
}
376+
}

src/PEAR2/Cache/SHM/Exception.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,4 @@
3131
*/
3232
interface Exception
3333
{
34-
35-
}
34+
}

src/PEAR2/Cache/SHM/InvalidArgumentException.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,4 @@
3232
class InvalidArgumentException extends \InvalidArgumentException
3333
implements Exception
3434
{
35-
36-
}
35+
}

tests/CliCompatibleTest.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ public function testApcConsruction()
1313
$this->assertInstanceOf('\PEAR2\Cache\SHM', $object2);
1414

1515
$this->assertInstanceOf(
16-
'\PEAR2\Cache\SHM\Adapter\APC', $object1->getAdapter()
16+
'\PEAR2\Cache\SHM\Adapter\APC',
17+
$object1->getAdapter()
1718
);
1819
$this->assertInstanceOf(
19-
'\PEAR2\Cache\SHM\Adapter\APC', $object2->getAdapter()
20+
'\PEAR2\Cache\SHM\Adapter\APC',
21+
$object2->getAdapter()
2022
);
2123
}
2224

@@ -29,10 +31,12 @@ public function testWincacheConsruction()
2931
$this->assertInstanceOf('\PEAR2\Cache\SHM', $object2);
3032

3133
$this->assertInstanceOf(
32-
'\PEAR2\Cache\SHM\Adapter\Wincache', $object1->getAdapter()
34+
'\PEAR2\Cache\SHM\Adapter\Wincache',
35+
$object1->getAdapter()
3336
);
3437
$this->assertInstanceOf(
35-
'\PEAR2\Cache\SHM\Adapter\Wincache', $object2->getAdapter()
38+
'\PEAR2\Cache\SHM\Adapter\Wincache',
39+
$object2->getAdapter()
3640
);
3741
}
3842

@@ -45,11 +49,12 @@ public function testWincacheConsructionWithSpecialName()
4549
$this->assertInstanceOf('\PEAR2\Cache\SHM', $object2);
4650

4751
$this->assertInstanceOf(
48-
'\PEAR2\Cache\SHM\Adapter\Wincache', $object1->getAdapter()
52+
'\PEAR2\Cache\SHM\Adapter\Wincache',
53+
$object1->getAdapter()
4954
);
5055
$this->assertInstanceOf(
51-
'\PEAR2\Cache\SHM\Adapter\Wincache', $object2->getAdapter()
56+
'\PEAR2\Cache\SHM\Adapter\Wincache',
57+
$object2->getAdapter()
5258
);
5359
}
54-
55-
}
60+
}

tests/bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<?php
22
require_once 'PEAR2/Autoload.php';
3-
PEAR2\Autoload::initialize('../src');
3+
PEAR2\Autoload::initialize('../src');

0 commit comments

Comments
 (0)