Assert class instances of collection items

This commit is contained in:
Oliver Davies 2025-06-12 02:10:09 +01:00
parent 5ac1a6d95a
commit c84e6ed25c
3 changed files with 10 additions and 0 deletions

View file

@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Drupal\opd_presentations;
use Webmozart\Assert\Assert;
/**
* @implements \IteratorAggregate<Event>
*/
@ -13,6 +16,7 @@ readonly final class Events implements \IteratorAggregate {
* @param Event[] $events
*/
private function __construct(private array $events) {
Assert::allIsInstanceOf($events, Event::class);
}
public function filter(\Closure $callback): self {