@@ -121,14 +121,14 @@ |
||
121 | 121 | |
122 | 122 | protected function validateType(string $pageClass): void |
123 | 123 | { |
124 | - if (! in_array($pageClass, [MarkdownPage::class, BladePage::class, DocumentationPage::class])) { |
|
124 | + if (!in_array($pageClass, [MarkdownPage::class, BladePage::class, DocumentationPage::class])) { |
|
125 | 125 | throw new UnsupportedPageTypeException('The page type must be either "markdown", "blade", or "documentation"'); |
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
129 | 129 | protected function failIfFileCannotBeSaved(string $path): void |
130 | 130 | { |
131 | - if (file_exists($path) && ! $this->force) { |
|
131 | + if (file_exists($path) && !$this->force) { |
|
132 | 132 | throw new FileConflictException($path); |
133 | 133 | } |
134 | 134 | } |
@@ -34,7 +34,7 @@ |
||
34 | 34 | |
35 | 35 | $this->displaySelections($creator); |
36 | 36 | |
37 | - if (! $this->confirm('Do you wish to continue?', true)) { |
|
37 | + if (!$this->confirm('Do you wish to continue?', true)) { |
|
38 | 38 | $this->info('Aborting.'); |
39 | 39 | |
40 | 40 | return 130; |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | use Hyde\Foundation\HydeKernel; |
6 | 6 | |
7 | -if (! function_exists('hyde')) { |
|
7 | +if (!function_exists('hyde')) { |
|
8 | 8 | /** |
9 | 9 | * Get the available HydeKernel instance. |
10 | 10 | */ |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | } |
15 | 15 | } |
16 | 16 | |
17 | -if (! function_exists('unslash')) { |
|
17 | +if (!function_exists('unslash')) { |
|
18 | 18 | /** |
19 | 19 | * Remove trailing slashes from the start and end of a string. |
20 | 20 | */ |
@@ -22,26 +22,26 @@ discard block |
||
22 | 22 | { |
23 | 23 | public function getSourceFiles(?string $pageClass = null): self |
24 | 24 | { |
25 | - return ! $pageClass ? $this->getAllSourceFiles() : $this->getSourceFilesFor($pageClass); |
|
25 | + return !$pageClass ? $this->getAllSourceFiles() : $this->getSourceFilesFor($pageClass); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | public function getAllSourceFiles(): self |
29 | 29 | { |
30 | - return $this->filter(function (File $file) { |
|
30 | + return $this->filter(function(File $file) { |
|
31 | 31 | return $file->belongsTo !== null; |
32 | 32 | }); |
33 | 33 | } |
34 | 34 | |
35 | 35 | public function getSourceFilesFor(string $pageClass): self |
36 | 36 | { |
37 | - return $this->filter(function (File $file) use ($pageClass): bool { |
|
37 | + return $this->filter(function(File $file) use ($pageClass): bool { |
|
38 | 38 | return $file->belongsTo() === $pageClass; |
39 | 39 | }); |
40 | 40 | } |
41 | 41 | |
42 | 42 | public function getMediaFiles(): self |
43 | 43 | { |
44 | - return $this->filter(function (File $file): bool { |
|
44 | + return $this->filter(function(File $file): bool { |
|
45 | 45 | return str_starts_with((string) $file, '_media'); |
46 | 46 | }); |
47 | 47 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | { |
81 | 81 | // Scan the source directory, and directories therein, for files that match the model's file extension. |
82 | 82 | foreach (glob($this->kernel->path($pageClass::sourcePath('{*,**/*}')), GLOB_BRACE) as $filepath) { |
83 | - if (! str_starts_with(basename((string) $filepath), '_')) { |
|
83 | + if (!str_starts_with(basename((string) $filepath), '_')) { |
|
84 | 84 | $this->put($this->kernel->pathToRelative($filepath), File::make($filepath)->belongsTo($pageClass)); |
85 | 85 | } |
86 | 86 | } |
@@ -5,7 +5,7 @@ |
||
5 | 5 | use Rector\Config\RectorConfig; |
6 | 6 | use Rector\Laravel\Set\LaravelSetList; |
7 | 7 | |
8 | -return static function (RectorConfig $rectorConfig): void { |
|
8 | +return static function(RectorConfig $rectorConfig): void { |
|
9 | 9 | $rectorConfig->paths([__DIR__.'/packages/framework/src']); |
10 | 10 | $rectorConfig->sets([ |
11 | 11 | LaravelSetList::LARAVEL_90, |
@@ -53,7 +53,7 @@ |
||
53 | 53 | |
54 | 54 | public function generate(): static |
55 | 55 | { |
56 | - Route::all()->each(function (Route $route): void { |
|
56 | + Route::all()->each(function(Route $route): void { |
|
57 | 57 | $this->addRoute($route); |
58 | 58 | }); |
59 | 59 |
@@ -44,7 +44,7 @@ |
||
44 | 44 | |
45 | 45 | protected function escape(string $string): string |
46 | 46 | { |
47 | - return htmlspecialchars($string, ENT_XML1 | ENT_COMPAT, 'UTF-8'); |
|
47 | + return htmlspecialchars($string, ENT_XML1|ENT_COMPAT, 'UTF-8'); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | protected function addChild(SimpleXMLElement $element, string $name, string $value): SimpleXMLElement |
@@ -49,7 +49,7 @@ |
||
49 | 49 | // Reject any metadata from the global metadata bag that is already present in the page metadata bag. |
50 | 50 | |
51 | 51 | foreach (['links', 'metadata', 'properties', 'generics'] as $type) { |
52 | - $global->$type = array_filter($global->$type, fn (Element $element): bool => ! in_array($element->uniqueKey(), |
|
52 | + $global->$type = array_filter($global->$type, fn (Element $element): bool => !in_array($element->uniqueKey(), |
|
53 | 53 | array_map(fn (Element $element): string => $element->uniqueKey(), $page->metadata->$type) |
54 | 54 | )); |
55 | 55 | } |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | use Illuminate\Support\Facades\File; |
4 | 4 | |
5 | -if (! function_exists('unlinkIfExists')) { |
|
5 | +if (!function_exists('unlinkIfExists')) { |
|
6 | 6 | function unlinkIfExists(string $filepath): void |
7 | 7 | { |
8 | 8 | if (file_exists($filepath)) { |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | } |
12 | 12 | } |
13 | 13 | |
14 | -if (! function_exists('backupDirectory')) { |
|
14 | +if (!function_exists('backupDirectory')) { |
|
15 | 15 | function backupDirectory(string $directory): void |
16 | 16 | { |
17 | 17 | if (file_exists($directory)) { |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | } |
21 | 21 | } |
22 | 22 | |
23 | -if (! function_exists('restoreDirectory')) { |
|
23 | +if (!function_exists('restoreDirectory')) { |
|
24 | 24 | function restoreDirectory(string $directory): void |
25 | 25 | { |
26 | 26 | if (file_exists($directory.'-bak')) { |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | -if (! function_exists('deleteDirectory')) { |
|
33 | +if (!function_exists('deleteDirectory')) { |
|
34 | 34 | function deleteDirectory(string $directory): void |
35 | 35 | { |
36 | 36 | if (file_exists($directory)) { |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
42 | -if (! function_exists('unlinkUnlessDefault')) { |
|
42 | +if (!function_exists('unlinkUnlessDefault')) { |
|
43 | 43 | function unlinkUnlessDefault(string $filepath): void |
44 | 44 | { |
45 | 45 | $protected = [ |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | '.gitkeep', |
50 | 50 | ]; |
51 | 51 | |
52 | - if (! in_array(basename($filepath), $protected)) { |
|
52 | + if (!in_array(basename($filepath), $protected)) { |
|
53 | 53 | unlink($filepath); |
54 | 54 | } |
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | -if (! function_exists('strip_newlines')) { |
|
58 | +if (!function_exists('strip_newlines')) { |
|
59 | 59 | function strip_newlines(string $string, bool $keepUnixEndings = false): string |
60 | 60 | { |
61 | 61 | if ($keepUnixEndings) { |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
69 | -if (! function_exists('strip_indentation')) { |
|
69 | +if (!function_exists('strip_indentation')) { |
|
70 | 70 | function strip_indentation(string $string, bool $indentUsingSpaces = true, int $indentationLength = 4): string |
71 | 71 | { |
72 | 72 | $indentation = $indentUsingSpaces ? str_repeat(' ', $indentationLength) : "\t"; |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
78 | -if (! function_exists('strip_newlines_and_indentation')) { |
|
78 | +if (!function_exists('strip_newlines_and_indentation')) { |
|
79 | 79 | function strip_newlines_and_indentation(string $string, bool $indentUsingSpaces = true, int $indentationLength = 4): string |
80 | 80 | { |
81 | 81 | return strip_newlines(strip_indentation($string, $indentUsingSpaces, $indentationLength)); |