Passed
Pull Request — master (#12)
by Jake
02:34
created
src/QueryPathIterator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 
29 29
 	public function current()
30 30
 	{
31
-		if (! isset($this->qp)) {
31
+		if (!isset($this->qp)) {
32 32
 			$this->qp = QueryPath::with(parent::current(), null, $this->options);
33 33
 		} else {
34 34
 			$splos = new SplObjectStorage();
Please login to merge, or discard this patch.
src/DOMQuery.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 		$xpath = new DOMXPath($this->document);
197 197
 
198 198
 		// Register a default namespace.
199
-		if (! empty($options['namespace_prefix']) && ! empty($options['namespace_uri'])) {
199
+		if (!empty($options['namespace_prefix']) && !empty($options['namespace_uri'])) {
200 200
 			$xpath->registerNamespace($options['namespace_prefix'], $options['namespace_uri']);
201 201
 		}
202 202
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 			return ($this->count() > $index) ? $this->getNthMatch($index) : null;
287 287
 		}
288 288
 		// Retain support for legacy.
289
-		if (! $asObject) {
289
+		if (!$asObject) {
290 290
 			$matches = [];
291 291
 			foreach ($this->matches as $m) {
292 292
 				$matches[] = $m;
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 			$matches = [];
400 400
 			preg_match($regex, $data, $matches);
401 401
 
402
-			if (! empty($matches)) {
402
+			if (!empty($matches)) {
403 403
 				$result = [
404 404
 					'mime' => $matches[1] . '/' . $matches[2],
405 405
 					'data' => base64_decode($matches[3]),
@@ -685,12 +685,12 @@  discard block
 block discarded – undo
685 685
 		$first = $this->getFirstMatch();
686 686
 
687 687
 		// Catch cases where first item is not a legit DOM object.
688
-		if (! ($first instanceof DOMNode)) {
688
+		if (!($first instanceof DOMNode)) {
689 689
 			return null;
690 690
 		}
691 691
 
692 692
 		// Added by eabrand.
693
-		if (! $first->ownerDocument->documentElement) {
693
+		if (!$first->ownerDocument->documentElement) {
694 694
 			return null;
695 695
 		}
696 696
 
@@ -735,12 +735,12 @@  discard block
 block discarded – undo
735 735
 		$first = $this->getFirstMatch();
736 736
 
737 737
 		// Catch cases where first item is not a legit DOM object.
738
-		if (! ($first instanceof DOMNode)) {
738
+		if (!($first instanceof DOMNode)) {
739 739
 			return null;
740 740
 		}
741 741
 
742 742
 		// Added by eabrand.
743
-		if (! $first->ownerDocument->documentElement) {
743
+		if (!$first->ownerDocument->documentElement) {
744 744
 			return null;
745 745
 		}
746 746
 
@@ -811,11 +811,11 @@  discard block
 block discarded – undo
811 811
 		$first = $this->getFirstMatch();
812 812
 
813 813
 		// Catch cases where first item is not a legit DOM object.
814
-		if (! ($first instanceof DOMNode)) {
814
+		if (!($first instanceof DOMNode)) {
815 815
 			return null;
816 816
 		}
817 817
 
818
-		if (! $first->hasChildNodes()) {
818
+		if (!$first->hasChildNodes()) {
819 819
 			return '';
820 820
 		}
821 821
 
@@ -850,11 +850,11 @@  discard block
 block discarded – undo
850 850
 		$first = $this->getFirstMatch();
851 851
 
852 852
 		// Catch cases where first item is not a legit DOM object.
853
-		if (! ($first instanceof DOMNode)) {
853
+		if (!($first instanceof DOMNode)) {
854 854
 			return null;
855 855
 		}
856 856
 
857
-		if (! $first->hasChildNodes()) {
857
+		if (!$first->hasChildNodes()) {
858 858
 			return '';
859 859
 		}
860 860
 
@@ -882,11 +882,11 @@  discard block
 block discarded – undo
882 882
 		$first = $this->getFirstMatch();
883 883
 
884 884
 		// Catch cases where first item is not a legit DOM object.
885
-		if (! ($first instanceof DOMNode)) {
885
+		if (!($first instanceof DOMNode)) {
886 886
 			return null;
887 887
 		}
888 888
 
889
-		if (! $first->hasChildNodes()) {
889
+		if (!$first->hasChildNodes()) {
890 890
 			return '';
891 891
 		}
892 892
 
@@ -1030,7 +1030,7 @@  discard block
 block discarded – undo
1030 1030
 		foreach ($this->matches as $m) {
1031 1031
 			$p = $m;
1032 1032
 			while (isset($p->previousSibling) && $p->previousSibling->nodeType === XML_TEXT_NODE) {
1033
-				$p      = $p->previousSibling;
1033
+				$p = $p->previousSibling;
1034 1034
 				$buffer .= $p->textContent;
1035 1035
 			}
1036 1036
 		}
@@ -1049,7 +1049,7 @@  discard block
 block discarded – undo
1049 1049
 		foreach ($this->matches as $m) {
1050 1050
 			$n = $m;
1051 1051
 			while (isset($n->nextSibling) && $n->nextSibling->nodeType === XML_TEXT_NODE) {
1052
-				$n      = $n->nextSibling;
1052
+				$n = $n->nextSibling;
1053 1053
 				$buffer .= $n->textContent;
1054 1054
 			}
1055 1055
 		}
@@ -1134,7 +1134,7 @@  discard block
 block discarded – undo
1134 1134
 		// Only return the first item -- that's what JQ does.
1135 1135
 		$first = $this->getFirstMatch();
1136 1136
 		// Catch cases where first item is not a legit DOM object.
1137
-		if (! ($first instanceof DOMNode)) {
1137
+		if (!($first instanceof DOMNode)) {
1138 1138
 			return null;
1139 1139
 		}
1140 1140
 
@@ -1217,7 +1217,7 @@  discard block
 block discarded – undo
1217 1217
 		$first = $this->getFirstMatch();
1218 1218
 
1219 1219
 		// Catch cases where first item is not a legit DOM object.
1220
-		if (! ($first instanceof DOMNode)) {
1220
+		if (!($first instanceof DOMNode)) {
1221 1221
 			return null;
1222 1222
 		}
1223 1223
 
@@ -1524,7 +1524,7 @@  discard block
 block discarded – undo
1524 1524
 	public function __call($name, $arguments)
1525 1525
 	{
1526 1526
 
1527
-		if (! ExtensionRegistry::$useRegistry) {
1527
+		if (!ExtensionRegistry::$useRegistry) {
1528 1528
 			throw new Exception("No method named $name found (Extensions disabled).");
1529 1529
 		}
1530 1530
 
@@ -1544,7 +1544,7 @@  discard block
 block discarded – undo
1544 1544
 		}
1545 1545
 
1546 1546
 		// Note that an empty ext registry indicates that extensions are disabled.
1547
-		if (! empty($this->ext) && ExtensionRegistry::hasMethod($name)) {
1547
+		if (!empty($this->ext) && ExtensionRegistry::hasMethod($name)) {
1548 1548
 			$owner  = ExtensionRegistry::getMethodClass($name);
1549 1549
 			$method = new ReflectionMethod($owner, $name);
1550 1550
 
Please login to merge, or discard this patch.
src/DOM.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 		$this->options = $options + Options::get() + $this->options;
85 85
 
86 86
 		$parser_flags = $options['parser_flags'] ?? self::DEFAULT_PARSER_FLAGS;
87
-		if (! empty($this->options['ignore_parser_warnings'])) {
87
+		if (!empty($this->options['ignore_parser_warnings'])) {
88 88
 			// Don't convert parser warnings into exceptions.
89 89
 			$this->errTypes = 257; //E_ERROR | E_USER_ERROR;
90 90
 		} elseif (isset($this->options['exception_level'])) {
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 				$this->matches = $document;
110 110
 				if ($document->count() !== 0) {
111 111
 					$first = $this->getFirstMatch();
112
-					if (! empty($first->ownerDocument)) {
112
+					if (!empty($first->ownerDocument)) {
113 113
 						$this->document = $first->ownerDocument;
114 114
 					}
115 115
 				}
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 			}
141 141
 		} elseif (is_array($document)) {
142 142
 			//trigger_error('Detected deprecated array support', E_USER_NOTICE);
143
-			if (! empty($document) && $document[0] instanceof DOMNode) {
143
+			if (!empty($document) && $document[0] instanceof DOMNode) {
144 144
 				$found = new SplObjectStorage();
145 145
 				foreach ($document as $item) {
146 146
 					$found->attach($item);
@@ -199,13 +199,13 @@  discard block
 block discarded – undo
199 199
 
200 200
 			// This is to avoid cases where low ascii digits have slipped into HTML.
201 201
 			// AFAIK, it should not adversly effect UTF-8 documents.
202
-			if (! empty($this->options['strip_low_ascii'])) {
202
+			if (!empty($this->options['strip_low_ascii'])) {
203 203
 				$string = filter_var($string, FILTER_UNSAFE_RAW, FILTER_FLAG_ENCODE_LOW);
204 204
 			}
205 205
 
206 206
 			// Allow users to override parser settings.
207 207
 			$useParser = '';
208
-			if (! empty($this->options['use_parser'])) {
208
+			if (!empty($this->options['use_parser'])) {
209 209
 				$useParser = strtolower($this->options['use_parser']);
210 210
 			}
211 211
 
@@ -297,10 +297,10 @@  discard block
 block discarded – undo
297 297
 	protected function deepestNode(DOMNode $ele, $depth = 0, $current = null, &$deepest = null)
298 298
 	{
299 299
 		// FIXME: Should this use SplObjectStorage?
300
-		if (! isset($current)) {
300
+		if (!isset($current)) {
301 301
 			$current = [$ele];
302 302
 		}
303
-		if (! isset($deepest)) {
303
+		if (!isset($deepest)) {
304 304
 			$deepest = $depth;
305 305
 		}
306 306
 		if ($ele->hasChildNodes()) {
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 
437 437
 		// If a context is specified, we basically have to do the reading in
438 438
 		// two steps:
439
-		if (! empty($context)) {
439
+		if (!empty($context)) {
440 440
 			try {
441 441
 				set_error_handler(['\QueryPath\ParseException', 'initializeFromError'], $this->errTypes);
442 442
 				$contents = file_get_contents($filename, false, $context);
Please login to merge, or discard this patch.
src/Extension/QPXML.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
 	{
37 37
 		$doc = $this->qp->branch()->top()->get(0)->ownerDocument;
38 38
 
39
-		if (! $doc->schemaValidate($file)) {
39
+		if (!$doc->schemaValidate($file)) {
40 40
 			throw new Exception('Document did not validate against the schema.');
41 41
 		}
42 42
 	}
Please login to merge, or discard this patch.
src/Extension/QPXSL.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
 	 */
74 74
 	public function xslt($style)
75 75
 	{
76
-		if (! ($style instanceof QueryPath)) {
76
+		if (!($style instanceof QueryPath)) {
77 77
 			$style = QueryPath::with($style);
78 78
 		}
79 79
 		$sourceDoc = $this->src->top()->get(0)->ownerDocument;
Please login to merge, or discard this patch.
src/Extension/Format.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -92,11 +92,11 @@  discard block
 block discarded – undo
92 92
 			array_shift($args);
93 93
 		}
94 94
 
95
-		$getter = function ($qp) {
95
+		$getter = function($qp) {
96 96
 			return $qp->text();
97 97
 		};
98 98
 
99
-		$setter = function ($qp, $value) {
99
+		$setter = function($qp, $value) {
100 100
 			$qp->text($value);
101 101
 		};
102 102
 
@@ -145,11 +145,11 @@  discard block
 block discarded – undo
145 145
 			$args = array_slice(func_get_args(), 2);
146 146
 		}
147 147
 
148
-		$getter = function ($qp) use ($attrName) {
148
+		$getter = function($qp) use ($attrName) {
149 149
 			return $qp->attr($attrName);
150 150
 		};
151 151
 
152
-		$setter = function ($qp, $value) use ($attrName) {
152
+		$setter = function($qp, $value) use ($attrName) {
153 153
 			return $qp->attr($attrName, $value);
154 154
 		};
155 155
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	protected function forAll($callback, $args, $getter, $setter): Query
169 169
 	{
170 170
 		[$callback, $pos] = $this->prepareCallback($callback);
171
-		if (! is_callable($callback)) {
171
+		if (!is_callable($callback)) {
172 172
 			throw new Exception('Callback is not callable.');
173 173
 		}
174 174
 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	{
191 191
 		if (is_string($callback)) {
192 192
 			[$callback, $trail] = $this->splitFunctionName($callback);
193
-			$pos = (int) $trail;
193
+			$pos = (int)$trail;
194 194
 		} elseif (is_array($callback) && isset($callback[2])) {
195 195
 			$pos      = $callback[2];
196 196
 			$callback = [$callback[0], $callback[1]];
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	 */
221 221
 	protected function prepareArgs($args, $pos): array
222 222
 	{
223
-		$padded = array_pad((array) $args, (0 < $pos) ? $pos - 1 : 0, null);
223
+		$padded = array_pad((array)$args, (0 < $pos) ? $pos - 1 : 0, null);
224 224
 		array_splice($padded, $pos, 0, [null]); // insert null as a place holder
225 225
 
226 226
 		return $padded;
Please login to merge, or discard this patch.
src/CSS/DOMTraverser/PseudoClass.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -79,10 +79,10 @@  discard block
 block discarded – undo
79 79
 				return false;
80 80
 			case 'indeterminate':
81 81
 				// Because sometimes screwing with people is fun.
82
-				return (boolean) mt_rand(0, 1);
82
+				return (boolean)mt_rand(0, 1);
83 83
 			case 'lang':
84 84
 				// No value = exception.
85
-				if (! isset($value)) {
85
+				if (!isset($value)) {
86 86
 					throw new NotImplementedException(':lang() requires a value.');
87 87
 				}
88 88
 
@@ -128,17 +128,17 @@  discard block
 block discarded – undo
128 128
 			// Additional pseudo-classes defined in jQuery:
129 129
 			case 'lt':
130 130
 				// I'm treating this as "less than or equal to".
131
-				$rule = sprintf('-n + %d', (int) $value);
131
+				$rule = sprintf('-n + %d', (int)$value);
132 132
 
133 133
 				// $rule = '-n+15';
134 134
 				return $this->isNthChild($node, $rule);
135 135
 			case 'gt':
136 136
 				// I'm treating this as "greater than"
137 137
 				// return $this->nodePositionFromEnd($node) > (int) $value;
138
-				return $this->nodePositionFromStart($node) > (int) $value;
138
+				return $this->nodePositionFromStart($node) > (int)$value;
139 139
 			case 'nth':
140 140
 			case 'eq':
141
-				$rule = (int) $value;
141
+				$rule = (int)$value;
142 142
 
143 143
 				return $this->isNthChild($node, $rule);
144 144
 			case 'first':
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 			case 'empty':
154 154
 				return $this->isEmpty($node);
155 155
 			case 'parent':
156
-				return ! $this->isEmpty($node);
156
+				return !$this->isEmpty($node);
157 157
 
158 158
 			case 'enabled':
159 159
 			case 'disabled':
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 	 */
369 369
 	protected function isNot($node, $selector): bool
370 370
 	{
371
-		return ! $this->has($node, $selector);
371
+		return !$this->has($node, $selector);
372 372
 	}
373 373
 
374 374
 	/**
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 		$tag = $node->tagName;
381 381
 		while (isset($node->previousSibling)) {
382 382
 			$node = $node->previousSibling;
383
-			if ($node->nodeType === XML_ELEMENT_NODE && ( ! $byType || $node->tagName === $tag)) {
383
+			if ($node->nodeType === XML_ELEMENT_NODE && (!$byType || $node->tagName === $tag)) {
384 384
 				++$i;
385 385
 			}
386 386
 		}
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 		$tag = $node->tagName;
403 403
 		while (isset($node->nextSibling)) {
404 404
 			$node = $node->nextSibling;
405
-			if ($node->nodeType === XML_ELEMENT_NODE && ( ! $byType || $node->tagName === $tag)) {
405
+			if ($node->nodeType === XML_ELEMENT_NODE && (!$byType || $node->tagName === $tag)) {
406 406
 				++$i;
407 407
 			}
408 408
 		}
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 
471 471
 	protected function isLocalLink($node): bool
472 472
 	{
473
-		if (! $node->hasAttribute('href')) {
473
+		if (!$node->hasAttribute('href')) {
474 474
 			return false;
475 475
 		}
476 476
 		$url    = $node->getAttribute('href');
Please login to merge, or discard this patch.
src/CSS/DOMTraverser/Util.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 */
27 27
 	public static function matchesAttribute($node, $name, $value = null, $operation = EventHandler::IS_EXACTLY): bool
28 28
 	{
29
-		if (! $node->hasAttribute($name)) {
29
+		if (!$node->hasAttribute($name)) {
30 30
 			return false;
31 31
 		}
32 32
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 		$value = null,
48 48
 		$operation = EventHandler::IS_EXACTLY
49 49
 	) {
50
-		if (! $node->hasAttributeNS($nsuri, $name)) {
50
+		if (!$node->hasAttributeNS($nsuri, $name)) {
51 51
 			return false;
52 52
 		}
53 53
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 		}
135 135
 
136 136
 		if (is_numeric($rule)) {
137
-			return [0, (int) $rule];
137
+			return [0, (int)$rule];
138 138
 		}
139 139
 
140 140
 		$regex   = '/^\s*([+\-]?[0-9]*)n\s*([+\-]?)\s*([0-9]*)\s*$/';
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 		$res     = preg_match($regex, $rule, $matches);
143 143
 
144 144
 		// If it doesn't parse, return 0, 0.
145
-		if (! $res) {
145
+		if (!$res) {
146 146
 			return [0, 0];
147 147
 		}
148 148
 
@@ -150,12 +150,12 @@  discard block
 block discarded – undo
150 150
 		if ($aVal === '-') {
151 151
 			$aVal = -1;
152 152
 		} else {
153
-			$aVal = (int) $aVal;
153
+			$aVal = (int)$aVal;
154 154
 		}
155 155
 
156 156
 		$bVal = 0;
157 157
 		if (isset($matches[3])) {
158
-			$bVal = (int) $matches[3];
158
+			$bVal = (int)$matches[3];
159 159
 			if (isset($matches[2]) && $matches[2] === '-') {
160 160
 				$bVal *= -1;
161 161
 			}
Please login to merge, or discard this patch.
src/CSS/Scanner.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -233,14 +233,14 @@  discard block
 block discarded – undo
233 233
 			// The second conjunct is probably not necessary.
234 234
 			while ($this->token !== false && $this->token > -1) {
235 235
 				//print "Char: $this->value \n";
236
-				if ($this->token == Token::BSLASH && ! $escape) {
236
+				if ($this->token == Token::BSLASH && !$escape) {
237 237
 					// XXX: The backslash (\) is removed here.
238 238
 					// Turn on escaping.
239 239
 					//$buf .= $this->value;
240 240
 					$escape = true;
241 241
 				} elseif ($escape) {
242 242
 					// Turn off escaping
243
-					$buf    .= $this->value;
243
+					$buf .= $this->value;
244 244
 					$escape = false;
245 245
 				} elseif ($this->token === $end) {
246 246
 					// At end of string; skip token and break.
@@ -270,14 +270,14 @@  discard block
 block discarded – undo
270 270
 			// The second conjunct is probably not necessary.
271 271
 			while ($this->token !== false && $this->token > -1) {
272 272
 				//print "Char: $this->value \n";
273
-				if ($this->token === Token::BSLASH && ! $escape) {
273
+				if ($this->token === Token::BSLASH && !$escape) {
274 274
 					// XXX: The backslash (\) is removed here.
275 275
 					// Turn on escaping.
276 276
 					//$buf .= $this->value;
277 277
 					$escape = true;
278 278
 				} elseif ($escape) {
279 279
 					// Turn off escaping
280
-					$buf    .= $this->value;
280
+					$buf .= $this->value;
281 281
 					$escape = false;
282 282
 				} // Allow nested pseudoclasses.
283 283
 				elseif ($this->token === Token::LPAREN) {
Please login to merge, or discard this patch.