Why Class Constants Should be Typed

Written by Tomáš Votruba / Original link on Jun. 22, 2020

Do you use PHP 7.4 [typed properties](/blog/2018/11/15/how-to-get-php-74-typed-properties-to-your-code-in-few-seconds/)? Do you know why? I use them, so **I don't have to think and validate the property type** every time. We just know its the type or PHP would crash otherwise. Until PHP 7.4 this was not possible and code was kinda crappy. Where are we now with constant type? Do you trust your class constants type?


« How and When to Extract Component Logic - Social Networking Website Based in Laravel »