area17 / twill

Twill is an open source CMS toolkit for Laravel that helps developers rapidly create a custom admin console that is intuitive, powerful and flexible. Chat with us on Discord at https://discord.gg/cnWk7EFv8R.
https://twillcms.com
Apache License 2.0
3.77k stars 576 forks source link

Add type declaration to helpers #2512

Open Tofandel opened 8 months ago

Tofandel commented 8 months ago

This is just starting the process of adding type declarations, started with the helpers because it's the ones we can do in v3 without any breaking changes (because passing any type differently would already result in fatal errors)

Also added some small perf improvement by using ->all() instead of ->toArray() (the latter being more expensive because of a map) or completely keeping them as collections which are iterable, there will be more to come, but just a few obvious one

I also added real deprecation messages to deprecated helpers

I also replaced the namespace of larastan which has moved to https://github.com/larastan/larastan (the old one is abandonned)

Not in this PR, but I'd also like to eventually deprecate all helper methods except really vital ones (like twillTrans) and move them to namespaced helper classes with facade instead to avoid polluting the global namespace