Skip to content

[Site] Fix infinite demo CS #1725

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions ux.symfony.com/src/Service/EmojiCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@

namespace App\Service;

use IteratorAggregate;
use Traversable;

/**
* Collection of emojis used in demos.
*
* @implements IteratorAggregate<string>
* @implements \IteratorAggregate<string>
*
* @internal
*/
final class EmojiCollection implements IteratorAggregate, \Countable
final class EmojiCollection implements \IteratorAggregate, \Countable
{
private array $emojis;

Expand All @@ -23,17 +20,17 @@ public function __construct(array $emojis = [])

public function paginate(int $page, int $perPage): self
{
return new self(array_slice($this->emojis, ($page - 1) * $perPage, $perPage));
return new self(\array_slice($this->emojis, ($page - 1) * $perPage, $perPage));
}

public function getIterator(): Traversable
public function getIterator(): \Traversable
{
return new \ArrayIterator($this->emojis);
}

public function count(): int
{
return count($this->emojis);
return \count($this->emojis);
}

private function loadEmojis(): array
Expand Down
2 changes: 1 addition & 1 deletion ux.symfony.com/src/Service/LiveDemoRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function findAll(): array
route: 'app_demo_live_component_infinite_scroll',
longDescription: <<<EOF
Infinite scroll allows users to continuously load content as they scroll down the page.
<br><code>Part One</code> of this demo shows how to <code>append new items</code> to the page with a <a href="/live-component"><code>LiveComponent</code></a>.
<br><code>Part One</code> of this demo shows how to <code>append new items</code> to the page with a <a href="/live-component"><code>LiveComponent</code></a>.
EOF,
),
new LiveDemo(
Expand Down
2 changes: 1 addition & 1 deletion ux.symfony.com/src/Twig/ProductGrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function getItems(): array
$items[] = [
'id' => $id = ($this->page - 1) * self::PER_PAGE + $i,
'emoji' => $emoji,
'color' => $colors[$id % count($colors)],
'color' => $colors[$id % \count($colors)],
];
}

Expand Down