Skip to content
Advertisement

Tag: php-8

How to specify the void return type for a constructor

For consistency I’m specifying return types since PHP 7.1, for all methods, including magic ones like __toString, and even when the implicit return type is void like with __unserialize(): When I try the same for constructors and destructors, like this: PHP yields Fatal errors: The only thing I can do right now is to specify the implicit return type in

Advertisement