Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 8ae461c

Browse files
committed
Swap yoda conditions
We tend not to use yoda comaprision as there are less readable
1 parent 8b69f8f commit 8ae461c

File tree

7 files changed

+8
-8
lines changed

7 files changed

+8
-8
lines changed

src/Pattern/PatternOptions.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class PatternOptions extends AbstractOptions
152152
public function __construct($options = null)
153153
{
154154
// disable file/directory permissions by default on windows systems
155-
if (0 === stripos(PHP_OS, 'WIN')) {
155+
if (stripos(PHP_OS, 'WIN') === 0) {
156156
$this->filePermission = false;
157157
$this->dirPermission = false;
158158
}

src/Storage/Adapter/Dba.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ public function clearByNamespace($namespace)
229229
$recheck = false;
230230
$internalKey = dba_firstkey($this->handle);
231231
while ($internalKey !== false && $internalKey !== null) {
232-
if (0 === strpos($internalKey, $prefix)) {
232+
if (strpos($internalKey, $prefix) === 0) {
233233
$result = dba_delete($internalKey, $this->handle) && $result;
234234
}
235235

@@ -267,7 +267,7 @@ public function clearByPrefix($prefix)
267267
$recheck = false;
268268
$internalKey = dba_firstkey($this->handle);
269269
while ($internalKey !== false && $internalKey !== null) {
270-
if (0 === strpos($internalKey, $prefix)) {
270+
if (strpos($internalKey, $prefix) === 0) {
271271
$result = dba_delete($internalKey, $this->handle) && $result;
272272
$recheck = true;
273273
}

src/Storage/Adapter/FilesystemOptions.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class FilesystemOptions extends AdapterOptions
119119
public function __construct($options = null)
120120
{
121121
// disable file/directory permissions by default on windows systems
122-
if (0 === stripos(PHP_OS, 'WIN')) {
122+
if (stripos(PHP_OS, 'WIN') === 0) {
123123
$this->filePermission = false;
124124
$this->dirPermission = false;
125125
}

src/Storage/Adapter/MemcachedResourceManager.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ public function getLibOptions($id)
332332
$reflection = new ReflectionClass('Memcached');
333333
$constants = $reflection->getConstants();
334334
foreach ($constants as $constName => $constValue) {
335-
if (0 === strpos($constName, 'OPT_')) {
335+
if (strpos($constName, 'OPT_') === 0) {
336336
$libOptions[$constValue] = $resource->getOption($constValue);
337337
}
338338
}

src/Storage/Adapter/Memory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public function clearByPrefix($prefix)
205205

206206
$data = & $this->data[$ns];
207207
foreach ($data as $key => & $item) {
208-
if (0 === strpos($key, $prefix)) {
208+
if (strpos($key, $prefix) === 0) {
209209
unset($data[$key]);
210210
}
211211
}

src/Storage/Adapter/RedisResourceManager.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ public function getLibOptions($id)
492492
$reflection = new ReflectionClass('Redis');
493493
$constants = $reflection->getConstants();
494494
foreach ($constants as $constName => $constValue) {
495-
if (0 === strpos($constName, 'OPT_')) {
495+
if (strpos($constName, 'OPT_') === 0) {
496496
$libOptions[$constValue] = $resource['resource']->getOption($constValue);
497497
}
498498
}

src/Storage/Adapter/Session.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public function clearByPrefix($prefix)
124124

125125
$data = $cntr->offsetGet($ns);
126126
foreach ($data as $key => & $item) {
127-
if (0 === strpos($key, $prefix)) {
127+
if (strpos($key, $prefix) === 0) {
128128
unset($data[$key]);
129129
}
130130
}

0 commit comments

Comments
 (0)