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_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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue