1 | <?php declare(strict_types=1); |
||
2 | |||
3 | namespace Jasny\Container\Loader; |
||
4 | |||
5 | use Improved as i; |
||
6 | |||
7 | /** |
||
8 | * Load entries from declaration PHP files |
||
9 | */ |
||
10 | class EntryLoader extends AbstractLoader |
||
11 | { |
||
12 | /** |
||
13 | * Load new entries |
||
14 | * |
||
15 | * @return void |
||
16 | */ |
||
17 | 8 | protected function prepareNext(): void |
|
18 | { |
||
19 | 8 | if (!$this->items->valid()) { |
|
20 | 2 | return; |
|
21 | } |
||
22 | |||
23 | 6 | $file = $this->items->current(); |
|
24 | |||
25 | /** @noinspection PhpIncludeInspection */ |
||
26 | 6 | $entries = i\type_check( |
|
1 ignored issue
–
show
Bug
introduced
by
![]() |
|||
27 | 6 | (include $file), |
|
28 | 6 | 'array', |
|
29 | 6 | new \UnexpectedValueException("Failed to load container entries from '$file': Invalid or no return value") |
|
30 | ); |
||
31 | |||
32 | 6 | $this->entries = new \ArrayIterator($entries); |
|
33 | |||
34 | 6 | $this->items->next(); |
|
35 | 6 | } |
|
36 | } |
||
37 |