container-interop / definition-interop

[EXPERIMENTAL] Promoting container interoperability through standard definitions
MIT License
19 stars 2 forks source link

Stricter DefinitionProviderInterface::getDefinitions() return type #23

Closed mnapoli closed 8 years ago

mnapoli commented 8 years ago

References #22

Enforce that DefinitionProviderInterface::getDefinitions() returns an array of DefinitionInterface.

moufmouf commented 8 years ago

:+1: for the @return annotation.

But we must even be more specific, because the DefinitionProviderInterface::getDefinitions() method cannot return "any" object implementing DefinitionInterface, but only the objects that are implementing one of the sub-interfaces we defined in definition-interop.

What about adding these lines to the PHPDoc:

    /**
     * Returns the definitions to register in the container.
     *
     * Definitions must be indexed by their entry ID. For example:
     *
     *     return [
     *         'logger' => ...
     *         'mailer' => ...
     *     ];
     *
     * Definitions MUST be objects implementing one of those interfaces:
     *
     * - `ObjectDefinitionInterface`
     * - `FactoryCallDefinitionInterface`
     * - `ParameterDefinitionInterface`
     * - `ReferenceDefinitionInterface`
     *
     * @return DefinitionInterface[]
     */
mnapoli commented 8 years ago

PR updated!

moufmouf commented 8 years ago

:+1: