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_podcast;
use Webmozart\Assert\Assert;
/**
* @implements \IteratorAggregate<Guest>
*/
@ -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 {