Last active
March 9, 2018 16:36
-
-
Save taylorotwell/ee2f782aec59aa53863fd09c8e47f304 to your computer and use it in GitHub Desktop.
This file contains 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 Decorator | |
{ | |
public function __construct($target) | |
{ | |
$this->target = $target; | |
} | |
public function __call($method, $parameters) | |
{ | |
return $this->target->{$method}(...$parameters); | |
} | |
} | |
class Target | |
{ | |
} | |
class Consumer | |
{ | |
public function doesWork(Target $target) | |
{ | |
}; | |
} | |
// Doesn't work becuase type-hints are a waste of time and lead to poorly coded, brittle systems... :) | |
$consumer->doesWork(new Decorator(new Target)); | |
// Doesn't work becuase type-hints are a waste of time and lead to poorly coded, brittle systems... :)
I'm just gonna grammar nazi this and point out that "becuase" is spelled wrong.
Also, you seem to have misspelled "type-hints" as that is not how you spell "idiots" ;-)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@nicholasruunu that's already provided by the userland library mentioned above