Skip to content

Commit

Permalink
Use "generics" for return types
Browse files Browse the repository at this point in the history
  • Loading branch information
freost committed Dec 28, 2024
1 parent 439794b commit f2a4054
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/mako/syringe/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,10 @@ public function isSingleton(string $class): bool

/**
* Returns a class instance.
*
* @template T of object
* @param class-string<T> $class
* @return T
*/
public function get(string $class, array $parameters = [], bool $reuseInstance = true): object
{
Expand Down Expand Up @@ -499,6 +503,10 @@ public function get(string $class, array $parameters = [], bool $reuseInstance =

/**
* Returns a fresh class instance even if the class is registered as a singleton.
*
* @template T of object
* @param class-string<T> $class
* @return T
*/
public function getFresh(string $class, array $parameters = []): object
{
Expand Down

0 comments on commit f2a4054

Please sign in to comment.