diff --git a/composer.json b/composer.json index 7079814..71ec7f8 100644 --- a/composer.json +++ b/composer.json @@ -10,6 +10,7 @@ } }, "require": { + "php": ">= 8.0.0", "psr/container": "^1.0 || ^2.0" } } diff --git a/src/ExtensionDefinitionInterface.php b/src/ExtensionDefinitionInterface.php new file mode 100644 index 0000000..54a1faf --- /dev/null +++ b/src/ExtensionDefinitionInterface.php @@ -0,0 +1,21 @@ + map where entry ID => list of dependency IDs + */ + public function getDependencies(): array; +} diff --git a/src/ServiceProviderInterface.php b/src/ServiceProviderInterface.php index 6d2d536..ccb31a5 100644 --- a/src/ServiceProviderInterface.php +++ b/src/ServiceProviderInterface.php @@ -2,6 +2,8 @@ namespace Interop\Container; +use Psr\Container\ContainerInterface; + /** * A service provider provides entries to a container. */ @@ -13,12 +15,13 @@ interface ServiceProviderInterface * - the key is the entry name * - the value is a callable that will return the entry, aka the **factory** * - * Factories have the following signature: - * function(\Psr\Container\ContainerInterface $container) + * A factory is an instance of {@see FactoryDefinitionInterface}, or a `callable` with the following signature: + * + * function(\Psr\Container\ContainerInterface $container) * - * @return callable[] + * @return array */ - public function getFactories(); + public function getFactories(): array; /** * Returns a list of all container entries extended by this service provider. @@ -26,7 +29,8 @@ public function getFactories(); * - the key is the entry name * - the value is a callable that will return the modified entry * - * Callables have the following signature: + * An extension is an instance of {@see ExtensionDefinitionInterface}, or a `callable` with the following signature: + * * function(Psr\Container\ContainerInterface $container, $previous) * or function(Psr\Container\ContainerInterface $container, $previous = null) * @@ -35,7 +39,7 @@ public function getFactories(); * - the container (instance of `Psr\Container\ContainerInterface`) * - the entry to be extended. If the entry to be extended does not exist and the parameter is nullable, `null` will be passed. * - * @return callable[] + * @return array */ - public function getExtensions(); + public function getExtensions(): array; }