RSSAmplifier

Mountain Of Code · Jul 10, 2026

Strict Collection Creation

0
Sign in to vote or save

This page cannot be shown here. You can still read it on the original site — the toolbar below keeps your place in the directory.

I like to write strictly typed PHP, or at least as much as possible. Primarily this boils down to using PHPStan . One aspect where I find this challenging is Laravel Collections . Specifically creating single-type Collections. For example, a WidgetCollection should guarantee that the collection only ever contains instances of Widget : /** @extends \Illuminate\Support\Collection< Widget > */ class…

Read on /strict-collection-creation

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.