diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 8bc3a72b981..4fe7d185735 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -1,9 +1,9 @@ array( 'name' => 'limesurvey/limesurvey', - 'pretty_version' => 'dev-develop', - 'version' => 'dev-develop', - 'reference' => 'cd572b85685ddbd54e8f45659262f5d1abfddc08', + 'pretty_version' => 'dev-master', + 'version' => 'dev-master', + 'reference' => '751073b4f2744a7334bfd972163f614bbcb9ba2f', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -38,18 +38,18 @@ 'dev_requirement' => false, ), 'laravel/serializable-closure' => array( - 'pretty_version' => 'v1.3.0', - 'version' => '1.3.0.0', - 'reference' => 'f23fe9d4e95255dacee1bf3525e0810d1a1b0f37', + 'pretty_version' => 'v1.3.1', + 'version' => '1.3.1.0', + 'reference' => 'e5a3057a5591e1cfe8183034b0203921abe2c902', 'type' => 'library', 'install_path' => __DIR__ . '/../laravel/serializable-closure', 'aliases' => array(), 'dev_requirement' => false, ), 'limesurvey/limesurvey' => array( - 'pretty_version' => 'dev-develop', - 'version' => 'dev-develop', - 'reference' => 'cd572b85685ddbd54e8f45659262f5d1abfddc08', + 'pretty_version' => 'dev-master', + 'version' => 'dev-master', + 'reference' => '751073b4f2744a7334bfd972163f614bbcb9ba2f', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -248,9 +248,9 @@ 'dev_requirement' => false, ), 'twig/twig' => array( - 'pretty_version' => 'v3.6.1', - 'version' => '3.6.1.0', - 'reference' => '7e7d5839d4bec168dfeef0ac66d5c5a2edbabffd', + 'pretty_version' => 'v3.7.0', + 'version' => '3.7.0.0', + 'reference' => '5cf942bbab3df42afa918caeba947f1b690af64b', 'type' => 'library', 'install_path' => __DIR__ . '/../twig/twig', 'aliases' => array(), diff --git a/vendor/laravel/serializable-closure/src/Support/ReflectionClosure.php b/vendor/laravel/serializable-closure/src/Support/ReflectionClosure.php index a0d37075275..d2a701056a1 100644 --- a/vendor/laravel/serializable-closure/src/Support/ReflectionClosure.php +++ b/vendor/laravel/serializable-closure/src/Support/ReflectionClosure.php @@ -511,8 +511,7 @@ public function getCode() // named arguments... case ':': if ($lastState === 'closure' && $context === 'root') { - $state = 'ignore_next'; - $lastState = 'closure'; + $state = 'closure'; $code .= $id_start.$token; } @@ -651,7 +650,7 @@ public function getCode() $state = 'id_name'; $context = 'extends'; $lastState = 'anonymous'; - break; + break; case '{': $state = 'closure'; if (! $inside_structure) { diff --git a/vendor/twig/twig/CHANGELOG b/vendor/twig/twig/CHANGELOG index c3d65518e1f..b6551155c2e 100644 --- a/vendor/twig/twig/CHANGELOG +++ b/vendor/twig/twig/CHANGELOG @@ -1,3 +1,7 @@ +# 3.7.0 (2023-07-26) + + * Add support for the ...spread operator on arrays and hashes + # 3.6.1 (2023-06-08) * Suppress some native return type deprecation messages diff --git a/vendor/twig/twig/src/Environment.php b/vendor/twig/twig/src/Environment.php index 70405b0d7e7..3c630c1b30c 100644 --- a/vendor/twig/twig/src/Environment.php +++ b/vendor/twig/twig/src/Environment.php @@ -40,11 +40,11 @@ */ class Environment { - public const VERSION = '3.6.1'; - public const VERSION_ID = 30601; + public const VERSION = '3.7.0'; + public const VERSION_ID = 30700; public const MAJOR_VERSION = 3; - public const MINOR_VERSION = 6; - public const RELEASE_VERSION = 1; + public const MINOR_VERSION = 7; + public const RELEASE_VERSION = 0; public const EXTRA_VERSION = ''; private $charset; diff --git a/vendor/twig/twig/src/ExpressionParser.php b/vendor/twig/twig/src/ExpressionParser.php index 2048c3c5486..38347cb391d 100644 --- a/vendor/twig/twig/src/ExpressionParser.php +++ b/vendor/twig/twig/src/ExpressionParser.php @@ -334,7 +334,14 @@ public function parseArrayExpression() } $first = false; - $node->addElement($this->parseExpression()); + if ($stream->test(/* Token::SPREAD_TYPE */ 13)) { + $stream->next(); + $expr = $this->parseExpression(); + $expr->setAttribute('spread', true); + $node->addElement($expr); + } else { + $node->addElement($this->parseExpression()); + } } $stream->expect(/* Token::PUNCTUATION_TYPE */ 9, ']', 'An opened array is not properly closed'); @@ -359,6 +366,14 @@ public function parseHashExpression() } $first = false; + if ($stream->test(/* Token::SPREAD_TYPE */ 13)) { + $stream->next(); + $value = $this->parseExpression(); + $value->setAttribute('spread', true); + $node->addElement($value); + continue; + } + // a hash key can be: // // * a number -- 12 diff --git a/vendor/twig/twig/src/Extension/CoreExtension.php b/vendor/twig/twig/src/Extension/CoreExtension.php index f99adda451b..0f1a10216f3 100644 --- a/vendor/twig/twig/src/Extension/CoreExtension.php +++ b/vendor/twig/twig/src/Extension/CoreExtension.php @@ -609,32 +609,34 @@ function twig_urlencode_filter($url) } /** - * Merges an array with another one. + * Merges any number of arrays or Traversable objects. * * {% set items = { 'apple': 'fruit', 'orange': 'fruit' } %} * - * {% set items = items|merge({ 'peugeot': 'car' }) %} + * {% set items = items|merge({ 'peugeot': 'car' }, { 'banana': 'fruit' }) %} * - * {# items now contains { 'apple': 'fruit', 'orange': 'fruit', 'peugeot': 'car' } #} + * {# items now contains { 'apple': 'fruit', 'orange': 'fruit', 'peugeot': 'car', 'banana': 'fruit' } #} * - * @param array|\Traversable $arr1 An array - * @param array|\Traversable $arr2 An array + * @param array|\Traversable ...$arrays Any number of arrays or Traversable objects to merge * * @return array The merged array */ -function twig_array_merge($arr1, $arr2) +function twig_array_merge(...$arrays) { - if (!twig_test_iterable($arr1)) { - throw new RuntimeError(sprintf('The merge filter only works with arrays or "Traversable", got "%s" as first argument.', \gettype($arr1))); - } + $result = []; + + foreach ($arrays as $argNumber => $array) { + if (!twig_test_iterable($array)) { + throw new RuntimeError(sprintf('The merge filter only works with arrays or "Traversable", got "%s" for argument %d.', \gettype($array), $argNumber + 1)); + } - if (!twig_test_iterable($arr2)) { - throw new RuntimeError(sprintf('The merge filter only works with arrays or "Traversable", got "%s" as second argument.', \gettype($arr2))); + $result = array_merge($result, twig_to_array($array)); } - return array_merge(twig_to_array($arr1), twig_to_array($arr2)); + return $result; } + /** * Slices a variable. * diff --git a/vendor/twig/twig/src/Lexer.php b/vendor/twig/twig/src/Lexer.php index 975b0b924ff..6c45efbc9f6 100644 --- a/vendor/twig/twig/src/Lexer.php +++ b/vendor/twig/twig/src/Lexer.php @@ -315,8 +315,13 @@ private function lexExpression(): void } } + // spread operator + if ('.' === $this->code[$this->cursor] && ($this->cursor + 2 < $this->end) && '.' === $this->code[$this->cursor + 1] && '.' === $this->code[$this->cursor + 2]) { + $this->pushToken(Token::SPREAD_TYPE, '...'); + $this->moveCursor('...'); + } // arrow function - if ('=' === $this->code[$this->cursor] && '>' === $this->code[$this->cursor + 1]) { + elseif ('=' === $this->code[$this->cursor] && '>' === $this->code[$this->cursor + 1]) { $this->pushToken(Token::ARROW_TYPE, '=>'); $this->moveCursor('=>'); } diff --git a/vendor/twig/twig/src/Node/Expression/ArrayExpression.php b/vendor/twig/twig/src/Node/Expression/ArrayExpression.php index 0e25fe46ad8..44428380239 100644 --- a/vendor/twig/twig/src/Node/Expression/ArrayExpression.php +++ b/vendor/twig/twig/src/Node/Expression/ArrayExpression.php @@ -66,20 +66,70 @@ public function addElement(AbstractExpression $value, AbstractExpression $key = public function compile(Compiler $compiler): void { + $keyValuePairs = $this->getKeyValuePairs(); + $needsArrayMergeSpread = \PHP_VERSION_ID < 80100 && $this->hasSpreadItem($keyValuePairs); + + if ($needsArrayMergeSpread) { + $compiler->raw('twig_array_merge('); + } $compiler->raw('['); $first = true; - foreach ($this->getKeyValuePairs() as $pair) { + $reopenAfterMergeSpread = false; + $nextIndex = 0; + foreach ($keyValuePairs as $pair) { + if ($reopenAfterMergeSpread) { + $compiler->raw(', ['); + $reopenAfterMergeSpread = false; + } + + if ($needsArrayMergeSpread && $pair['value']->hasAttribute('spread')) { + $compiler->raw('], ')->subcompile($pair['value']); + $first = true; + $reopenAfterMergeSpread = true; + continue; + } if (!$first) { $compiler->raw(', '); } $first = false; - $compiler - ->subcompile($pair['key']) - ->raw(' => ') - ->subcompile($pair['value']) - ; + if ($pair['value']->hasAttribute('spread') && !$needsArrayMergeSpread) { + $compiler->raw('...')->subcompile($pair['value']); + ++$nextIndex; + } else { + $key = $pair['key'] instanceof ConstantExpression ? $pair['key']->getAttribute('value') : null; + + if ($nextIndex !== $key) { + if (\is_int($key)) { + $nextIndex = $key + 1; + } + $compiler + ->subcompile($pair['key']) + ->raw(' => ') + ; + } else { + ++$nextIndex; + } + + $compiler->subcompile($pair['value']); + } + } + if (!$reopenAfterMergeSpread) { + $compiler->raw(']'); } - $compiler->raw(']'); + if ($needsArrayMergeSpread) { + $compiler->raw(')'); + } + } + + private function hasSpreadItem(array $pairs): bool + { + foreach ($pairs as $pair) { + if ($pair['value']->hasAttribute('spread')) { + return true; + } + } + + return false; } } diff --git a/vendor/twig/twig/src/Token.php b/vendor/twig/twig/src/Token.php index 53a6cafc350..fd1a89d2adc 100644 --- a/vendor/twig/twig/src/Token.php +++ b/vendor/twig/twig/src/Token.php @@ -35,6 +35,7 @@ final class Token public const INTERPOLATION_START_TYPE = 10; public const INTERPOLATION_END_TYPE = 11; public const ARROW_TYPE = 12; + public const SPREAD_TYPE = 13; public function __construct(int $type, $value, int $lineno) { @@ -133,6 +134,9 @@ public static function typeToString(int $type, bool $short = false): string case self::ARROW_TYPE: $name = 'ARROW_TYPE'; break; + case self::SPREAD_TYPE: + $name = 'SPREAD_TYPE'; + break; default: throw new \LogicException(sprintf('Token of type "%s" does not exist.', $type)); } @@ -171,6 +175,8 @@ public static function typeToEnglish(int $type): string return 'end of string interpolation'; case self::ARROW_TYPE: return 'arrow function'; + case self::SPREAD_TYPE: + return 'spread operator'; default: throw new \LogicException(sprintf('Token of type "%s" does not exist.', $type)); } diff --git a/vendor/twig/twig/src/TwigFilter.php b/vendor/twig/twig/src/TwigFilter.php index 94e5f9b012b..e59919dd310 100644 --- a/vendor/twig/twig/src/TwigFilter.php +++ b/vendor/twig/twig/src/TwigFilter.php @@ -29,7 +29,7 @@ final class TwigFilter private $arguments = []; /** - * @param callable|null $callable A callable implementing the filter. If null, you need to overwrite the "node_class" option to customize compilation. + * @param callable|array|null $callable A callable implementing the filter. If null, you need to overwrite the "node_class" option to customize compilation. */ public function __construct(string $name, $callable = null, array $options = []) { @@ -57,7 +57,7 @@ public function getName(): string /** * Returns the callable to execute for this filter. * - * @return callable|null + * @return callable|array|null */ public function getCallable() { diff --git a/vendor/twig/twig/src/TwigFunction.php b/vendor/twig/twig/src/TwigFunction.php index 494d45b08c5..c10813224d2 100644 --- a/vendor/twig/twig/src/TwigFunction.php +++ b/vendor/twig/twig/src/TwigFunction.php @@ -29,7 +29,7 @@ final class TwigFunction private $arguments = []; /** - * @param callable|null $callable A callable implementing the function. If null, you need to overwrite the "node_class" option to customize compilation. + * @param callable|array|null $callable A callable implementing the function. If null, you need to overwrite the "node_class" option to customize compilation. */ public function __construct(string $name, $callable = null, array $options = []) { @@ -55,7 +55,7 @@ public function getName(): string /** * Returns the callable to execute for this function. * - * @return callable|null + * @return callable|array|null */ public function getCallable() { diff --git a/vendor/twig/twig/src/TwigTest.php b/vendor/twig/twig/src/TwigTest.php index 4c18632f559..7b81d9978e1 100644 --- a/vendor/twig/twig/src/TwigTest.php +++ b/vendor/twig/twig/src/TwigTest.php @@ -28,7 +28,7 @@ final class TwigTest private $arguments = []; /** - * @param callable|null $callable A callable implementing the test. If null, you need to overwrite the "node_class" option to customize compilation. + * @param callable|array|null $callable A callable implementing the test. If null, you need to overwrite the "node_class" option to customize compilation. */ public function __construct(string $name, $callable = null, array $options = []) { @@ -51,7 +51,7 @@ public function getName(): string /** * Returns the callable to execute for this test. * - * @return callable|null + * @return callable|array|null */ public function getCallable() {