Replied to

100% couldn’t agree more with this. Well put.

Liked

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 the RouteServiceProvider 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);
            }
        });
    }
Replied to https://boffosocko.com/2021/07/03/differentiating-online-variations-of-the-commonplace-book-digital-gardens-wikis-zettlekasten-waste-books-florilegia-and-second-brains/ (boffosocko.com)
Most significant thinkers, writers, and creators throughout history have kept something resembling a commonplace book. While many may want to attribute the output of historical figures like Erasmus, Newton, Darwin, Leibnitz, Locke, or Emerson to sheer genius (and many often do), I might suggest that their works were the result of sustained work of creating personal commonplace books...

Really enjoyed this write-up. I’m trying to approach my own website like a personal commonplace book and digital garden now.