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 FlashBag implements FlashBagInterface
{
private $name = 'flashes';
private string $name = 'flashes';
private array $flashes = [];
private string $storageKey;
/**
* Flash messages.
*
* @var array
*/
private $flashes = 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 FlashBag 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;
}
@@ -68,7 +54,7 @@ class FlashBag implements FlashBagInterface
/**
* {@inheritdoc}
*/
public function add($type, $message)
public function add(string $type, mixed $message)
{
$this->flashes[$type][] = $message;
}
@@ -76,7 +62,7 @@ class FlashBag implements FlashBagInterface
/**
* {@inheritdoc}
*/
public function peek($type, array $default = array())
public function peek(string $type, array $default = []): array
{
return $this->has($type) ? $this->flashes[$type] : $default;
}
@@ -84,7 +70,7 @@ class FlashBag implements FlashBagInterface
/**
* {@inheritdoc}
*/
public function peekAll()
public function peekAll(): array
{
return $this->flashes;
}
@@ -92,7 +78,7 @@ class FlashBag implements FlashBagInterface
/**
* {@inheritdoc}
*/
public function get($type, array $default = array())
public function get(string $type, array $default = []): array
{
if (!$this->has($type)) {
return $default;
@@ -108,10 +94,10 @@ class FlashBag implements FlashBagInterface
/**
* {@inheritdoc}
*/
public function all()
public function all(): array
{
$return = $this->peekAll();
$this->flashes = array();
$this->flashes = [];
return $return;
}
@@ -119,7 +105,7 @@ class FlashBag implements FlashBagInterface
/**
* {@inheritdoc}
*/
public function set($type, $messages)
public function set(string $type, string|array $messages)
{
$this->flashes[$type] = (array) $messages;
}
@@ -135,15 +121,15 @@ class FlashBag implements FlashBagInterface
/**
* {@inheritdoc}
*/
public function has($type)
public function has(string $type): bool
{
return array_key_exists($type, $this->flashes) && $this->flashes[$type];
return \array_key_exists($type, $this->flashes) && $this->flashes[$type];
}
/**
* {@inheritdoc}
*/
public function keys()
public function keys(): array
{
return array_keys($this->flashes);
}
@@ -151,7 +137,7 @@ class FlashBag implements FlashBagInterface
/**
* {@inheritdoc}
*/
public function getStorageKey()
public function getStorageKey(): string
{
return $this->storageKey;
}
@@ -159,7 +145,7 @@ class FlashBag implements FlashBagInterface
/**
* {@inheritdoc}
*/
public function clear()
public function clear(): mixed
{
return $this->all();
}