Adaptation du container pour éviter des deprecated en PHP 8.1

pull/42/head
Matthieu Marcillaud 2 years ago
parent 8824afb318
commit 320eca0dbe

@ -134,7 +134,7 @@ class Container implements \ArrayAccess, ContainerInterface
*
* @throws \RuntimeException Prevent override of a frozen service
*/
public function offsetSet($id, $value)
public function offsetSet($id, $value): void
{
if (isset($this->frozen[$id])) {
throw new \RuntimeException(sprintf('Cannot override frozen service "%s".', $id));
@ -153,6 +153,7 @@ class Container implements \ArrayAccess, ContainerInterface
*
* @throws NotFoundExceptionInterface if the identifier is not defined
*/
#[\ReturnTypeWillChange]
public function offsetGet($id)
{
if (!isset($this->keys[$id])) {
@ -188,7 +189,7 @@ class Container implements \ArrayAccess, ContainerInterface
*
* @return bool
*/
public function offsetExists($id)
public function offsetExists($id): bool
{
return isset($this->keys[$id]);
}
@ -198,7 +199,7 @@ class Container implements \ArrayAccess, ContainerInterface
*
* @param string $id The unique identifier for the parameter or object
*/
public function offsetUnset($id)
public function offsetUnset($id): void
{
if (isset($this->keys[$id])) {
if (is_object($this->values[$id])) {

Loading…
Cancel
Save