1
0
Fork 0
mirror of https://github.com/archtechx/laravel-tips.git synced 2025-12-12 05:14:04 +00:00
laravel-tips/content/tips/you-can-use-generic-class-string-annotations-to-hint-that-an-instance-of-the-passed-class-is-returned.md
2022-01-07 18:37:55 +01:00

720 B

title tweet_id thread_slug author_username images created_at slug
You can use generic class-string annotations to hint that an instance of the passed class is returned 1479467944581033986 weekly-thread-2022-01 freekmurze
https://pbs.twimg.com/media/FIN1v4NWUAARbol.jpg
2022-01-07T15:00:19+00:00 you-can-use-generic-class-string-annotations-to-hint-that-an-instance-of-the-passed-class-is-returned

This is how you can hint that a function returns an instance of the class of which you passed the class name.

Cool stuff!

Hat tip to @enunomaduro

7fa88922aa/src/PendingRoutes/PendingRouteAction.php (L100-L107)