@@ -112,7 +112,7 @@ |
||
112 | 112 | /** @return array<class-string<\Hyde\Framework\Features\BuildTasks\PreBuildTask>|class-string<\Hyde\Framework\Features\BuildTasks\PostBuildTask>> */ |
113 | 113 | protected function findTasksInAppDirectory(): array |
114 | 114 | { |
115 | - return Filesystem::smartGlob('app/Actions/*BuildTask.php')->map(function (string $file): string { |
|
115 | + return Filesystem::smartGlob('app/Actions/*BuildTask.php')->map(function(string $file): string { |
|
116 | 116 | return static::pathToClassName($file); |
117 | 117 | })->toArray(); |
118 | 118 | } |
@@ -57,7 +57,7 @@ |
||
57 | 57 | |
58 | 58 | protected static function validated(mixed $value, string $type, string $key): mixed |
59 | 59 | { |
60 | - if (! call_user_func("is_$type", $value)) { |
|
60 | + if (!call_user_func("is_$type", $value)) { |
|
61 | 61 | throw new TypeError(sprintf('%s(): Config value %s must be of type %s, %s given', __METHOD__, $key, $type, gettype($value))); |
62 | 62 | } |
63 | 63 |
@@ -215,7 +215,7 @@ |
||
215 | 215 | { |
216 | 216 | $storagePath = Hyde::mediaPath($this->source); |
217 | 217 | |
218 | - if (! file_exists($storagePath)) { |
|
218 | + if (!file_exists($storagePath)) { |
|
219 | 219 | throw new FileNotFoundException(customMessage: sprintf('Featured image [%s] not found.', Hyde::pathToRelative($storagePath))); |
220 | 220 | } |
221 | 221 |
@@ -35,6 +35,6 @@ |
||
35 | 35 | |
36 | 36 | public function showInNavigation(): bool |
37 | 37 | { |
38 | - return ! in_array($this->type->getDirectory(), Config::getArray('hyde.navigation.exclude', [])); |
|
38 | + return !in_array($this->type->getDirectory(), Config::getArray('hyde.navigation.exclude', [])); |
|
39 | 39 | } |
40 | 40 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | |
128 | 128 | private function isNonDocumentationPageInHiddenSubdirectory(): bool |
129 | 129 | { |
130 | - return ! $this->isInstanceOf(DocumentationPage::class) |
|
130 | + return !$this->isInstanceOf(DocumentationPage::class) |
|
131 | 131 | && $this->pageIsInSubdirectory() |
132 | 132 | && $this->getSubdirectoryConfiguration() === 'hidden' |
133 | 133 | && basename($this->identifier) !== 'index'; |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $pageKey = $this->{$pageKeyName}; |
189 | 189 | |
190 | 190 | // Check if the config entry is a flat array or a keyed array. |
191 | - if (! array_key_exists($pageKey, $config)) { |
|
191 | + if (!array_key_exists($pageKey, $config)) { |
|
192 | 192 | // Adding an offset makes so that pages with a front matter priority, or |
193 | 193 | // explicit keyed priority selection that is lower can be shown first. |
194 | 194 | // This is all to make it easier to mix ways of adding priorities. |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | |
237 | 237 | protected function invert(?bool $value): ?bool |
238 | 238 | { |
239 | - return $value === null ? null : ! $value; |
|
239 | + return $value === null ? null : !$value; |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | protected function offset(?int $value, int $offset): ?int |
@@ -8,13 +8,13 @@ discard block |
||
8 | 8 | |
9 | 9 | uses(\Hyde\Testing\UnitTestCase::class); |
10 | 10 | |
11 | -beforeEach(function () { |
|
11 | +beforeEach(function() { |
|
12 | 12 | renderUsing($this->output = new BufferedOutput()); |
13 | 13 | |
14 | 14 | $this::mockConfig(); |
15 | 15 | }); |
16 | 16 | |
17 | -afterEach(function () { |
|
17 | +afterEach(function() { |
|
18 | 18 | renderUsing(null); |
19 | 19 | |
20 | 20 | Styles::flush(); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | HydeKernel::setInstance(new HydeKernel()); |
23 | 23 | }); |
24 | 24 | |
25 | -test('printStartMessage method', function () { |
|
25 | +test('printStartMessage method', function() { |
|
26 | 26 | HydeKernel::setInstance(new class extends HydeKernel |
27 | 27 | { |
28 | 28 | public static function version(): string |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | $lineLength = max(array_map('strlen', array_map('strip_tags', $lines))); |
42 | 42 | |
43 | - $lines = array_map(function (string $line) use ($lineLength): string { |
|
43 | + $lines = array_map(function(string $line) use ($lineLength): string { |
|
44 | 44 | return sprintf(' │ <span class="text-white">%s</span>%s│', |
45 | 45 | $line, str_repeat(' ', ($lineLength - strlen(strip_tags($line))) + 1) |
46 | 46 | ); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | public function getFormatter(): Closure |
58 | 58 | { |
59 | - return function (string $type, string $line): void { |
|
59 | + return function(string $type, string $line): void { |
|
60 | 60 | $this->handleOutput($line); |
61 | 61 | }; |
62 | 62 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | protected function handleOutput(string $buffer): void |
71 | 71 | { |
72 | - str($buffer)->trim()->explode("\n")->each(function (string $line): void { |
|
72 | + str($buffer)->trim()->explode("\n")->each(function(string $line): void { |
|
73 | 73 | $this->renderLine($this->formatLineForOutput($line)); |
74 | 74 | }); |
75 | 75 | } |
@@ -62,12 +62,12 @@ |
||
62 | 62 | |
63 | 63 | protected function authorizePostRequest(): void |
64 | 64 | { |
65 | - if (! $this->isRequestMadeFromLocalhost()) { |
|
65 | + if (!$this->isRequestMadeFromLocalhost()) { |
|
66 | 66 | throw new HttpException(403, "Refusing to serve request from address {$_SERVER['REMOTE_ADDR']} (must be on localhost)"); |
67 | 67 | } |
68 | 68 | |
69 | 69 | if ($this->withSession) { |
70 | - if (! $this->validateCSRFToken($this->request->get('_token'))) { |
|
70 | + if (!$this->validateCSRFToken($this->request->get('_token'))) { |
|
71 | 71 | throw new HttpException(403, 'Invalid CSRF token'); |
72 | 72 | } |
73 | 73 | } |
@@ -11,17 +11,17 @@ discard block |
||
11 | 11 | |
12 | 12 | define('BASE_PATH', realpath(__DIR__.'/../../../')); |
13 | 13 | |
14 | -if (BASE_PATH === false || ! file_exists(BASE_PATH.'/hyde')) { |
|
14 | +if (BASE_PATH === false || !file_exists(BASE_PATH.'/hyde')) { |
|
15 | 15 | throw new InvalidArgumentException('This test suite must be run from the root of the hydephp/develop monorepo.'); |
16 | 16 | } |
17 | 17 | |
18 | 18 | ob_start(); |
19 | 19 | |
20 | -beforeEach(function () { |
|
20 | +beforeEach(function() { |
|
21 | 21 | putenv('SERVER_LIVE_EDIT=false'); |
22 | 22 | }); |
23 | 23 | |
24 | -test('handle routes index page', function () { |
|
24 | +test('handle routes index page', function() { |
|
25 | 25 | putenv('SERVER_DASHBOARD=false'); |
26 | 26 | mockRoute(''); |
27 | 27 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | Filesystem::unlink('_site/index.html'); |
41 | 41 | }); |
42 | 42 | |
43 | -test('handle routes custom pages', function () { |
|
43 | +test('handle routes custom pages', function() { |
|
44 | 44 | mockRoute('foo'); |
45 | 45 | |
46 | 46 | Filesystem::put('_pages/foo.md', '# Hello World!'); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | Filesystem::unlink('_site/foo.html'); |
59 | 59 | }); |
60 | 60 | |
61 | -test('handle routes pages with .html extension', function () { |
|
61 | +test('handle routes pages with .html extension', function() { |
|
62 | 62 | mockRoute('foo.html'); |
63 | 63 | |
64 | 64 | Filesystem::put('_pages/foo.md', '# Hello World!'); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | Filesystem::unlink('_site/foo.html'); |
77 | 77 | }); |
78 | 78 | |
79 | -test('handle routes static assets', function () { |
|
79 | +test('handle routes static assets', function() { |
|
80 | 80 | mockRoute('media/app.css'); |
81 | 81 | |
82 | 82 | $kernel = new HttpKernel(); |
@@ -89,14 +89,14 @@ discard block |
||
89 | 89 | expect($response->body)->toBe(file_get_contents(\Hyde\Hyde::path('_media/app.css'))); |
90 | 90 | }); |
91 | 91 | |
92 | -test('handle throws route not found exception for missing route', function () { |
|
92 | +test('handle throws route not found exception for missing route', function() { |
|
93 | 93 | mockRoute('missing'); |
94 | 94 | |
95 | 95 | $kernel = new HttpKernel(); |
96 | 96 | $kernel->handle(new Request()); |
97 | 97 | })->throws(RouteNotFoundException::class, 'Route [missing] not found'); |
98 | 98 | |
99 | -test('handle sends 404 error response for missing asset', function () { |
|
99 | +test('handle sends 404 error response for missing asset', function() { |
|
100 | 100 | mockRoute('missing.css'); |
101 | 101 | |
102 | 102 | $kernel = new HttpKernel(); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | // Filesystem::unlink('_site/foo.html'); |
128 | 128 | //})->skip('Underlying framework does not buffer headers (yet)'); |
129 | 129 | |
130 | -test('trailing slashes are normalized from route', function () { |
|
130 | +test('trailing slashes are normalized from route', function() { |
|
131 | 131 | mockRoute('foo/'); |
132 | 132 | |
133 | 133 | Filesystem::put('_pages/foo.md', '# Hello World!'); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | Filesystem::unlink('_site/foo.html'); |
146 | 146 | }); |
147 | 147 | |
148 | -test('docs uri path is rerouted to docs/index', function () { |
|
148 | +test('docs uri path is rerouted to docs/index', function() { |
|
149 | 149 | mockRoute('docs'); |
150 | 150 | |
151 | 151 | Filesystem::put('_docs/index.md', '# Hello World!'); |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | Filesystem::unlink('_site/docs/index.html'); |
164 | 164 | }); |
165 | 165 | |
166 | -test('docs/search renders search page', function () { |
|
166 | +test('docs/search renders search page', function() { |
|
167 | 167 | mockRoute('docs/search'); |
168 | 168 | |
169 | 169 | $kernel = new HttpKernel(); |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | Filesystem::unlink('_site/docs/search.html'); |
179 | 179 | }); |
180 | 180 | |
181 | -test('ping route returns ping response', function () { |
|
181 | +test('ping route returns ping response', function() { |
|
182 | 182 | mockRoute('ping'); |
183 | 183 | |
184 | 184 | $kernel = new HttpKernel(); |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | ->and($response->statusMessage)->toBe('OK'); |
190 | 190 | }); |
191 | 191 | |
192 | -test('exception handling', function () { |
|
192 | +test('exception handling', function() { |
|
193 | 193 | $exception = new Exception('foo'); |
194 | 194 | $response = ExceptionHandler::handle($exception); |
195 | 195 |