Skip to content

Commit 4672404

Browse files
committed
Merge pull request #45 from container-interop/phpdoc-has
Improve Container::has() description
2 parents ff97e87 + 6e83114 commit 4672404

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

docs/ContainerInterface.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ Users of dependency injections containers (DIC) are referred to as `user`.
3434

3535
- `has` takes one unique parameter: an entry identifier. It MUST return `true`
3636
if an entry identifier is known to the container and `false` if it is not.
37+
`has($id)` returning true does not mean that `get($id)` will not throw an exception.
38+
It does however mean that `get($id)` will not throw a `NotFoundException`.
3739

3840
### 1.2 Exceptions
3941

@@ -114,6 +116,9 @@ interface ContainerInterface
114116
* Returns true if the container can return an entry for the given identifier.
115117
* Returns false otherwise.
116118
*
119+
* `has($id)` returning true does not mean that `get($id)` will not throw an exception.
120+
* It does however mean that `get($id)` will not throw a `NotFoundException`.
121+
*
117122
* @param string $id Identifier of the entry to look for.
118123
*
119124
* @return boolean

src/Interop/Container/ContainerInterface.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ public function get($id);
2828
/**
2929
* Returns true if the container can return an entry for the given identifier.
3030
* Returns false otherwise.
31+
*
32+
* `has($id)` returning true does not mean that `get($id)` will not throw an exception.
33+
* It does however mean that `get($id)` will not throw a `NotFoundException`.
3134
*
3235
* @param string $id Identifier of the entry to look for.
3336
*

0 commit comments

Comments
 (0)