-
-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathInstancesCollection.php
More file actions
48 lines (43 loc) · 1.27 KB
/
InstancesCollection.php
File metadata and controls
48 lines (43 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
declare(strict_types=1);
namespace Arrayy\Type;
use Arrayy\ArrayyIterator;
use Arrayy\Collection\Collection;
/**
* @template TKey of array-key
* @template T of object
* @extends Collection<TKey,T>
*/
final class InstancesCollection extends Collection implements TypeInterface
{
/**
* @param array<object> $data
* @param string|null $iteratorClass
* @param bool|null $checkPropertiesInConstructor
* @param string[]|null $classNames
*
* @phpstan-param array<TKey,T> $data
* @phpstan-param class-string<\Arrayy\ArrayyIterator>|null $iteratorClass
* @phpstan-param array<class-string<T>>|null $classNames
*/
public function __construct(
array $data = [],
?string $iteratorClass = null,
?bool $checkPropertiesInConstructor = null,
?array $classNames = null
) {
// fallback
if ($iteratorClass === null) {
$iteratorClass = ArrayyIterator::class;
}
if ($checkPropertiesInConstructor === null) {
$checkPropertiesInConstructor = true;
}
parent::__construct(
$data,
$iteratorClass,
$checkPropertiesInConstructor,
self::convertIntoTypeCheckArray($classNames)
);
}
}