Skip to content

Instantly share code, notes, and snippets.

@ronan-gloo
Last active August 29, 2015 14:16
Show Gist options
  • Save ronan-gloo/79e0d1b6ec1e5b96a100 to your computer and use it in GitHub Desktop.
Save ronan-gloo/79e0d1b6ec1e5b96a100 to your computer and use it in GitHub Desktop.
<?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