Last active
August 29, 2015 14:16
-
-
Save ronan-gloo/79e0d1b6ec1e5b96a100 to your computer and use it in GitHub Desktop.
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 | |
interface Adapter | |
{ | |
public function init($required); | |
} | |
// Warning: caller will pass 2 argument | |
class NotOk implements Adapter | |
{ | |
public function init($required){} | |
} | |
// Ok: caller will pass 2 argument | |
class Ok implememts Adapter | |
{ | |
public function init($required, $optionnal = null){} | |
} | |
class Caller | |
{ | |
public function __construct(Adapter $adapter) | |
{ | |
$adapter->init($this, __CLASS__); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment