Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
jlbelanger committed Dec 25, 2023
1 parent fece3b1 commit 432b4ed
Show file tree
Hide file tree
Showing 73 changed files with 2,211 additions and 2,145 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 1
indent_style = tab
insert_final_newline = true
trim_trailing_whitespace = true
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ FRONTEND_URL=http://localhost:3000
ENABLE_CACHE=true

LOG_CHANNEL=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_DEPRECATIONS_CHANNEL=single
LOG_LEVEL=debug
LOG_DATABASE_QUERIES=false

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
php-version: '8.2'
- uses: actions/checkout@v3
- run: composer install
- run: ./vendor/bin/phpcs
Expand Down
4 changes: 2 additions & 2 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Kernel extends ConsoleKernel
* @param Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
protected function schedule(Schedule $schedule) : void
{
}

Expand All @@ -31,7 +31,7 @@ protected function schedule(Schedule $schedule)
*
* @return void
*/
protected function commands()
protected function commands() : void
{
$this->load(__DIR__ . '/Commands');

Expand Down
10 changes: 5 additions & 5 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Handler extends ExceptionHandler
protected $dontReport = [JsonApiException::class];

/**
* A list of the inputs that are never flashed for validation exceptions.
* The list of the inputs that are never flashed to the session on validation exceptions.
*
* @var array<int, string>
*/
Expand All @@ -39,17 +39,17 @@ class Handler extends ExceptionHandler
*
* @return void
*/
public function register()
public function register() : void
{
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found
$this->renderable(function (InvalidSignatureException $e) {
if (!url()->signatureHasNotExpired(request())) {
return response()->json(['errors' => [['title' => __('passwords.expired'), 'status' => '403']]], 403);
}
return response()->json(['errors' => [['title' => __('passwords.token'), 'status' => '403']]], 403);
});

// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found
$this->renderable(function (MethodNotAllowedHttpException $e) {
return response()->json(['errors' => [['title' => 'URL does not exist.', 'status' => '404', 'detail' => 'Method not allowed.']]], 404);
});
Expand All @@ -58,7 +58,7 @@ public function register()
return response()->json(['errors' => [['title' => $e->getMessage() ? $e->getMessage() : 'URL does not exist.', 'status' => '404']]], 404);
});

$this->renderable(function (ThrottleRequestsException $e) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
$this->renderable(function (ThrottleRequestsException $e) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found
return response()->json(['errors' => [['title' => 'Please wait before retrying.', 'status' => '429']]], 429);
});

Expand Down
3 changes: 1 addition & 2 deletions app/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
namespace App\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;

class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
use AuthorizesRequests, ValidatesRequests;
}
12 changes: 7 additions & 5 deletions app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Kernel extends HttpKernel
*/
protected $middleware = [
\App\Http\Middleware\TrustProxies::class,
\Fruitcake\Cors\HandleCors::class,
\Illuminate\Http\Middleware\HandleCors::class,
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
Expand All @@ -35,20 +35,22 @@ class Kernel extends HttpKernel
];

/**
* The application's route middleware.
* The application's middleware aliases.
*
* These middleware may be assigned to groups or used individually.
* Aliases may be used instead of class names to conveniently assign middleware to routes and groups.
*
* @var array<string, class-string|string>
*/
protected $routeMiddleware = [
protected $middlewareAliases = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'precognitive' => \Illuminate\Foundation\Http\Middleware\HandlePrecognitiveRequests::class,
'signed' => \App\Http\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
];
Expand Down
20 changes: 7 additions & 13 deletions app/Http/Middleware/Authenticate.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,22 @@

namespace App\Http\Middleware;

use Closure;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Jlbelanger\Tapioca\Exceptions\JsonApiException;

class Authenticate extends Middleware
{
/**
* Handles an incoming request.
* Handles an unauthenticated user.
*
* @param Request $request
* @param Closure $next
* @param string|null $guard
* @return mixed
* @param Request $request
* @param array $guards
* @return void
*/
public function handle(Request $request, Closure $next, $guard = null)
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassAfterLastUsed, Squiz.Commenting.FunctionComment.TypeHintMissing
protected function unauthenticated($request, array $guards)
{
if (!Auth::guard($guard)->check()) {
throw JsonApiException::generate([['title' => 'You are not logged in.', 'status' => '401']], 401);
}

return $next($request);
throw JsonApiException::generate([['title' => 'You are not logged in.', 'status' => '401']], 401);
}
}
5 changes: 3 additions & 2 deletions app/Http/Middleware/RedirectIfAuthenticated.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Symfony\Component\HttpFoundation\Response;

