Skip to content

Commit

Permalink
Added psalm typehints to create function
Browse files Browse the repository at this point in the history
  • Loading branch information
cseufert authored Nov 9, 2021
1 parent 4c2c97c commit 08dce70
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Dice.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,17 @@ public function getRule(string $name): array

/**
* Returns a fully constructed object based on $name using $args and $share as constructor arguments if supplied
* @param string name The name of the class to instantiate
* @template T
* @param string $name The name of the class to instantiate
* @psalm-param class-string<T> $name
* @param array $args An array with any additional arguments to be passed into the constructor upon instantiation
* @param array $share a list of defined in shareInstances for objects higher up the object graph, should only be used internally
* @return object A fully constructed object based on the specified input arguments
* @psalm-return T
*/

public function create(string $name, array $args = [], array $share = [])
{
// Is there a shared instance set? Return it. Better here than a closure for this, calling a closure is slower.
Expand Down

0 comments on commit 08dce70

Please sign in to comment.