Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3284c2b

Browse files
committed
[DependencyInjection] Implement psr/container 1.1
1 parent 5795384 commit 3284c2b

File tree

7 files changed

+13
-15
lines changed

7 files changed

+13
-15
lines changed

src/Symfony/Bundle/FrameworkBundle/Test/TestContainer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,15 @@ public function set(string $id, $service)
9393
/**
9494
* {@inheritdoc}
9595
*/
96-
public function has($id): bool
96+
public function has(string $id): bool
9797
{
9898
return $this->getPublicContainer()->has($id) || $this->getPrivateContainer()->has($id);
9999
}
100100

101101
/**
102102
* {@inheritdoc}
103103
*/
104-
public function get($id, int $invalidBehavior = /* self::EXCEPTION_ON_INVALID_REFERENCE */ 1): ?object
104+
public function get(string $id, int $invalidBehavior = /* self::EXCEPTION_ON_INVALID_REFERENCE */ 1): ?object
105105
{
106106
return $this->getPrivateContainer()->has($id) ? $this->getPrivateContainer()->get($id) : $this->getPublicContainer()->get($id, $invalidBehavior);
107107
}

src/Symfony/Component/DependencyInjection/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]

src/Symfony/Component/DependencyInjection/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

src/Symfony/Component/DependencyInjection/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.

src/Symfony/Component/DependencyInjection/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"

src/Symfony/Contracts/Service/ServiceLocatorTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function __construct(array $factories)
4343
*
4444
* @return bool
4545
*/
46-
public function has($id)
46+
public function has(string $id)
4747
{
4848
return isset($this->factories[$id]);
4949
}
@@ -53,7 +53,7 @@ public function has($id)
5353
*
5454
* @return mixed
5555
*/
56-
public function get($id)
56+
public function get(string $id)
5757
{
5858
if (!isset($this->factories[$id])) {
5959
throw $this->createNotFoundException($id);

src/Symfony/Contracts/Service/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"
2121
},
2222
"suggest": {
2323
"symfony/service-implementation": ""

0 commit comments

Comments
 (0)