mirror of
https://github.com/doctrine/collections.git
synced 2026-03-24 06:32:10 +01:00
31 lines
657 B
PHP
31 lines
657 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Doctrine\Tests\Common\Collections;
|
|
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use stdClass;
|
|
|
|
/**
|
|
* Simple collection implements different constructor semantics.
|
|
*/
|
|
final class DerivedArrayCollection extends ArrayCollection
|
|
{
|
|
/** @param mixed[] $elements */
|
|
public function __construct(private readonly stdClass $foo, array $elements = [])
|
|
{
|
|
parent::__construct($elements);
|
|
}
|
|
|
|
/**
|
|
* @param mixed[] $elements
|
|
*
|
|
* @return self<mixed>
|
|
*/
|
|
protected function createFrom(array $elements): static
|
|
{
|
|
return new static($this->foo, $elements);
|
|
}
|
|
}
|