updated packages

This commit is contained in:
2019-05-18 09:06:43 +00:00
parent 901d16349e
commit e9487fa58a
2025 changed files with 30366 additions and 49653 deletions

View File

@@ -19,7 +19,7 @@ class AttributeBag implements AttributeBagInterface, \IteratorAggregate, \Counta
private $name = 'attributes';
private $storageKey;
protected $attributes = array();
protected $attributes = [];
/**
* @param string $storageKey The key used to store attributes in the session
@@ -63,7 +63,7 @@ class AttributeBag implements AttributeBagInterface, \IteratorAggregate, \Counta
*/
public function has($name)
{
return array_key_exists($name, $this->attributes);
return \array_key_exists($name, $this->attributes);
}
/**
@@ -71,7 +71,7 @@ class AttributeBag implements AttributeBagInterface, \IteratorAggregate, \Counta
*/
public function get($name, $default = null)
{
return array_key_exists($name, $this->attributes) ? $this->attributes[$name] : $default;
return \array_key_exists($name, $this->attributes) ? $this->attributes[$name] : $default;
}
/**
@@ -95,7 +95,7 @@ class AttributeBag implements AttributeBagInterface, \IteratorAggregate, \Counta
*/
public function replace(array $attributes)
{
$this->attributes = array();
$this->attributes = [];
foreach ($attributes as $key => $value) {
$this->set($key, $value);
}
@@ -107,7 +107,7 @@ class AttributeBag implements AttributeBagInterface, \IteratorAggregate, \Counta
public function remove($name)
{
$retval = null;
if (array_key_exists($name, $this->attributes)) {
if (\array_key_exists($name, $this->attributes)) {
$retval = $this->attributes[$name];
unset($this->attributes[$name]);
}
@@ -121,7 +121,7 @@ class AttributeBag implements AttributeBagInterface, \IteratorAggregate, \Counta
public function clear()
{
$return = $this->attributes;
$this->attributes = array();
$this->attributes = [];
return $return;
}

View File

@@ -44,7 +44,7 @@ class NamespacedAttributeBag extends AttributeBag
return false;
}
return array_key_exists($name, $attributes);
return \array_key_exists($name, $attributes);
}
/**
@@ -60,7 +60,7 @@ class NamespacedAttributeBag extends AttributeBag
return $default;
}
return array_key_exists($name, $attributes) ? $attributes[$name] : $default;
return \array_key_exists($name, $attributes) ? $attributes[$name] : $default;
}
/**
@@ -81,7 +81,7 @@ class NamespacedAttributeBag extends AttributeBag
$retval = null;
$attributes = &$this->resolveAttributePath($name);
$name = $this->resolveKey($name);
if (null !== $attributes && array_key_exists($name, $attributes)) {
if (null !== $attributes && \array_key_exists($name, $attributes)) {
$retval = $attributes[$name];
unset($attributes[$name]);
}
@@ -115,7 +115,7 @@ class NamespacedAttributeBag extends AttributeBag
return $array;
}
$array[$parts[0]] = array();
$array[$parts[0]] = [];
return $array;
}
@@ -123,14 +123,14 @@ class NamespacedAttributeBag extends AttributeBag
unset($parts[\count($parts) - 1]);
foreach ($parts as $part) {
if (null !== $array && !array_key_exists($part, $array)) {
if (null !== $array && !\array_key_exists($part, $array)) {
if (!$writeContext) {
$null = null;
return $null;
}
$array[$part] = array();
$array[$part] = [];
}
$array = &$array[$part];

View File

@@ -19,7 +19,7 @@ namespace Symfony\Component\HttpFoundation\Session\Flash;
class AutoExpireFlashBag implements FlashBagInterface
{
private $name = 'flashes';
private $flashes = array('display' => array(), 'new' => array());
private $flashes = ['display' => [], 'new' => []];
private $storageKey;
/**
@@ -53,8 +53,8 @@ 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'] = [];
}
/**
@@ -68,7 +68,7 @@ class AutoExpireFlashBag implements FlashBagInterface
/**
* {@inheritdoc}
*/
public function peek($type, array $default = array())
public function peek($type, array $default = [])
{
return $this->has($type) ? $this->flashes['display'][$type] : $default;
}
@@ -78,13 +78,13 @@ class AutoExpireFlashBag implements FlashBagInterface
*/
public function peekAll()
{
return array_key_exists('display', $this->flashes) ? (array) $this->flashes['display'] : array();
return \array_key_exists('display', $this->flashes) ? (array) $this->flashes['display'] : [];
}
/**
* {@inheritdoc}
*/
public function get($type, array $default = array())
public function get($type, array $default = [])
{
$return = $default;
@@ -106,7 +106,7 @@ class AutoExpireFlashBag implements FlashBagInterface
public function all()
{
$return = $this->flashes['display'];
$this->flashes['display'] = array();
$this->flashes['display'] = [];
return $return;
}
@@ -132,7 +132,7 @@ class AutoExpireFlashBag implements FlashBagInterface
*/
public function has($type)
{
return array_key_exists($type, $this->flashes['display']) && $this->flashes['display'][$type];
return \array_key_exists($type, $this->flashes['display']) && $this->flashes['display'][$type];
}
/**

View File

@@ -19,7 +19,7 @@ namespace Symfony\Component\HttpFoundation\Session\Flash;
class FlashBag implements FlashBagInterface
{
private $name = 'flashes';
private $flashes = array();
private $flashes = [];
private $storageKey;
/**
@@ -62,7 +62,7 @@ class FlashBag implements FlashBagInterface
/**
* {@inheritdoc}
*/
public function peek($type, array $default = array())
public function peek($type, array $default = [])
{
return $this->has($type) ? $this->flashes[$type] : $default;
}
@@ -78,7 +78,7 @@ class FlashBag implements FlashBagInterface
/**
* {@inheritdoc}
*/
public function get($type, array $default = array())
public function get($type, array $default = [])
{
if (!$this->has($type)) {
return $default;
@@ -97,7 +97,7 @@ class FlashBag implements FlashBagInterface
public function all()
{
$return = $this->peekAll();
$this->flashes = array();
$this->flashes = [];
return $return;
}
@@ -123,7 +123,7 @@ class FlashBag implements FlashBagInterface
*/
public function has($type)
{
return array_key_exists($type, $this->flashes) && $this->flashes[$type];
return \array_key_exists($type, $this->flashes) && $this->flashes[$type];
}
/**

View File

@@ -44,7 +44,7 @@ interface FlashBagInterface extends SessionBagInterface
*
* @return array
*/
public function peek($type, array $default = array());
public function peek($type, array $default = []);
/**
* Gets all flash messages.
@@ -61,7 +61,7 @@ interface FlashBagInterface extends SessionBagInterface
*
* @return array
*/
public function get($type, array $default = array());
public function get($type, array $default = []);
/**
* Gets and clears flashes from the stack.

View File

@@ -28,7 +28,7 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable
private $flashName;
private $attributeName;
private $data = array();
private $data = [];
private $usageIndex = 0;
/**

View File

@@ -30,7 +30,7 @@ final class SessionUtils
$sessionCookie = null;
$sessionCookiePrefix = sprintf(' %s=', urlencode($sessionName));
$sessionCookieWithId = sprintf('%s%s;', $sessionCookiePrefix, urlencode($sessionId));
$otherCookies = array();
$otherCookies = [];
foreach (headers_list() as $h) {
if (0 !== stripos($h, 'Set-Cookie:')) {
continue;

View File

@@ -104,7 +104,7 @@ abstract class AbstractSessionHandler implements \SessionHandlerInterface, \Sess
{
if (null === $this->igbinaryEmptyData) {
// see https://github.com/igbinary/igbinary/issues/146
$this->igbinaryEmptyData = \function_exists('igbinary_serialize') ? igbinary_serialize(array()) : '';
$this->igbinaryEmptyData = \function_exists('igbinary_serialize') ? igbinary_serialize([]) : '';
}
if ('' === $data || $this->igbinaryEmptyData === $data) {
return $this->destroy($sessionId);

View File

@@ -45,11 +45,11 @@ class MemcachedSessionHandler extends AbstractSessionHandler
*
* @throws \InvalidArgumentException When unsupported options are passed
*/
public function __construct(\Memcached $memcached, array $options = array())
public function __construct(\Memcached $memcached, array $options = [])
{
$this->memcached = $memcached;
if ($diff = array_diff(array_keys($options), array('prefix', 'expiretime'))) {
if ($diff = array_diff(array_keys($options), ['prefix', 'expiretime'])) {
throw new \InvalidArgumentException(sprintf('The following options are not supported "%s"', implode(', ', $diff)));
}
@@ -62,7 +62,7 @@ class MemcachedSessionHandler extends AbstractSessionHandler
*/
public function close()
{
return true;
return $this->memcached->quit();
}
/**

View File

@@ -74,12 +74,12 @@ class MongoDbSessionHandler extends AbstractSessionHandler
$this->mongo = $mongo;
$this->options = array_merge(array(
$this->options = array_merge([
'id_field' => '_id',
'data_field' => 'data',
'time_field' => 'time',
'expiry_field' => 'expires_at',
), $options);
], $options);
}
/**
@@ -95,9 +95,9 @@ class MongoDbSessionHandler extends AbstractSessionHandler
*/
protected function doDestroy($sessionId)
{
$this->getCollection()->deleteOne(array(
$this->getCollection()->deleteOne([
$this->options['id_field'] => $sessionId,
));
]);
return true;
}
@@ -107,9 +107,9 @@ class MongoDbSessionHandler extends AbstractSessionHandler
*/
public function gc($maxlifetime)
{
$this->getCollection()->deleteMany(array(
$this->options['expiry_field'] => array('$lt' => new \MongoDB\BSON\UTCDateTime()),
));
$this->getCollection()->deleteMany([
$this->options['expiry_field'] => ['$lt' => new \MongoDB\BSON\UTCDateTime()],
]);
return true;
}
@@ -121,16 +121,16 @@ class MongoDbSessionHandler extends AbstractSessionHandler
{
$expiry = new \MongoDB\BSON\UTCDateTime((time() + (int) ini_get('session.gc_maxlifetime')) * 1000);
$fields = array(
$fields = [
$this->options['time_field'] => new \MongoDB\BSON\UTCDateTime(),
$this->options['expiry_field'] => $expiry,
$this->options['data_field'] => new \MongoDB\BSON\Binary($data, \MongoDB\BSON\Binary::TYPE_OLD_BINARY),
);
];
$this->getCollection()->updateOne(
array($this->options['id_field'] => $sessionId),
array('$set' => $fields),
array('upsert' => true)
[$this->options['id_field'] => $sessionId],
['$set' => $fields],
['upsert' => true]
);
return true;
@@ -144,11 +144,11 @@ class MongoDbSessionHandler extends AbstractSessionHandler
$expiry = new \MongoDB\BSON\UTCDateTime((time() + (int) ini_get('session.gc_maxlifetime')) * 1000);
$this->getCollection()->updateOne(
array($this->options['id_field'] => $sessionId),
array('$set' => array(
[$this->options['id_field'] => $sessionId],
['$set' => [
$this->options['time_field'] => new \MongoDB\BSON\UTCDateTime(),
$this->options['expiry_field'] => $expiry,
))
]]
);
return true;
@@ -159,10 +159,10 @@ class MongoDbSessionHandler extends AbstractSessionHandler
*/
protected function doRead($sessionId)
{
$dbData = $this->getCollection()->findOne(array(
$dbData = $this->getCollection()->findOne([
$this->options['id_field'] => $sessionId,
$this->options['expiry_field'] => array('$gte' => new \MongoDB\BSON\UTCDateTime()),
));
$this->options['expiry_field'] => ['$gte' => new \MongoDB\BSON\UTCDateTime()],
]);
if (null === $dbData) {
return '';

View File

@@ -118,7 +118,7 @@ class PdoSessionHandler extends AbstractSessionHandler
/**
* @var array Connection options when lazy-connect
*/
private $connectionOptions = array();
private $connectionOptions = [];
/**
* @var int The strategy for locking, see constants
@@ -130,7 +130,7 @@ class PdoSessionHandler extends AbstractSessionHandler
*
* @var \PDOStatement[] An array of statements to release advisory locks
*/
private $unlockStatements = array();
private $unlockStatements = [];
/**
* @var bool True when the current session exists but expired according to session.gc_maxlifetime
@@ -161,7 +161,7 @@ class PdoSessionHandler extends AbstractSessionHandler
* * db_time_col: The column where to store the timestamp [default: sess_time]
* * db_username: The username when lazy-connect [default: '']
* * db_password: The password when lazy-connect [default: '']
* * db_connection_options: An array of driver-specific connection options [default: array()]
* * db_connection_options: An array of driver-specific connection options [default: []]
* * lock_mode: The strategy for locking, see constants [default: LOCK_TRANSACTIONAL]
*
* @param \PDO|string|null $pdoOrDsn A \PDO instance or DSN string or URL string or null
@@ -169,7 +169,7 @@ class PdoSessionHandler extends AbstractSessionHandler
*
* @throws \InvalidArgumentException When PDO error mode is not PDO::ERRMODE_EXCEPTION
*/
public function __construct($pdoOrDsn = null, array $options = array())
public function __construct($pdoOrDsn = null, array $options = [])
{
if ($pdoOrDsn instanceof \PDO) {
if (\PDO::ERRMODE_EXCEPTION !== $pdoOrDsn->getAttribute(\PDO::ATTR_ERRMODE)) {
@@ -468,13 +468,13 @@ class PdoSessionHandler extends AbstractSessionHandler
throw new \InvalidArgumentException('URLs without scheme are not supported to configure the PdoSessionHandler');
}
$driverAliasMap = array(
$driverAliasMap = [
'mssql' => 'sqlsrv',
'mysql2' => 'mysql', // Amazon RDS, for some weird reason
'postgres' => 'pgsql',
'postgresql' => 'pgsql',
'sqlite3' => 'sqlite',
);
];
$driver = isset($driverAliasMap[$params['scheme']]) ? $driverAliasMap[$params['scheme']] : $params['scheme'];

View File

@@ -39,7 +39,7 @@ class RedisSessionHandler extends AbstractSessionHandler
*
* @throws \InvalidArgumentException When unsupported client or options are passed
*/
public function __construct($redis, array $options = array())
public function __construct($redis, array $options = [])
{
if (
!$redis instanceof \Redis &&
@@ -52,7 +52,7 @@ class RedisSessionHandler extends AbstractSessionHandler
throw new \InvalidArgumentException(sprintf('%s() expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\Client, %s given', __METHOD__, \is_object($redis) ? \get_class($redis) : \gettype($redis)));
}
if ($diff = array_diff(array_keys($options), array('prefix'))) {
if ($diff = array_diff(array_keys($options), ['prefix'])) {
throw new \InvalidArgumentException(sprintf('The following options are not supported "%s"', implode(', ', $diff)));
}

View File

@@ -39,7 +39,7 @@ class MetadataBag implements SessionBagInterface
/**
* @var array
*/
protected $meta = array(self::CREATED => 0, self::UPDATED => 0, self::LIFETIME => 0);
protected $meta = [self::CREATED => 0, self::UPDATED => 0, self::LIFETIME => 0];
/**
* Unix timestamp.

View File

@@ -50,7 +50,7 @@ class MockArraySessionStorage implements SessionStorageInterface
/**
* @var array
*/
protected $data = array();
protected $data = [];
/**
* @var MetadataBag
@@ -60,7 +60,7 @@ class MockArraySessionStorage implements SessionStorageInterface
/**
* @var array|SessionBagInterface[]
*/
protected $bags = array();
protected $bags = [];
public function __construct(string $name = 'MOCKSESSID', MetadataBag $metaBag = null)
{
@@ -166,7 +166,7 @@ class MockArraySessionStorage implements SessionStorageInterface
}
// clear out the session
$this->data = array();
$this->data = [];
// reconnect the bags to the session
$this->loadSession();
@@ -238,11 +238,11 @@ class MockArraySessionStorage implements SessionStorageInterface
protected function loadSession()
{
$bags = array_merge($this->bags, array($this->metadataBag));
$bags = array_merge($this->bags, [$this->metadataBag]);
foreach ($bags as $bag) {
$key = $bag->getStorageKey();
$this->data[$key] = isset($this->data[$key]) ? $this->data[$key] : array();
$this->data[$key] = isset($this->data[$key]) ? $this->data[$key] : [];
$bag->initialize($this->data[$key]);
}

View File

@@ -98,7 +98,7 @@ class MockFileSessionStorage extends MockArraySessionStorage
unset($data[$key]);
}
}
if (array($key = $this->metadataBag->getStorageKey()) === array_keys($data)) {
if ([$key = $this->metadataBag->getStorageKey()] === array_keys($data)) {
unset($data[$key]);
}
@@ -145,7 +145,7 @@ class MockFileSessionStorage extends MockArraySessionStorage
private function read()
{
$filePath = $this->getFilePath();
$this->data = is_readable($filePath) && is_file($filePath) ? unserialize(file_get_contents($filePath)) : array();
$this->data = is_readable($filePath) && is_file($filePath) ? unserialize(file_get_contents($filePath)) : [];
$this->loadSession();
}

View File

@@ -27,7 +27,7 @@ class NativeSessionStorage implements SessionStorageInterface
/**
* @var SessionBagInterface[]
*/
protected $bags = array();
protected $bags = [];
/**
* @var bool
@@ -101,15 +101,15 @@ class NativeSessionStorage implements SessionStorageInterface
* @param \SessionHandlerInterface|null $handler
* @param MetadataBag $metaBag MetadataBag
*/
public function __construct(array $options = array(), $handler = null, MetadataBag $metaBag = null)
public function __construct(array $options = [], $handler = null, MetadataBag $metaBag = null)
{
$options += array(
$options += [
'cache_limiter' => '',
'cache_expire' => 0,
'use_cookies' => 1,
'lazy_write' => 1,
'use_strict_mode' => 1,
);
];
session_register_shutdown();
@@ -244,7 +244,7 @@ class NativeSessionStorage implements SessionStorageInterface
unset($_SESSION[$key]);
}
}
if (array($key = $this->metadataBag->getStorageKey()) === array_keys($_SESSION)) {
if ([$key = $this->metadataBag->getStorageKey()] === array_keys($_SESSION)) {
unset($_SESSION[$key]);
}
@@ -280,7 +280,7 @@ class NativeSessionStorage implements SessionStorageInterface
}
// clear out the session
$_SESSION = array();
$_SESSION = [];
// reconnect the bags to the session
$this->loadSession();
@@ -349,7 +349,7 @@ class NativeSessionStorage implements SessionStorageInterface
* For convenience we omit 'session.' from the beginning of the keys.
* Explicitly ignores other ini keys.
*
* @param array $options Session ini directives array(key => value)
* @param array $options Session ini directives [key => value]
*
* @see http://php.net/session.configuration
*/
@@ -359,7 +359,7 @@ class NativeSessionStorage implements SessionStorageInterface
return;
}
$validOptions = array_flip(array(
$validOptions = array_flip([
'cache_expire', 'cache_limiter', 'cookie_domain', 'cookie_httponly',
'cookie_lifetime', 'cookie_path', 'cookie_secure', 'cookie_samesite',
'gc_divisor', 'gc_maxlifetime', 'gc_probability',
@@ -369,7 +369,7 @@ class NativeSessionStorage implements SessionStorageInterface
'upload_progress.cleanup', 'upload_progress.prefix', 'upload_progress.name',
'upload_progress.freq', 'upload_progress.min_freq', 'url_rewriter.tags',
'sid_length', 'sid_bits_per_character', 'trans_sid_hosts', 'trans_sid_tags',
));
]);
foreach ($options as $key => $value) {
if (isset($validOptions[$key])) {
@@ -445,11 +445,11 @@ class NativeSessionStorage implements SessionStorageInterface
$session = &$_SESSION;
}
$bags = array_merge($this->bags, array($this->metadataBag));
$bags = array_merge($this->bags, [$this->metadataBag]);
foreach ($bags as $bag) {
$key = $bag->getStorageKey();
$session[$key] = isset($session[$key]) ? $session[$key] : array();
$session[$key] = isset($session[$key]) ? $session[$key] : [];
$bag->initialize($session[$key]);
}