Augmentation vers version 3.3.0
This commit is contained in:
@@ -14,20 +14,18 @@ namespace Symfony\Component\HttpFoundation\Session\Flash;
|
||||
/**
|
||||
* FlashBag flash message container.
|
||||
*
|
||||
* \IteratorAggregate implementation is deprecated and will be removed in 3.0.
|
||||
*
|
||||
* @author Drak <drak@zikula.org>
|
||||
*/
|
||||
class FlashBag implements FlashBagInterface, \IteratorAggregate
|
||||
class FlashBag implements FlashBagInterface
|
||||
{
|
||||
private $name = 'flashes';
|
||||
private $flashes = array();
|
||||
private $flashes = [];
|
||||
private $storageKey;
|
||||
|
||||
/**
|
||||
* @param string $storageKey The key used to store flashes in the session
|
||||
*/
|
||||
public function __construct($storageKey = '_sf2_flashes')
|
||||
public function __construct($storageKey = '_symfony_flashes')
|
||||
{
|
||||
$this->storageKey = $storageKey;
|
||||
}
|
||||
@@ -64,7 +62,7 @@ class FlashBag implements FlashBagInterface, \IteratorAggregate
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function peek($type, array $default = array())
|
||||
public function peek($type, array $default = [])
|
||||
{
|
||||
return $this->has($type) ? $this->flashes[$type] : $default;
|
||||
}
|
||||
@@ -80,7 +78,7 @@ class FlashBag implements FlashBagInterface, \IteratorAggregate
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get($type, array $default = array())
|
||||
public function get($type, array $default = [])
|
||||
{
|
||||
if (!$this->has($type)) {
|
||||
return $default;
|
||||
@@ -99,7 +97,7 @@ class FlashBag implements FlashBagInterface, \IteratorAggregate
|
||||
public function all()
|
||||
{
|
||||
$return = $this->peekAll();
|
||||
$this->flashes = array();
|
||||
$this->flashes = [];
|
||||
|
||||
return $return;
|
||||
}
|
||||
@@ -125,7 +123,7 @@ class FlashBag implements FlashBagInterface, \IteratorAggregate
|
||||
*/
|
||||
public function has($type)
|
||||
{
|
||||
return array_key_exists($type, $this->flashes) && $this->flashes[$type];
|
||||
return \array_key_exists($type, $this->flashes) && $this->flashes[$type];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -151,18 +149,4 @@ class FlashBag implements FlashBagInterface, \IteratorAggregate
|
||||
{
|
||||
return $this->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an iterator for flashes.
|
||||
*
|
||||
* @deprecated since version 2.4, to be removed in 3.0.
|
||||
*
|
||||
* @return \ArrayIterator An \ArrayIterator instance
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
@trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.4 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||
|
||||
return new \ArrayIterator($this->all());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user