Skip to content

Commit

Permalink
fix typing and charset and description
Browse files Browse the repository at this point in the history
  • Loading branch information
Sarah-eit committed Jun 17, 2024
1 parent e71e34c commit fa767a1
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/Extension/CoreExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public function getFilters(): array

// string/array filters
new TwigFilter('reverse', [self::class, 'reverse'], ['needs_charset' => true]),
new TwigFilter('shuffle', [self::class, 'shuffleFilter'], ['needs_environment' => true]),
new TwigFilter('shuffle', [self::class, 'shuffle'], ['needs_charset' => true]),
new TwigFilter('length', [self::class, 'length'], ['needs_charset' => true]),
new TwigFilter('slice', [self::class, 'slice'], ['needs_charset' => true]),
new TwigFilter('first', [self::class, 'first'], ['needs_charset' => true]),
Expand Down Expand Up @@ -897,16 +897,14 @@ public static function reverse(string $charset, $item, $preserveKeys = false)
}

/**
* Shuffle an array, a \Traversable instance, or a string.
* Shuffles an array, a \Traversable instance, or a string.
* The function does not preserve keys.
*
* @internal
*/
public static function shuffleFilter(Environment $env, mixed $item): mixed
public static function shuffle(string $charset, array|\Traversable|string|null $item): mixed
{
if (\is_string($item)) {
$charset = $env->getCharset();

if ('UTF-8' !== $charset) {
$item = self::convertEncoding($item, 'UTF-8', $charset);
}
Expand Down

0 comments on commit fa767a1

Please sign in to comment.