Experience a new cycle after death
-
-
-
-
-
-
-
-
📂 Journal
The Internet Archive / Wayback Machine (http://web.archive.org/) is absolutely incredible. It has saved most of my old posts and pages. Been spending a week or so rescuing those posts and bringing them back.
-
📂 Journal
Was nice to finally meet most of the jump24 crew in the flesh last night. Even if I did come second to last in bowling. 😅 @jumptwenty4
-
📂 Journal
-
PHP Psalm warning for RouteServiceProvider configureRateLimiting method
When running psalm in a Laravel project, I get the following error by default:
PossiblyNullArgument - app/Providers/RouteServiceProvider.php:45:46 - Argument 1 of Illuminate\Cache\RateLimiting\Limit::by cannot be null, possibly null value provided
This is the default implementation for
configureRateLimiting
in theRouteServiceProvider
class in Laravel:protected function configureRateLimiting() { RateLimiter::for('api', function (Request $request) { return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()); }); }
I change it to the following to get psalm to pass (I’ve added named parameters and the
static
keyword before the callback function):protected function configureRateLimiting() { RateLimiter::for(name: 'api', callback: static function (Request $request) { $limitIdentifier = $request->user()?->id ?: $request->ip(); if (!is_null($limitIdentifier)) { return Limit::perMinute(maxAttempts: 60)->by(key: $limitIdentifier); } }); }
🏷️ PHP
-
📂 Journal
Really enjoyed this write-up. I’m trying to approach my own website like a personal commonplace book and digital garden now.
-
📂 Journal
Been taking a few shots in Red Dead Redemption 2 recently. Will share them out very soon.
-