Assert class instances of collection items
This commit is contained in:
parent
5ac1a6d95a
commit
c84e6ed25c
3 changed files with 10 additions and 0 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue