Skip to content

Commit 825ba97

Browse files
committed
fix: switch to PHP 8 syntax cos why not 😭
1 parent ea6b8bc commit 825ba97

3 files changed

Lines changed: 4 additions & 12 deletions

File tree

src/themes/api/routes/_app.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
<?php
22

3-
app()->get('/', function () {
4-
response()->json(['message' => 'Congrats!! You\'re on Leaf MVC']);
5-
});
3+
app()->get('/', fn () => response()->json(['message' => 'Congrats!! You\'re on Leaf MVC']));

src/themes/api/routes/index.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
| you set will be called when a 404 error is encountered
1111
|
1212
*/
13-
app()->set404(function () {
14-
response()->json('Resource not found', 404, true);
15-
});
13+
app()->set404(fn () => response()->json('Resource not found', 404, true));
1614

1715
/*
1816
|--------------------------------------------------------------------------
@@ -24,9 +22,7 @@
2422
| you set will be called when a 500 error is encountered
2523
|
2624
*/
27-
app()->setErrorHandler(function () {
28-
response()->json('An error occured, our team has been notified', 500, true);
29-
});
25+
app()->setErrorHandler(fn () => response()->json('An error occured, our team has been notified', 500, true));
3026

3127
/*
3228
|--------------------------------------------------------------------------

src/themes/leaf3/index.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
require __DIR__ . '/vendor/autoload.php';
44

5-
app()->get('/', function () {
6-
response()->page('./welcome.html');
7-
});
5+
app()->get('/', fn () => response()->page('./welcome.html'));
86

97
app()->run();

0 commit comments

Comments
 (0)