mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-28 04:58:46 +02:00
migration symfony 5 4 (#300)
* symfony 5.4 (diff dev) * symfony 5.4 (working) * symfony 5.4 (update autoload) * symfony 5.4 (remove swiftmailer mailer implementation) * symfony 5.4 (php doc and split Global accessor class) ### Impacted packages: composer require php:">=7.2.5 <8.0.0" symfony/console:5.4.* symfony/dotenv:5.4.* symfony/framework-bundle:5.4.* symfony/twig-bundle:5.4.* symfony/yaml:5.4.* --update-with-dependencies composer require symfony/stopwatch:5.4.* symfony/web-profiler-bundle:5.4.* --dev --update-with-dependencies
This commit is contained in:
@@ -11,11 +11,15 @@
|
||||
|
||||
namespace Symfony\Component\HttpFoundation\Session\Attribute;
|
||||
|
||||
trigger_deprecation('symfony/http-foundation', '5.3', 'The "%s" class is deprecated.', NamespacedAttributeBag::class);
|
||||
|
||||
/**
|
||||
* This class provides structured storage of session attributes using
|
||||
* a name spacing character in the key.
|
||||
*
|
||||
* @author Drak <drak@zikula.org>
|
||||
*
|
||||
* @deprecated since Symfony 5.3
|
||||
*/
|
||||
class NamespacedAttributeBag extends AttributeBag
|
||||
{
|
||||
@@ -25,7 +29,7 @@ class NamespacedAttributeBag extends AttributeBag
|
||||
* @param string $storageKey Session storage key
|
||||
* @param string $namespaceCharacter Namespace character to use in keys
|
||||
*/
|
||||
public function __construct($storageKey = '_sf2_attributes', $namespaceCharacter = '/')
|
||||
public function __construct(string $storageKey = '_sf2_attributes', string $namespaceCharacter = '/')
|
||||
{
|
||||
$this->namespaceCharacter = $namespaceCharacter;
|
||||
parent::__construct($storageKey);
|
||||
@@ -34,7 +38,7 @@ class NamespacedAttributeBag extends AttributeBag
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function has($name)
|
||||
public function has(string $name)
|
||||
{
|
||||
// reference mismatch: if fixed, re-introduced in array_key_exists; keep as it is
|
||||
$attributes = $this->resolveAttributePath($name);
|
||||
@@ -50,7 +54,7 @@ class NamespacedAttributeBag extends AttributeBag
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get($name, $default = null)
|
||||
public function get(string $name, $default = null)
|
||||
{
|
||||
// reference mismatch: if fixed, re-introduced in array_key_exists; keep as it is
|
||||
$attributes = $this->resolveAttributePath($name);
|
||||
@@ -66,7 +70,7 @@ class NamespacedAttributeBag extends AttributeBag
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function set($name, $value)
|
||||
public function set(string $name, $value)
|
||||
{
|
||||
$attributes = &$this->resolveAttributePath($name, true);
|
||||
$name = $this->resolveKey($name);
|
||||
@@ -76,7 +80,7 @@ class NamespacedAttributeBag extends AttributeBag
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function remove($name)
|
||||
public function remove(string $name)
|
||||
{
|
||||
$retval = null;
|
||||
$attributes = &$this->resolveAttributePath($name);
|
||||
@@ -99,10 +103,10 @@ class NamespacedAttributeBag extends AttributeBag
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
protected function &resolveAttributePath($name, $writeContext = false)
|
||||
protected function &resolveAttributePath(string $name, bool $writeContext = false)
|
||||
{
|
||||
$array = &$this->attributes;
|
||||
$name = (0 === strpos($name, $this->namespaceCharacter)) ? substr($name, 1) : $name;
|
||||
$name = (str_starts_with($name, $this->namespaceCharacter)) ? substr($name, 1) : $name;
|
||||
|
||||
// Check if there is anything to do, else return
|
||||
if (!$name) {
|
||||
@@ -144,11 +148,9 @@ class NamespacedAttributeBag extends AttributeBag
|
||||
*
|
||||
* This is the last part in a dot separated string.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function resolveKey($name)
|
||||
protected function resolveKey(string $name)
|
||||
{
|
||||
if (false !== $pos = strrpos($name, $this->namespaceCharacter)) {
|
||||
$name = substr($name, $pos + 1);
|
||||
|
||||
Reference in New Issue
Block a user