This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class User {} | |
function getUserWrong() : User { | |
return []; | |
} | |
getUserWrong(); | |
// PHP Warning: Uncaught TypeError: Return value of getUserWrong() must be an instance of User, array returned |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class User {} | |
interface UserFactoryContract { | |
public static function generate() : User; | |
} | |
class UserFactory implements UserFactoryContract { | |
public static function generate() { |
OlderNewer