diff --git a/modules/opd_daily_emails/src/DailyEmails.php b/modules/opd_daily_emails/src/DailyEmails.php index 0041c7ec5..f2bde6c8d 100644 --- a/modules/opd_daily_emails/src/DailyEmails.php +++ b/modules/opd_daily_emails/src/DailyEmails.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace Drupal\opd_daily_emails; use Drupal\node\NodeInterface; +use Webmozart\Assert\Assert; final class DailyEmails implements \Countable { @@ -14,6 +15,7 @@ final class DailyEmails implements \Countable { private function __construct( private array $emails, ) { + Assert::allIsInstanceOf($emails, NodeInterface::class); } public function count(): int { diff --git a/modules/opd_podcast/src/Guests.php b/modules/opd_podcast/src/Guests.php index 5ca818613..4f6bd29a3 100644 --- a/modules/opd_podcast/src/Guests.php +++ b/modules/opd_podcast/src/Guests.php @@ -4,6 +4,9 @@ declare(strict_types=1); namespace Drupal\opd_podcast; +use Webmozart\Assert\Assert; + + /** * @implements \IteratorAggregate */ @@ -13,6 +16,7 @@ final class Guests implements \Countable, \IteratorAggregate, \Stringable { * @param Guest[] $guests */ private function __construct(private array $guests) { + Assert::allIsInstanceOf($guests, Guest::class); } public function count(): int { diff --git a/modules/opd_presentations/src/Events.php b/modules/opd_presentations/src/Events.php index b509d4de6..f79049686 100644 --- a/modules/opd_presentations/src/Events.php +++ b/modules/opd_presentations/src/Events.php @@ -4,6 +4,9 @@ declare(strict_types=1); namespace Drupal\opd_presentations; +use Webmozart\Assert\Assert; + + /** * @implements \IteratorAggregate */ @@ -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 {