mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-01 06:28:46 +02:00
N°6934 - Symfony 6.4 - upgrade Symfony bundles to 6.4 (#580)
* Update Symfony lib to version ~6.4.0 * Update code missing return type * Add an iTop general configuration entry to store application secret (Symfony mandatory parameter) * Use dependency injection in ExceptionListener & UserProvider classes
This commit is contained in:
@@ -16,9 +16,9 @@ namespace Symfony\Bridge\Twig\NodeVisitor;
|
||||
*/
|
||||
class Scope
|
||||
{
|
||||
private $parent;
|
||||
private $data = [];
|
||||
private $left = false;
|
||||
private ?self $parent;
|
||||
private array $data = [];
|
||||
private bool $left = false;
|
||||
|
||||
public function __construct(self $parent = null)
|
||||
{
|
||||
@@ -27,20 +27,16 @@ class Scope
|
||||
|
||||
/**
|
||||
* Opens a new child scope.
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function enter()
|
||||
public function enter(): self
|
||||
{
|
||||
return new self($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes current scope and returns parent one.
|
||||
*
|
||||
* @return self|null
|
||||
*/
|
||||
public function leave()
|
||||
public function leave(): ?self
|
||||
{
|
||||
$this->left = true;
|
||||
|
||||
@@ -54,7 +50,7 @@ class Scope
|
||||
*
|
||||
* @throws \LogicException
|
||||
*/
|
||||
public function set(string $key, $value)
|
||||
public function set(string $key, mixed $value): static
|
||||
{
|
||||
if ($this->left) {
|
||||
throw new \LogicException('Left scope is not mutable.');
|
||||
@@ -67,10 +63,8 @@ class Scope
|
||||
|
||||
/**
|
||||
* Tests if a data is visible from current scope.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function has(string $key)
|
||||
public function has(string $key): bool
|
||||
{
|
||||
if (\array_key_exists($key, $this->data)) {
|
||||
return true;
|
||||
@@ -85,10 +79,8 @@ class Scope
|
||||
|
||||
/**
|
||||
* Returns data visible from current scope.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get(string $key, $default = null)
|
||||
public function get(string $key, mixed $default = null): mixed
|
||||
{
|
||||
if (\array_key_exists($key, $this->data)) {
|
||||
return $this->data[$key];
|
||||
|
||||
Reference in New Issue
Block a user