Say, I have a class with consts like so,
class Car
   {
      // Types
      const TYPE_SALOON = "Saloon";
      const TYPE_HATCHBACK = "Hatchback";
      ...
     public static function validTypes() {
          return array(
             static::TYPE_SALOON,
             static::TYPE_HATCHBACK,
             ...
          );
      }
 }
I need the constructor to accept an input argument called type, which exits in the array returned by validTypes(). The way I'd normally do this is:
function __construct($type, ...) {
    if(!in_array($type, static::validTypes())) {
        // Throw Exception
    }
}
What's a more elegant way to do this?
Is there a way to do this with typeHinting?
