generated from yiisoft/package-template
/
DefinitionInterface.php
32 lines (28 loc) · 1.07 KB
/
DefinitionInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
declare(strict_types=1);
namespace Yiisoft\Definitions\Contract;
use Psr\Container\ContainerInterface;
use Yiisoft\Definitions\Exception\CircularReferenceException;
use Yiisoft\Definitions\Exception\InvalidConfigException;
use Yiisoft\Definitions\Exception\NotFoundException;
use Yiisoft\Definitions\Exception\NotInstantiableException;
/**
* Definition is describing a way to create and configure a service or an object.
*/
interface DefinitionInterface
{
/**
* Resolve this definition.
*
* @throws InvalidConfigException If an object of incorrect type was created.
* @throws CircularReferenceException If there is a circular reference detected
* when resolving the definition.
* @throws NotFoundException If container does not know how to resolve
* the definition.
* @throws NotInstantiableException If an object can not be instantiated.
*
* @return mixed|null Ready to use object or null if definition can
* not be resolved and is marked as optional.
*/
public function resolve(ContainerInterface $container);
}