Elektrine lite

← Feed

@asgrim@phpc.social

2026-07-23 17:10 UTC

Blogged! A quick tip about using generics + class-string - https://www.jamestitcumb.com/posts/generics-template-class-string

Replies (2)

  • @TheCodeLorax@tech.lgbt 2026-07-23 18:28

    @asgrim@phpc.social Let me tell you about Monomorphized Generics… (coming in 9.0) https://eventuallywrong.com/php9/generics

    Open ##4142803

  • @beberlei@phpc.social 2026-07-27 22:24

    @asgrim@phpc.social Just realized from your post that generics in PHP still leave class-string type open. Its not a type. So your example still needs docblock annotations even if we had (Reified) Generics RFC. $thing = createMockOf::(SomeInterface::class); would be super cringe. How could we think this is a better solution than phpstan docblocks? :)

    Open ##5461749