Skip to content

Commit

Permalink
corrections for changes in container-interop#54
Browse files Browse the repository at this point in the history
  • Loading branch information
mindplay-dk committed Jan 10, 2024
1 parent a643c33 commit 80f67ad
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions PSR-XX-provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ A factory MAY return `null` for a service - this SHOULD NOT be treated as an err

A factory SHOULD NOT cache anything or store state. Caching and state are the responsibility of the container.

A provider MAY choose to implement the optional `FactoryDefinitionInterface` for type-safety.

A container MUST NOT reject a `callable` that does not implement the `FactoryDefinitionInterface` interface.

### 1.4. Extensions

An extension is a callable for modifying an existing service.
Expand All @@ -73,6 +77,10 @@ TODO "A extension MAY omit the `$container` and `$service` parameters, if unused

An extension MAY return `null` for a service - this SHOULD NOT be treated as an error, as other services may have nullable dependencies, and (as stated in section 1.3) the existing service could intentionally be `null`.

A provider MAY choose to implement the optional `ExtensionDefinitionInterface` for type-safety.

A container MUST NOT reject a `callable` that does not implement the `ExtensionDefinitionInterface` interface.

### 1.5. Dependency Enumeration

A `ServiceProviderInterface` implementation MAY implement the `ServiceDependencyInterface`, which enables enumeration of provider dependencies:
Expand Down Expand Up @@ -112,17 +120,17 @@ After importing from the provider, the container will contain:

Defines the service provider interface.

### 2.2. `Psr\Provider\ServiceDefinitionInterface`
### 2.2. `Psr\Provider\ServiceDependencyInterface`

Allows declaring service dependencies. Implemented by factories and extensions.
Allows declaring service dependencies. Implemented by service providers.

### 2.3. `Psr\Provider\FactoryDefinitionInterface`

A factory that declares dependencies. (Extends `ServiceDefinitionInterface`.)
An optional interface for factory functions.

### 2.4. `Psr\Provider\ExtensionDefinitionInterface`

An extension that declares dependencies. (Extends `ServiceDefinitionInterface`.)
An optional interface for extension functions.

## 3. Package

Expand Down

0 comments on commit 80f67ad

Please sign in to comment.