Skip to content

Instantly share code, notes, and snippets.

@markrandall
Created April 7, 2021 01:15
Show Gist options
  • Save markrandall/e9521e15bc3b68b70192c0d29ebe6ff6 to your computer and use it in GitHub Desktop.
Save markrandall/e9521e15bc3b68b70192c0d29ebe6ff6 to your computer and use it in GitHub Desktop.
class SomeClassThatIsntAServiceButNeedsLotsOfThem {
public function __construct(ServiceA, $a, ServiceB $b, ServiceC $c, ServiceD $d, SomeCustomData $data) {
}
}
class SomeService {
public function __construct(private ServiceA, $a, private ServiceB $b, private ServiceC $c, private ServiceD $d) {
}
public function doSomething() {
$foo = new SomeClassThatIsntAServiceButNeedsLotsOfThem(
$this->serviceA,
$this->serviceB,
$this->serviceC,
$this->serviceD,
new SomeCustomData(...)
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment