With version 7, PHP introduced scalar types, types with null values, and return types. Using these functions is immediately useful (self-executing code, fatal errors at runtime, the list goes on), but I'm not sure at what point in my code I should start using them. I believe the answer should be "as soon as possible."
Prior to PHP 7, a lot of my code looks like an example class. My controller initializes the class and passes POST variables to it. Then I will pass the type variable in the class to make sure that all the vars are correct.
class User {
public function createUser($username, $password, $some_float)
{
}
}
With PHP 7 I can do it
class User {
public function createUser(string $username, string $password, float $some_float)
{
}
}
, User . .