Upgrade framework

This commit is contained in:
2023-11-14 16:54:35 +01:00
parent 1648a5cd42
commit 4fcf6fffcc
10548 changed files with 693138 additions and 466698 deletions

View File

@@ -18,28 +18,14 @@ namespace Symfony\Component\HttpFoundation\Session\Flash;
*/
class AutoExpireFlashBag implements FlashBagInterface
{
private $name = 'flashes';
private string $name = 'flashes';
private array $flashes = ['display' => [], 'new' => []];
private string $storageKey;
/**
* Flash messages.
*
* @var array
*/
private $flashes = array('display' => array(), 'new' => array());
/**
* The storage key for flashes in the session.
*
* @var string
*/
private $storageKey;
/**
* Constructor.
*
* @param string $storageKey The key used to store flashes in the session
*/
public function __construct($storageKey = '_sf2_flashes')
public function __construct(string $storageKey = '_symfony_flashes')
{
$this->storageKey = $storageKey;
}
@@ -47,12 +33,12 @@ class AutoExpireFlashBag implements FlashBagInterface
/**
* {@inheritdoc}
*/
public function getName()
public function getName(): string
{
return $this->name;
}
public function setName($name)
public function setName(string $name)
{
$this->name = $name;
}
@@ -67,14 +53,14 @@ class AutoExpireFlashBag implements FlashBagInterface
// The logic: messages from the last request will be stored in new, so we move them to previous
// This request we will show what is in 'display'. What is placed into 'new' this time round will
// be moved to display next time round.
$this->flashes['display'] = array_key_exists('new', $this->flashes) ? $this->flashes['new'] : array();
$this->flashes['new'] = array();
$this->flashes['display'] = \array_key_exists('new', $this->flashes) ? $this->flashes['new'] : [];
$this->flashes['new'] = [];
}
/**
* {@inheritdoc}
*/
public function add($type, $message)
public function add(string $type, mixed $message)
{
$this->flashes['new'][$type][] = $message;
}
@@ -82,7 +68,7 @@ class AutoExpireFlashBag implements FlashBagInterface
/**
* {@inheritdoc}
*/
public function peek($type, array $default = array())
public function peek(string $type, array $default = []): array
{
return $this->has($type) ? $this->flashes['display'][$type] : $default;
}
@@ -90,15 +76,15 @@ class AutoExpireFlashBag implements FlashBagInterface
/**
* {@inheritdoc}
*/
public function peekAll()
public function peekAll(): array
{
return array_key_exists('display', $this->flashes) ? (array) $this->flashes['display'] : array();
return \array_key_exists('display', $this->flashes) ? $this->flashes['display'] : [];
}
/**
* {@inheritdoc}
*/
public function get($type, array $default = array())
public function get(string $type, array $default = []): array
{
$return = $default;
@@ -117,10 +103,10 @@ class AutoExpireFlashBag implements FlashBagInterface
/**
* {@inheritdoc}
*/
public function all()
public function all(): array
{
$return = $this->flashes['display'];
$this->flashes = array('new' => array(), 'display' => array());
$this->flashes['display'] = [];
return $return;
}
@@ -136,7 +122,7 @@ class AutoExpireFlashBag implements FlashBagInterface
/**
* {@inheritdoc}
*/
public function set($type, $messages)
public function set(string $type, string|array $messages)
{
$this->flashes['new'][$type] = (array) $messages;
}
@@ -144,15 +130,15 @@ class AutoExpireFlashBag implements FlashBagInterface
/**
* {@inheritdoc}
*/
public function has($type)
public function has(string $type): bool
{
return array_key_exists($type, $this->flashes['display']) && $this->flashes['display'][$type];
return \array_key_exists($type, $this->flashes['display']) && $this->flashes['display'][$type];
}
/**
* {@inheritdoc}
*/
public function keys()
public function keys(): array
{
return array_keys($this->flashes['display']);
}
@@ -160,7 +146,7 @@ class AutoExpireFlashBag implements FlashBagInterface
/**
* {@inheritdoc}
*/
public function getStorageKey()
public function getStorageKey(): string
{
return $this->storageKey;
}
@@ -168,7 +154,7 @@ class AutoExpireFlashBag implements FlashBagInterface
/**
* {@inheritdoc}
*/
public function clear()
public function clear(): mixed
{
return $this->all();
}