class RedirectIfAuthenticated
{
Expand All @@ -15,9 +16,9 @@ class RedirectIfAuthenticated
* @param Request $request
* @param Closure $next
* @param string|null ...$guards
* @return Response|RedirectResponse
* @return Response
*/
public function handle(Request $request, Closure $next, ...$guards)
public function handle(Request $request, Closure $next, string ...$guards) : Response
{
$guards = empty($guards) ? [null] : $guards;

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Middleware/TrustHosts.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class TrustHosts extends Middleware
*
* @return array<int, string|null>
*/
public function hosts()
public function hosts() : array
{
return [
$this->allSubdomainsOfApplicationUrl(),
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Middleware/TrustProxies.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ class TrustProxies extends Middleware
*
* @var integer
*/
protected $headers = Request::HEADER_X_FORWARDED_ALL;
protected $headers = Request::HEADER_X_FORWARDED_FOR;
}
15 changes: 15 additions & 0 deletions app/Http/Middleware/ValidateSignature.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace App\Http\Middleware;

use Illuminate\Routing\Middleware\ValidateSignature as Middleware;

class ValidateSignature extends Middleware
{
/**
* The names of the query string parameters that should be ignored.
*
* @var array<int, string>
*/
protected $except = [];
}
2 changes: 1 addition & 1 deletion app/Models/Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Entry extends Model
];

/**
* The attributes that should be cast to native types.
* The attributes that should be cast.
*
* @var array<string, string>
*/
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Extra.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class Extra extends Model
];

/**
* The attributes that should be cast to native types.
* The attributes that should be cast.
*
* @var array<string, string>
*/
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Food.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class Food extends Model
];

/**
* The attributes that should be cast to native types.
* The attributes that should be cast.
*
* @var array<string, string>
*/
Expand Down
2 changes: 1 addition & 1 deletion app/Models/FoodMeal.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class FoodMeal extends Model
];

/**
* The attributes that should be cast to native types.
* The attributes that should be cast.
*
* @var array<string, string>
*/
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Meal.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Meal extends Model
];

/**
* The attributes that should be cast to native types.
* The attributes that should be cast.
*
* @var array<string, string>
*/
Expand Down
2 changes: 1 addition & 1 deletion app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class User extends Authenticatable implements MustVerifyEmail
];

/**
* The attributes that should be cast to native types.
* The attributes that should be cast.
*
* @var array<string, string>
*/
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Weight.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Weight extends Model
];

/**
* The attributes that should be cast to native types.
* The attributes that should be cast.
*
* @var array<string, string>
*/
Expand Down
38 changes: 20 additions & 18 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class AppServiceProvider extends ServiceProvider
*
* @return void
*/
public function register()
public function register() : void
{
}

Expand All @@ -28,25 +28,27 @@ public function register()
* @param Kernel $kernel
* @return void
*/
public function boot(Kernel $kernel)
public function boot(Kernel $kernel) : void
{
if (config('logging.database')) {
DB::listen(function ($q) {
$trace = debug_backtrace();
$source = null;
foreach ($trace as $t) {
if (!empty($t['file']) && strpos($t['file'], '/vendor/') === false) {
$source = $t['file'] . ':' . $t['line'];
break;
if (config('app.debug')) {
if (config('logging.database')) {
DB::listen(function ($q) {
$trace = debug_backtrace();
$source = null;
foreach ($trace as $t) {
if (!empty($t['file']) && strpos($t['file'], '/vendor/') === false) {
$source = $t['file'] . ':' . $t['line'];
break;
}
}
}
Log::channel('database')->info(json_encode([
'ms' => $q->time,
'q' => $q->sql,
'bindings' => $q->bindings,
'source' => $source,
]));
});
Log::channel('database')->info(json_encode([
'ms' => $q->time,
'q' => $q->sql,
'bindings' => $q->bindings,
'source' => $source,
]));
});
}
}

if ($this->app->environment() !== 'local') {
Expand Down
8 changes: 4 additions & 4 deletions app/Providers/AuthServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
* The model to policy mappings for the application.
*
* @var array<class-string, class-string>
*/
Expand All @@ -25,11 +25,11 @@ class AuthServiceProvider extends ServiceProvider
*
* @return void
*/
public function boot()
public function boot() : void
{
$this->registerPolicies();

// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
ResetPassword::toMailUsing(function ($notifiable, $token) {
$url = config('app.frontend_url') . str_replace('/auth/', '/', URL::temporarySignedRoute(
'password.update',
Expand All @@ -45,7 +45,7 @@ public function boot()
->line('If you did not request a password reset, no further action is required.');
});

// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
VerifyEmail::toMailUsing(function ($notifiable, $url) {
return (new MailMessage)
->subject('[' . config('app.name') . '] Verify Email Address')
Expand Down
2 changes: 1 addition & 1 deletion app/Providers/BroadcastServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class BroadcastServiceProvider extends ServiceProvider
*
* @return void
*/
public function boot()
public function boot() : void
{
Broadcast::routes();

Expand Down
4 changes: 2 additions & 2 deletions app/Providers/EventServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
* The event to listener mappings for the application.
*
* @var array<class-string, array<int, class-string>>
*/
Expand All @@ -24,7 +24,7 @@ class EventServiceProvider extends ServiceProvider
*
* @return void
*/
public function boot()
public function boot() : void
{
}
}
Loading

0 comments on commit 432b4ed

Please sign in to comment.