Replies: 2 comments 1 reply
-
No one else has this question or perhaps at least no one has another solution? |
Beta Was this translation helpful? Give feedback.
0 replies
-
Well what I usually do is extend the App class, register the dependencies and add the docblocks namespace YourProject;
/**
* @property-read \Your\Dependency $myDependency
*/
final class App extends \Leaf\App
{
final public function run(
?callable = $callback
) {
$this->register(
'myDependency',
function () {
return new \Your\Dependency(/*...*/);
}
);
parent::run($callback);
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Does anyone have a suggestion on how to improve intellisense for things we add to the Dependency Injection container? So far the only thing I've thought to do is piggyback on the functional mode aspect and create extremely simple functions that just return the corresponding "service" and use a DocBlock to specify the return type of the function.
Is there any other way to do this aside from having to constantly store the dependency into a temporary variable with an @var DocBlock comment everywhere I use it?
Beta Was this translation helpful? Give feedback.
All reactions