summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Négrier <d.negrier@thecodingmachine.com>2016-11-04 14:59:55 +0100
committerDavid Négrier <d.negrier@thecodingmachine.com>2016-11-04 14:59:55 +0100
commit8f444ccfd250d7ce089fe960c5fe71c20f39d23c (patch)
tree9f68215c9042c5ba027d565e6fb83b3f88c88f9c
parenta47c644f9d0f914bb0a9777eeaec157f2d51dbff (diff)
downloadfig-standards-8f444ccfd250d7ce089fe960c5fe71c20f39d23c.zip
fig-standards-8f444ccfd250d7ce089fe960c5fe71c20f39d23c.tar.gz
fig-standards-8f444ccfd250d7ce089fe960c5fe71c20f39d23c.tar.bz2
Adding clarifications on get optional parameters
-rw-r--r--proposed/container-meta.md13
-rw-r--r--proposed/container.md2
2 files changed, 12 insertions, 3 deletions
diff --git a/proposed/container-meta.md b/proposed/container-meta.md
index b2b7d28..ad4d998 100644
--- a/proposed/container-meta.md
+++ b/proposed/container-meta.md
@@ -239,7 +239,18 @@ While `ContainerInterface` only defines one mandatory parameter in `get()`, it i
existing containers that have additional optional parameters. PHP allows an implementation to offer more parameters
as long as they are optional, because the implementation *does* satisfy the interface.
-This issue has been discussed in [container-interop's issue #6](https://github.com/container-interop/container-interop/issues/6).
+Early drafts of the spec (and [the container-interop spec](https://github.com/container-interop/container-interop/blob/master/docs/ContainerInterface.md)) stated that:
+
+> While `ContainerInterface` only defines one mandatory parameter in `get()`, implementations MAY accept additional optional parameters.
+
+This sentence was removed because:
+
+- It is something that stems from OO principles in PHP, so this is not directly related to PSR-11
+- We do not want to encourage implementors to add additional parameters as we recommend coding against the interface and not the implementation
+
+Yet, some implementations have extra optional parameters; that's technically legal. Such implementations are compatible with PSR-11.
+
+This issue has been discussed in [container-interop's issue #6](https://github.com/container-interop/container-interop/issues/6) and on [PHP-FIG mailing list](https://groups.google.com/forum/#!topic/php-fig/zY6FAG4-oz8).
### 7.2. Type of the `$id` parameter
diff --git a/proposed/container.md b/proposed/container.md
index 90acde3..9d48e07 100644
--- a/proposed/container.md
+++ b/proposed/container.md
@@ -29,8 +29,6 @@ Users of dependency injections containers (DIC) are referred to as `user`.
identifier SHOULD return the same value. However, depending on the `implementor`
design and/or `user` configuration, different values might be returned, so
`user` SHOULD NOT rely on getting the same value on 2 successive calls.
- While `ContainerInterface` only defines one mandatory parameter in `get()`, implementations
- MAY accept additional optional parameters.
- `has` takes one unique parameter: an entry identifier. It MUST return `true`
if an entry identifier is known to the container and `false` if it is not.