Created
June 12, 2018 16:13
-
-
Save lividgreen/ff877fcd0b853844a7a943956f57592e 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 WithButter { | |
} | |
interface WithHam { | |
} | |
class Bread { | |
public function withButter() { | |
return new class extends self implements WithButter {} | |
} | |
public function withHam() { | |
return new class extends self implements WithHam {} | |
} | |
} | |
class Me { | |
function eat(WithButter $goodFood) {...} | |
} | |
$i = new Me(); | |
$i->eat(new Bread()->withButter()->withHam()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment