generated from yiisoft/package-template
-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
DefinitionInterface.php
29 lines (25 loc) · 1.06 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
<?php
declare(strict_types=1);
namespace Yiisoft\Definitions\Contract;
use Psr\Container\ContainerInterface;
use Psr\Container\NotFoundExceptionInterface;
use Yiisoft\Definitions\Exception\CircularReferenceException;
use Yiisoft\Definitions\Exception\InvalidConfigException;
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 NotFoundExceptionInterface 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): mixed;
}