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

Commit b06c38a

Browse files
committed
CS fixes per phpcs
1 parent 1cb8170 commit b06c38a

30 files changed

+114
-82
lines changed

src/AbstractOptions.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@
1313

1414
abstract class AbstractOptions implements ParameterObjectInterface
1515
{
16+
// @codingStandardsIgnoreStart
1617
/**
1718
* We use the __ prefix to avoid collisions with properties in
1819
* user-implementations.
1920
*
2021
* @var bool
2122
*/
2223
protected $__strictMode__ = true;
24+
// @codingStandardsIgnoreEnd
2325

2426
/**
2527
* Constructor
@@ -46,7 +48,7 @@ public function setFromArray($options)
4648
$options = $options->toArray();
4749
}
4850

49-
if (!is_array($options) && !$options instanceof Traversable) {
51+
if (! is_array($options) && ! $options instanceof Traversable) {
5052
throw new Exception\InvalidArgumentException(
5153
sprintf(
5254
'Parameter provided to %s must be an %s, %s or %s',

src/ArrayObject.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,16 @@ public function count()
180180
*/
181181
public function exchangeArray($data)
182182
{
183-
if (!is_array($data) && !is_object($data)) {
184-
throw new Exception\InvalidArgumentException('Passed variable is not an array or object, using empty array instead');
183+
if (! is_array($data) && ! is_object($data)) {
184+
throw new Exception\InvalidArgumentException(
185+
'Passed variable is not an array or object, using empty array instead'
186+
);
185187
}
186188

187189
if (is_object($data) && ($data instanceof self || $data instanceof \ArrayObject)) {
188190
$data = $data->getArrayCopy();
189191
}
190-
if (!is_array($data)) {
192+
if (! is_array($data)) {
191193
$data = (array) $data;
192194
}
193195

@@ -290,7 +292,7 @@ public function offsetExists($key)
290292
public function &offsetGet($key)
291293
{
292294
$ret = null;
293-
if (!$this->offsetExists($key)) {
295+
if (! $this->offsetExists($key)) {
294296
return $ret;
295297
}
296298
$ret =& $this->storage[$key];

src/ArrayUtils.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ abstract class ArrayUtils
3939
*/
4040
public static function hasStringKeys($value, $allowEmpty = false)
4141
{
42-
if (!is_array($value)) {
42+
if (! is_array($value)) {
4343
return false;
4444
}
4545

46-
if (!$value) {
46+
if (! $value) {
4747
return $allowEmpty;
4848
}
4949

@@ -59,11 +59,11 @@ public static function hasStringKeys($value, $allowEmpty = false)
5959
*/
6060
public static function hasIntegerKeys($value, $allowEmpty = false)
6161
{
62-
if (!is_array($value)) {
62+
if (! is_array($value)) {
6363
return false;
6464
}
6565

66-
if (!$value) {
66+
if (! $value) {
6767
return $allowEmpty;
6868
}
6969

@@ -86,11 +86,11 @@ public static function hasIntegerKeys($value, $allowEmpty = false)
8686
*/
8787
public static function hasNumericKeys($value, $allowEmpty = false)
8888
{
89-
if (!is_array($value)) {
89+
if (! is_array($value)) {
9090
return false;
9191
}
9292

93-
if (!$value) {
93+
if (! $value) {
9494
return $allowEmpty;
9595
}
9696

@@ -119,11 +119,11 @@ public static function hasNumericKeys($value, $allowEmpty = false)
119119
*/
120120
public static function isList($value, $allowEmpty = false)
121121
{
122-
if (!is_array($value)) {
122+
if (! is_array($value)) {
123123
return false;
124124
}
125125

126-
if (!$value) {
126+
if (! $value) {
127127
return $allowEmpty;
128128
}
129129

@@ -161,11 +161,11 @@ public static function isList($value, $allowEmpty = false)
161161
*/
162162
public static function isHashTable($value, $allowEmpty = false)
163163
{
164-
if (!is_array($value)) {
164+
if (! is_array($value)) {
165165
return false;
166166
}
167167

168-
if (!$value) {
168+
if (! $value) {
169169
return $allowEmpty;
170170
}
171171

@@ -187,7 +187,7 @@ public static function isHashTable($value, $allowEmpty = false)
187187
*/
188188
public static function inArray($needle, array $haystack, $strict = false)
189189
{
190-
if (!$strict) {
190+
if (! $strict) {
191191
if (is_int($needle) || is_float($needle)) {
192192
$needle = (string) $needle;
193193
}
@@ -215,11 +215,11 @@ public static function inArray($needle, array $haystack, $strict = false)
215215
*/
216216
public static function iteratorToArray($iterator, $recursive = true)
217217
{
218-
if (!is_array($iterator) && !$iterator instanceof Traversable) {
218+
if (! is_array($iterator) && ! $iterator instanceof Traversable) {
219219
throw new Exception\InvalidArgumentException(__METHOD__ . ' expects an array or Traversable object');
220220
}
221221

222-
if (!$recursive) {
222+
if (! $recursive) {
223223
if (is_array($iterator)) {
224224
return $iterator;
225225
}
@@ -274,15 +274,15 @@ public static function merge(array $a, array $b, $preserveNumericKeys = false)
274274
} elseif (isset($a[$key]) || array_key_exists($key, $a)) {
275275
if ($value instanceof MergeRemoveKey) {
276276
unset($a[$key]);
277-
} elseif (!$preserveNumericKeys && is_int($key)) {
277+
} elseif (! $preserveNumericKeys && is_int($key)) {
278278
$a[] = $value;
279279
} elseif (is_array($value) && is_array($a[$key])) {
280280
$a[$key] = static::merge($a[$key], $value, $preserveNumericKeys);
281281
} else {
282282
$a[$key] = $value;
283283
}
284284
} else {
285-
if (!$value instanceof MergeRemoveKey) {
285+
if (! $value instanceof MergeRemoveKey) {
286286
$a[$key] = $value;
287287
}
288288
}

src/ErrorHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public static function getNestedLevel()
5151
*/
5252
public static function start($errorLevel = \E_WARNING)
5353
{
54-
if (!static::$stack) {
54+
if (! static::$stack) {
5555
set_error_handler([get_called_class(), 'addError'], $errorLevel);
5656
}
5757

@@ -72,7 +72,7 @@ public static function stop($throw = false)
7272
if (static::$stack) {
7373
$errorException = array_pop(static::$stack);
7474

75-
if (!static::$stack) {
75+
if (! static::$stack) {
7676
restore_error_handler();
7777
}
7878

src/Glob.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ abstract class Glob
3838
*/
3939
public static function glob($pattern, $flags = 0, $forceFallback = false)
4040
{
41-
if (!defined('GLOB_BRACE') || $forceFallback) {
41+
if (! defined('GLOB_BRACE') || $forceFallback) {
4242
return static::fallbackGlob($pattern, $flags);
4343
}
4444

@@ -96,7 +96,7 @@ protected static function systemGlob($pattern, $flags)
9696
*/
9797
protected static function fallbackGlob($pattern, $flags)
9898
{
99-
if (!$flags & self::GLOB_BRACE) {
99+
if (! $flags & self::GLOB_BRACE) {
100100
return static::systemGlob($pattern, $flags);
101101
}
102102

@@ -182,7 +182,7 @@ protected static function nextBraceSub($pattern, $begin, $flags)
182182
$current = $begin;
183183

184184
while ($current < $length) {
185-
if (!$flags & self::GLOB_NOESCAPE && $pattern[$current] === '\\') {
185+
if (! $flags & self::GLOB_NOESCAPE && $pattern[$current] === '\\') {
186186
if (++$current === $length) {
187187
break;
188188
}

src/Guard/ArrayOrTraversableGuardTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ protected function guardForArrayOrTraversable(
2929
$dataName = 'Argument',
3030
$exceptionClass = 'Zend\Stdlib\Exception\InvalidArgumentException'
3131
) {
32-
if (!is_array($data) && !($data instanceof Traversable)) {
32+
if (! is_array($data) && ! ($data instanceof Traversable)) {
3333
$message = sprintf(
3434
"%s must be an array or Traversable, [%s] given",
3535
$dataName,

src/Message.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function setMetadata($spec, $value = null)
4040
$this->metadata[$spec] = $value;
4141
return $this;
4242
}
43-
if (!is_array($spec) && !$spec instanceof Traversable) {
43+
if (! is_array($spec) && ! $spec instanceof Traversable) {
4444
throw new Exception\InvalidArgumentException(sprintf(
4545
'Expected a string, array, or Traversable argument in first position; received "%s"',
4646
(is_object($spec) ? get_class($spec) : gettype($spec))
@@ -66,7 +66,7 @@ public function getMetadata($key = null, $default = null)
6666
return $this->metadata;
6767
}
6868

69-
if (!is_scalar($key)) {
69+
if (! is_scalar($key)) {
7070
throw new Exception\InvalidArgumentException('Non-scalar argument provided for key');
7171
}
7272

src/PriorityList.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class PriorityList implements Iterator, Countable
6262
*/
6363
public function insert($name, $value, $priority = 0)
6464
{
65-
if (!isset($this->items[$name])) {
65+
if (! isset($this->items[$name])) {
6666
$this->count++;
6767
}
6868

@@ -85,7 +85,7 @@ public function insert($name, $value, $priority = 0)
8585
*/
8686
public function setPriority($name, $priority)
8787
{
88-
if (!isset($this->items[$name])) {
88+
if (! isset($this->items[$name])) {
8989
throw new \Exception("item $name not found");
9090
}
9191

@@ -131,7 +131,7 @@ public function clear()
131131
*/
132132
public function get($name)
133133
{
134-
if (!isset($this->items[$name])) {
134+
if (! isset($this->items[$name])) {
135135
return;
136136
}
137137

@@ -145,7 +145,7 @@ public function get($name)
145145
*/
146146
protected function sort()
147147
{
148-
if (!$this->sorted) {
148+
if (! $this->sorted) {
149149
uasort($this->items, [$this, 'compare']);
150150
$this->sorted = true;
151151
}
@@ -161,7 +161,7 @@ protected function sort()
161161
protected function compare(array $item1, array $item2)
162162
{
163163
return ($item1['priority'] === $item2['priority'])
164-
? ($item1['serial'] > $item2['serial'] ? -1 : 1) * $this->isLIFO
164+
? ($item1['serial'] > $item2['serial'] ? -1 : 1) * $this->isLIFO
165165
: ($item1['priority'] > $item2['priority'] ? -1 : 1);
166166
}
167167

src/PriorityQueue.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public function remove($datum)
9999
unset($this->items[$key]);
100100
$this->queue = null;
101101

102-
if (!$this->isEmpty()) {
102+
if (! $this->isEmpty()) {
103103
$queue = $this->getQueue();
104104
foreach ($this->items as $item) {
105105
$queue->insert($item['data'], $item['priority']);
@@ -277,7 +277,7 @@ protected function getQueue()
277277
{
278278
if (null === $this->queue) {
279279
$this->queue = new $this->queueClass();
280-
if (!$this->queue instanceof \SplPriorityQueue) {
280+
if (! $this->queue instanceof \SplPriorityQueue) {
281281
throw new Exception\DomainException(sprintf(
282282
'PriorityQueue expects an internal queue of type SplPriorityQueue; received "%s"',
283283
get_class($this->queue)

src/SplPriorityQueue.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class SplPriorityQueue extends \SplPriorityQueue implements Serializable
3636
*/
3737
public function insert($datum, $priority)
3838
{
39-
if (!is_array($priority)) {
39+
if (! is_array($priority)) {
4040
$priority = [$priority, $this->serial--];
4141
}
4242
parent::insert($datum, $priority);

src/StringUtils.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public static function getRegisteredWrappers()
8484
public static function registerWrapper($wrapper)
8585
{
8686
$wrapper = (string) $wrapper;
87-
if (!in_array($wrapper, static::$wrapperRegistry, true)) {
87+
if (! in_array($wrapper, static::$wrapperRegistry, true)) {
8888
static::$wrapperRegistry[] = $wrapper;
8989
}
9090
}

src/StringWrapper/AbstractStringWrapper.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ public static function isSupported($encoding, $convertEncoding = null)
3838
{
3939
$supportedEncodings = static::getSupportedEncodings();
4040

41-
if (!in_array(strtoupper($encoding), $supportedEncodings)) {
41+
if (! in_array(strtoupper($encoding), $supportedEncodings)) {
4242
return false;
4343
}
4444

45-
if ($convertEncoding !== null && !in_array(strtoupper($convertEncoding), $supportedEncodings)) {
45+
if ($convertEncoding !== null && ! in_array(strtoupper($convertEncoding), $supportedEncodings)) {
4646
return false;
4747
}
4848

@@ -61,15 +61,15 @@ public function setEncoding($encoding, $convertEncoding = null)
6161
$supportedEncodings = static::getSupportedEncodings();
6262

6363
$encodingUpper = strtoupper($encoding);
64-
if (!in_array($encodingUpper, $supportedEncodings)) {
64+
if (! in_array($encodingUpper, $supportedEncodings)) {
6565
throw new Exception\InvalidArgumentException(
6666
'Wrapper doesn\'t support character encoding "' . $encoding . '"'
6767
);
6868
}
6969

7070
if ($convertEncoding !== null) {
7171
$convertEncodingUpper = strtoupper($convertEncoding);
72-
if (!in_array($convertEncodingUpper, $supportedEncodings)) {
72+
if (! in_array($convertEncodingUpper, $supportedEncodings)) {
7373
throw new Exception\InvalidArgumentException(
7474
'Wrapper doesn\'t support character encoding "' . $convertEncoding . '"'
7575
);

src/StringWrapper/Iconv.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ public static function getSupportedEncodings()
214214
*/
215215
public function __construct()
216216
{
217-
if (!extension_loaded('iconv')) {
217+
if (! extension_loaded('iconv')) {
218218
throw new Exception\ExtensionNotLoadedException(
219219
'PHP extension "iconv" is required for this wrapper'
220220
);

src/StringWrapper/Intl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public static function getSupportedEncodings()
3737
*/
3838
public function __construct()
3939
{
40-
if (!extension_loaded('intl')) {
40+
if (! extension_loaded('intl')) {
4141
throw new Exception\ExtensionNotLoadedException(
4242
'PHP extension "intl" is required for this wrapper'
4343
);

src/StringWrapper/MbString.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static function getSupportedEncodings()
4848
*/
4949
public function __construct()
5050
{
51-
if (!extension_loaded('mbstring')) {
51+
if (! extension_loaded('mbstring')) {
5252
throw new Exception\ExtensionNotLoadedException(
5353
'PHP extension "mbstring" is required for this wrapper'
5454
);

src/StringWrapper/Native.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static function isSupported($encoding, $convertEncoding = null)
3535
$encodingUpper = strtoupper($encoding);
3636
$supportedEncodings = static::getSupportedEncodings();
3737

38-
if (!in_array($encodingUpper, $supportedEncodings)) {
38+
if (! in_array($encodingUpper, $supportedEncodings)) {
3939
return false;
4040
}
4141

@@ -69,7 +69,7 @@ public function setEncoding($encoding, $convertEncoding = null)
6969
$supportedEncodings = static::getSupportedEncodings();
7070

7171
$encodingUpper = strtoupper($encoding);
72-
if (!in_array($encodingUpper, $supportedEncodings)) {
72+
if (! in_array($encodingUpper, $supportedEncodings)) {
7373
throw new Exception\InvalidArgumentException(
7474
'Wrapper doesn\'t support character encoding "' . $encoding . '"'
7575
);

0 commit comments

Comments
 (0)