@@ -110,19 +110,19 @@ discard block |
||
110 | 110 | |
111 | 111 | // Make sure there is a space before opening a fenced code block (search for ```language) |
112 | 112 | if (str_starts_with($line, '```') && $line !== '```' && trim($last_line) != '') { |
113 | - if (! $is_inside_fenced_fenced_code_block) { |
|
113 | + if (!$is_inside_fenced_fenced_code_block) { |
|
114 | 114 | $new_lines[] = ''; |
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
118 | 118 | // Check if line is a fenced code block |
119 | 119 | if (str_starts_with($line, '``')) { |
120 | - $is_inside_fenced_code_block = ! $is_inside_fenced_code_block; |
|
120 | + $is_inside_fenced_code_block = !$is_inside_fenced_code_block; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | // Check if line is an escaped fenced code block |
124 | 124 | if (str_starts_with($line, '````')) { |
125 | - $is_inside_fenced_fenced_code_block = ! $is_inside_fenced_fenced_code_block; |
|
125 | + $is_inside_fenced_fenced_code_block = !$is_inside_fenced_fenced_code_block; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | // Remove trailing spaces |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | /** Linting */ |
135 | 135 | |
136 | 136 | // if not inside fenced code block |
137 | - if (! $is_inside_fenced_code_block) { |
|
137 | + if (!$is_inside_fenced_code_block) { |
|
138 | 138 | // Add any links to buffer, so we can check them later |
139 | 139 | preg_match_all('/\[([^\[]+)]\((.*)\)/', $line, $matches); |
140 | 140 | if (count($matches) > 0) { |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | // Check for un-backtick-ed inline code |
157 | 157 | // If line contains $ |
158 | - if (str_contains($line, '$') && ! str_contains($line, '[Blade]:') && ! str_contains($line, '$ php')) { |
|
158 | + if (str_contains($line, '$') && !str_contains($line, '[Blade]:') && !str_contains($line, '$ php')) { |
|
159 | 159 | // Check character before the $ is not a backtick |
160 | 160 | $pos = strpos($line, '$'); |
161 | 161 | if ($pos > 0) { |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | } |
168 | 168 | } |
169 | 169 | // If line contains command |
170 | - if (str_contains($line, 'php hyde') && ! str_contains($line, '[Blade]:') && ! str_contains($line, '$ php')) { |
|
170 | + if (str_contains($line, 'php hyde') && !str_contains($line, '[Blade]:') && !str_contains($line, '$ php')) { |
|
171 | 171 | // Check character before the php hyde is not a backtick |
172 | 172 | $pos = strpos($line, 'php hyde'); |
173 | 173 | if ($pos > 0) { |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | } |
180 | 180 | } |
181 | 181 | // If word ends in .php |
182 | - if (str_contains($line, '.php') && ! str_contains($line, '[Blade]:') && ! str_contains($line, '$ php') && ! str_contains($line, 'http') && ! str_contains(strtolower($line), 'filepath')) { |
|
182 | + if (str_contains($line, '.php') && !str_contains($line, '[Blade]:') && !str_contains($line, '$ php') && !str_contains($line, 'http') && !str_contains(strtolower($line), 'filepath')) { |
|
183 | 183 | // Check character after the .php is not a backtick |
184 | 184 | $pos = strpos($line, '.php'); |
185 | 185 | if ($pos > 0) { |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | } |
193 | 193 | |
194 | 194 | // If word ends in .json |
195 | - if (str_contains($line, '.json') && ! str_contains($line, '[Blade]:') && ! str_contains($line, '$ json') && ! str_contains($line, 'http') && ! str_contains(strtolower($line), 'filepath')) { |
|
195 | + if (str_contains($line, '.json') && !str_contains($line, '[Blade]:') && !str_contains($line, '$ json') && !str_contains($line, 'http') && !str_contains(strtolower($line), 'filepath')) { |
|
196 | 196 | // Check character after the .json is not a backtick |
197 | 197 | $pos = strpos($line, '.json'); |
198 | 198 | if ($pos > 0) { |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | } |
205 | 205 | } |
206 | 206 | // if word ends with () |
207 | - if (str_contains($line, '()') && ! str_contains($line, '[Blade]:')) { |
|
207 | + if (str_contains($line, '()') && !str_contains($line, '[Blade]:')) { |
|
208 | 208 | // Check character after the () is not a backtick |
209 | 209 | $pos = strpos($line, '()'); |
210 | 210 | if ($pos > 0) { |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | } |
233 | 233 | $signature = substr($signature, 0, $end); |
234 | 234 | $signatures = getSignatures(); |
235 | - if (! in_array($signature, $signatures)) { |
|
235 | + if (!in_array($signature, $signatures)) { |
|
236 | 236 | global $warnings; |
237 | 237 | $warnings['Invalid command signatures'][] = sprintf('Invalid command signature \'%s\' found in %s:%s', $signature, $filename, $index + 1); |
238 | 238 | } |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | // Trim any non-alphanumeric characters from the end of the link |
321 | 321 | $link = rtrim($link, '.,;:!?)'); |
322 | 322 | |
323 | - if (! str_starts_with($link, 'ANCHOR_')) { |
|
323 | + if (!str_starts_with($link, 'ANCHOR_')) { |
|
324 | 324 | // Add to new unique array |
325 | 325 | $uniqueLinks[$link] = "$filename:$line"; |
326 | 326 | } |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | } |
345 | 345 | |
346 | 346 | // Check if file exists |
347 | - if (! file_exists($base.'/'.$link)) { |
|
347 | + if (!file_exists($base.'/'.$link)) { |
|
348 | 348 | $hasMatch = false; |
349 | 349 | foreach ($directories as $directory) { |
350 | 350 | if (file_exists($directory.'/'.$link.'.md')) { |
@@ -353,9 +353,9 @@ discard block |
||
353 | 353 | } |
354 | 354 | } |
355 | 355 | |
356 | - if (! $hasMatch) { |
|
356 | + if (!$hasMatch) { |
|
357 | 357 | // Check that link is not for search (dynamic page) |
358 | - if (! str_contains($link, 'search')) { |
|
358 | + if (!str_contains($link, 'search')) { |
|
359 | 359 | $warnings['Broken links'][] = "Broken link to $link found in $location"; |
360 | 360 | } |
361 | 361 | } |
@@ -412,11 +412,11 @@ discard block |
||
412 | 412 | $isSentenceCase = $headingText === $sentenceCase; |
413 | 413 | $something = false; |
414 | 414 | if ($headingLevel < 3) { |
415 | - if (! $isTitleCase) { |
|
415 | + if (!$isTitleCase) { |
|
416 | 416 | $warnings['Headings'][] = "Heading '$headingText' should be title case in $filename (expected '$titleCase')"; |
417 | 417 | } |
418 | 418 | } else { |
419 | - if (! $isSentenceCase) { |
|
419 | + if (!$isSentenceCase) { |
|
420 | 420 | $warnings['Headings'][] = "Heading '$headingText' should be sentence case in $filename (expected '$sentenceCase')"; |
421 | 421 | } |
422 | 422 | } |
@@ -158,18 +158,18 @@ discard block |
||
158 | 158 | $fileName = (new ReflectionClass($class))->getFileName(); |
159 | 159 | |
160 | 160 | // Remove methods defined in traits or parent classes |
161 | - $methods = array_filter($methods, function (ReflectionMethod $method) use ($fileName) { |
|
161 | + $methods = array_filter($methods, function(ReflectionMethod $method) use ($fileName) { |
|
162 | 162 | return $method->getFileName() === $fileName; |
163 | 163 | }); |
164 | 164 | |
165 | 165 | // Split methods into static and non-static |
166 | 166 | |
167 | - $staticMethods = array_filter($methods, function (ReflectionMethod $method) { |
|
167 | + $staticMethods = array_filter($methods, function(ReflectionMethod $method) { |
|
168 | 168 | return $method->isStatic(); |
169 | 169 | }); |
170 | 170 | |
171 | - $instanceMethods = array_filter($methods, function (ReflectionMethod $method) { |
|
172 | - return ! $method->isStatic(); |
|
171 | + $instanceMethods = array_filter($methods, function(ReflectionMethod $method) { |
|
172 | + return !$method->isStatic(); |
|
173 | 173 | }); |
174 | 174 | |
175 | 175 | $output = []; |
@@ -277,11 +277,11 @@ discard block |
||
277 | 277 | |
278 | 278 | $className = class_basename($class); |
279 | 279 | |
280 | - $parameters = array_map(function (ReflectionParameter $parameter) { |
|
280 | + $parameters = array_map(function(ReflectionParameter $parameter) { |
|
281 | 281 | $name = '$'.$parameter->getName(); |
282 | 282 | if ($parameter->getType()) { |
283 | 283 | if ($parameter->getType() instanceof ReflectionUnionType) { |
284 | - $type = implode('|', array_map(function (ReflectionNamedType $type) { |
|
284 | + $type = implode('|', array_map(function(ReflectionNamedType $type) { |
|
285 | 285 | return $type->getName(); |
286 | 286 | }, $parameter->getType()->getTypes())); |
287 | 287 | } else { |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | |
297 | 297 | // If return is union type |
298 | 298 | if ($method->getReturnType() instanceof ReflectionUnionType) { |
299 | - $returnType = implode('|', array_map(function (ReflectionNamedType $type) { |
|
299 | + $returnType = implode('|', array_map(function(ReflectionNamedType $type) { |
|
300 | 300 | return $type->getName(); |
301 | 301 | }, $method->getReturnType()->getTypes())); |
302 | 302 | } else { |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | if (str_contains($returnValue, ' ')) { |
311 | 311 | $exploded = explode(' ', $returnValue, 2); |
312 | 312 | // If is not generic |
313 | - if (! str_contains($exploded[0], '<')) { |
|
313 | + if (!str_contains($exploded[0], '<')) { |
|
314 | 314 | $type = $exploded[0]; |
315 | 315 | $comment = ' // '.$exploded[1]; |
316 | 316 | $returnValue = $type; |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | $parameterDocs = []; |
327 | 327 | // Map docblock params |
328 | 328 | if (isset($PHPDocs['properties']['params'])) { |
329 | - $newParams = array_map(function (string $param) use (&$parameterDocs) { |
|
329 | + $newParams = array_map(function(string $param) use (&$parameterDocs) { |
|
330 | 330 | $param = str_replace(' ', ' ', trim($param)); |
331 | 331 | $comment = $param; |
332 | 332 | $param = explode(' ', $param, 3); |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | function parsePHPDocs(string $comment): array |
403 | 403 | { |
404 | 404 | // Normalize |
405 | - $comment = array_map(function (string $line) { |
|
405 | + $comment = array_map(function(string $line) { |
|
406 | 406 | return trim($line, " \t*/"); |
407 | 407 | }, explode("\n", $comment)); |
408 | 408 | |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | $text = str_replace(array_keys($replace), array_values($replace), $text); |
441 | 441 | |
442 | 442 | // Trim trailing whitespace |
443 | - $text = implode("\n", array_map(function (string $line) { |
|
443 | + $text = implode("\n", array_map(function(string $line) { |
|
444 | 444 | return rtrim($line); |
445 | 445 | }, explode("\n", $text))); |
446 | 446 |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public static function files(): array |
135 | 135 | { |
136 | - return Files::getFiles(static::class)->map(function (SourceFile $file): string { |
|
136 | + return Files::getFiles(static::class)->map(function(SourceFile $file): string { |
|
137 | 137 | return static::pathToIdentifier($file->getPath()); |
138 | 138 | })->values()->toArray(); |
139 | 139 | } |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | */ |
372 | 372 | public function showInNavigation(): bool |
373 | 373 | { |
374 | - return ! $this->navigation->hidden; |
|
374 | + return !$this->navigation->hidden; |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | /** |
@@ -400,11 +400,11 @@ discard block |
||
400 | 400 | |
401 | 401 | public function getCanonicalUrl(): ?string |
402 | 402 | { |
403 | - if (! empty($this->matter('canonicalUrl'))) { |
|
403 | + if (!empty($this->matter('canonicalUrl'))) { |
|
404 | 404 | return $this->matter('canonicalUrl'); |
405 | 405 | } |
406 | 406 | |
407 | - if (Hyde::hasSiteUrl() && ! empty($this->identifier)) { |
|
407 | + if (Hyde::hasSiteUrl() && !empty($this->identifier)) { |
|
408 | 408 | return Hyde::url($this->getOutputPath()); |
409 | 409 | } |
410 | 410 |