package and depencies
This commit is contained in:
@@ -73,10 +73,7 @@ class MockArraySessionStorage implements SessionStorageInterface
|
||||
$this->data = $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function start()
|
||||
public function start(): bool
|
||||
{
|
||||
if ($this->started) {
|
||||
return true;
|
||||
@@ -91,10 +88,7 @@ class MockArraySessionStorage implements SessionStorageInterface
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function regenerate(bool $destroy = false, int $lifetime = null)
|
||||
public function regenerate(bool $destroy = false, int $lifetime = null): bool
|
||||
{
|
||||
if (!$this->started) {
|
||||
$this->start();
|
||||
@@ -106,17 +100,11 @@ class MockArraySessionStorage implements SessionStorageInterface
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getId()
|
||||
public function getId(): string
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setId(string $id)
|
||||
{
|
||||
if ($this->started) {
|
||||
@@ -126,25 +114,16 @@ class MockArraySessionStorage implements SessionStorageInterface
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setName(string $name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function save()
|
||||
{
|
||||
if (!$this->started || $this->closed) {
|
||||
@@ -155,9 +134,6 @@ class MockArraySessionStorage implements SessionStorageInterface
|
||||
$this->started = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
// clear out the bags
|
||||
@@ -172,18 +148,12 @@ class MockArraySessionStorage implements SessionStorageInterface
|
||||
$this->loadSession();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function registerBag(SessionBagInterface $bag)
|
||||
{
|
||||
$this->bags[$bag->getName()] = $bag;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBag(string $name)
|
||||
public function getBag(string $name): SessionBagInterface
|
||||
{
|
||||
if (!isset($this->bags[$name])) {
|
||||
throw new \InvalidArgumentException(sprintf('The SessionBagInterface "%s" is not registered.', $name));
|
||||
@@ -196,29 +166,23 @@ class MockArraySessionStorage implements SessionStorageInterface
|
||||
return $this->bags[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isStarted()
|
||||
public function isStarted(): bool
|
||||
{
|
||||
return $this->started;
|
||||
}
|
||||
|
||||
public function setMetadataBag(MetadataBag $bag = null)
|
||||
{
|
||||
if (null === $bag) {
|
||||
$bag = new MetadataBag();
|
||||
if (1 > \func_num_args()) {
|
||||
trigger_deprecation('symfony/http-foundation', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
|
||||
}
|
||||
|
||||
$this->metadataBag = $bag;
|
||||
$this->metadataBag = $bag ?? new MetadataBag();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the MetadataBag.
|
||||
*
|
||||
* @return MetadataBag
|
||||
*/
|
||||
public function getMetadataBag()
|
||||
public function getMetadataBag(): MetadataBag
|
||||
{
|
||||
return $this->metadataBag;
|
||||
}
|
||||
@@ -228,10 +192,8 @@ class MockArraySessionStorage implements SessionStorageInterface
|
||||
*
|
||||
* This doesn't need to be particularly cryptographically secure since this is just
|
||||
* a mock.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function generateId()
|
||||
protected function generateId(): string
|
||||
{
|
||||
return hash('sha256', uniqid('ss_mock_', true));
|
||||
}
|
||||
@@ -242,7 +204,7 @@ class MockArraySessionStorage implements SessionStorageInterface
|
||||
|
||||
foreach ($bags as $bag) {
|
||||
$key = $bag->getStorageKey();
|
||||
$this->data[$key] = $this->data[$key] ?? [];
|
||||
$this->data[$key] ??= [];
|
||||
$bag->initialize($this->data[$key]);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user