Extract a phpactor mixin

This commit is contained in:
Oliver Davies 2025-04-05 09:00:00 +01:00
parent 44d2685854
commit 6443b72707
11 changed files with 13 additions and 7 deletions

View file

@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
namespace {{ prototype.namespace }};
{% for class in prototype.classes %}
final class {{ class.name }} implements \IteratorAggregate {
public function __construct(private array $items = []) {
}
public function getIterator(): \Iterator {
return new \ArrayIterator($this->items);
}
public function toArray(): array {
return $this->items;
}
}
{% endfor %}