<commit_before># Auto Dependency Resolution #

After registering an item, if the constructor requires arguments that haven't been specified through injection, the
depository will construct the necessary dependencies based on type hints and default values. This will account for
nested dependencies as well.

```hack
$container->register('foo', 'Foo');

$foo = $container->make('foo')->getBar()->getName(); // <NAME>

class Foo()
{
    private $bar;

    public function __construct(Bar $bar)
    {
        $this->bar = $bar;
    }

    public function getBar()
    {
        return $this->bar;
    }
}

class Bar
{
    private $name;

    public function __construct($name = '<NAME>')
    {
        $this->name = $name;
    }

    public function getName()
    {
        return $this->name;
    }
}
```

## Non-registered Items ##

You can also us the depository to resolve classes and callables that have not been registered and the depository will auto-resolve any necessary dependencies.

```hack
$container->make('Foo');

class Foo
{
    private $name;

    public function __construct($name = '<NAME>')
    {
        $this->name = $name;
    }
}
```

This will work on Closures as well:

```hack
$$bar = $container->make(function(Foo $foo) {
    return $foo->getBar();
});<commit_msg>updated docs for how to resolve Closures<commit_after># Auto Dependency Resolution #

After registering an item, if the constructor requires arguments that haven't been specified through injection, the
depository will construct the necessary dependencies based on type hints and default values. This will account for
nested dependencies as well.

```hack
$container->register('foo', 'Foo');

$foo = $container->make('foo')->getBar()->getName(); // <NAME>

class Foo()
{
    private $bar;

    public function __construct(Bar $bar)
    {
        $this->bar = $bar;
    }

    public function getBar()
    {
        return $this->bar;
    }
}

class Bar
{
    private $name;

    public function __construct($name = '<NAME>')
    {
        $this->name = $name;
    }

    public function getName()
    {
        return $this->name;
    }
}
```

## Non-registered Items ##

You can also us the depository to resolve classes and callables that have not been registered and the depository will auto-resolve any necessary dependencies.

```hack
$container->make('Foo');

class Foo
{
    private $name;

    public function __construct($name = '<NAME>')
    {
        $this->name = $name;
    }
}
```

Resolving Closures are done by calling `run` on the depository:

```hack
$$bar = $container->call(function(Foo $foo) {
    return $foo->getBar();
});
{'fraction_non_alphanumeric': 0.12761109001139384, 'fraction_numerical': 0.0, 'mean_word_length': 3.194267515923567, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4036354', 'n_tokens_mistral': 799, 'n_tokens_neox': 750, 'n_words': 265}