-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Description
symfony/dependency-injection
v5.3.3 is pinned to psr/container:^1.1.1
.
symfony/service-contracts
v2.4.0 is pinned to psr/container:^1.1
.
psr/container:^2
is now available. The changes between v1 and v2 are technically BC-breaking and present a compatibility issue. As such, they should probably only be done in a major release. However, the actual code changes required are minor enough that upgrading won't require much effort in that regard. I'm happy to submit these changes as a formal PR if there's consensus on if / when to implement them.
service-contracts
needs its composer.json
file updated and a bool
typehint added to ServiceLocatorTrait->has()
.
diff --git a/ServiceLocatorTrait.php b/ServiceLocatorTrait.php
index 74dfa43..21ff445 100644
--- a/ServiceLocatorTrait.php
+++ b/ServiceLocatorTrait.php
@@ -43,7 +43,7 @@ trait ServiceLocatorTrait
*
* @return bool
*/
- public function has(string $id)
+ public function has(string $id): bool
{
return isset($this->factories[$id]);
}
diff --git a/composer.json b/composer.json
index 353413f..57316ee 100644
--- a/composer.json
+++ b/composer.json
@@ -17,7 +17,7 @@
],
"require": {
"php": ">=7.2.5",
- "psr/container": "^1.1"
+ "psr/container": "^^2"
},
"suggest": {
"symfony/service-implementation": ""
dependency-injection
needs its composer.json
file updated and a bool
typehint added to Container->has()
, ContainerBuilder->has()
, ContainerInterface->has()
, and ParameterBag\ContainerBag->has()
.
diff --git a/composer.json b/composer.json
index 65777679..bd75a893 100644
--- a/composer.json
+++ b/composer.json
@@ -17,11 +17,21 @@
],
"require": {
"php": ">=7.2.5",
- "psr/container": "^1.1.1",
+ "psr/container": "^2",
"symfony/deprecation-contracts": "^2.1",
"symfony/polyfill-php80": "^1.15",
diff --git a/Container.php b/Container.php
index f096c75c..0ed5829a 100644
--- a/Container.php
+++ b/Container.php
@@ -186,7 +186,7 @@ class Container implements ContainerInterface, ResetInterface
*
* @return bool true if the service is defined, false otherwise
*/
- public function has(string $id)
+ public function has(string $id): bool
{
if (isset($this->aliases[$id])) {
$id = $this->aliases[$id];
diff --git a/ContainerBuilder.php b/ContainerBuilder.php
index d8d356ad..f006df08 100644
--- a/ContainerBuilder.php
+++ b/ContainerBuilder.php
@@ -518,7 +518,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
*
* @return bool true if the service is defined, false otherwise
*/
- public function has(string $id)
+ public function has(string $id): bool
{
return isset($this->definitions[$id]) || isset($this->aliasDefinitions[$id]) || parent::has($id);
}
diff --git a/ContainerInterface.php b/ContainerInterface.php
index 97da9a72..8e5da8c7 100644
--- a/ContainerInterface.php
+++ b/ContainerInterface.php
@@ -53,7 +53,7 @@ interface ContainerInterface extends PsrContainerInterface
/**
* @return bool true if the service is defined, false otherwise
*/
- public function has(string $id);
+ public function has(string $id): bool;
/**
* Check for whether or not a service has been initialized.
diff --git a/ParameterBag/ContainerBag.php b/ParameterBag/ContainerBag.php
index 025fdaf2..295f16b6 100644
--- a/ParameterBag/ContainerBag.php
+++ b/ParameterBag/ContainerBag.php
@@ -48,7 +48,7 @@ class ContainerBag extends FrozenParameterBag implements ContainerBagInterface
*
* @return bool
*/
- public function has(string $name)
+ public function has(string $name): bool
{
return $this->container->hasParameter($name);
}