Constructors cannot declare a return type¶
Description¶
There can be no return type for a constructor method. It is called while creating a new instance of an object, but it doesn’t return the object itself. This is the case even if $this is available in the method.
Example¶
<?php
class X {
function __construct() : int {
}
}
?>
Solutions¶
Remove the return type of the method.