Skip to content

Commit b61a67a

Browse files
committed
[DependencyInjection] Implement psr/container 1.1
1 parent ea9b340 commit b61a67a

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

Container.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public function set(string $id, ?object $service)
192192
*
193193
* @return bool true if the service is defined, false otherwise
194194
*/
195-
public function has($id)
195+
public function has(string $id)
196196
{
197197
if (isset($this->aliases[$id])) {
198198
$id = $this->aliases[$id];
@@ -221,7 +221,7 @@ public function has($id)
221221
*
222222
* @see Reference
223223
*/
224-
public function get($id, int $invalidBehavior = /* self::EXCEPTION_ON_INVALID_REFERENCE */ 1)
224+
public function get(string $id, int $invalidBehavior = /* self::EXCEPTION_ON_INVALID_REFERENCE */ 1)
225225
{
226226
return $this->services[$id]
227227
?? $this->services[$id = $this->aliases[$id] ?? $id]

ContainerBuilder.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -517,10 +517,8 @@ public function removeDefinition(string $id)
517517
*
518518
* @return bool true if the service is defined, false otherwise
519519
*/
520-
public function has($id)
520+
public function has(string $id)
521521
{
522-
$id = (string) $id;
523-
524522
return isset($this->definitions[$id]) || isset($this->aliasDefinitions[$id]) || parent::has($id);
525523
}
526524

@@ -539,9 +537,9 @@ public function has($id)
539537
*
540538
* @see Reference
541539
*/
542-
public function get($id, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE)
540+
public function get(string $id, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE)
543541
{
544-
if ($this->isCompiled() && isset($this->removedIds[$id = (string) $id]) && ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE >= $invalidBehavior) {
542+
if ($this->isCompiled() && isset($this->removedIds[$id]) && ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE >= $invalidBehavior) {
545543
return parent::get($id);
546544
}
547545

ContainerInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function set(string $id, ?object $service);
4848
*
4949
* @see Reference
5050
*/
51-
public function get($id, int $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE);
51+
public function get(string $id, int $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE);
5252

5353
/**
5454
* Returns true if the given service is defined.
@@ -57,7 +57,7 @@ public function get($id, int $invalidBehavior = self::EXCEPTION_ON_INVALID_REFER
5757
*
5858
* @return bool true if the service is defined, false otherwise
5959
*/
60-
public function has($id);
60+
public function has(string $id);
6161

6262
/**
6363
* Check for whether or not a service has been initialized.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
],
1818
"require": {
1919
"php": ">=7.2.5",
20-
"psr/container": "^1.0",
20+
"psr/container": "^1.1.1",
2121
"symfony/deprecation-contracts": "^2.1",
2222
"symfony/polyfill-php80": "^1.15",
2323
"symfony/service-contracts": "^1.1.6|^2"

0 commit comments

Comments
 (0)