• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nette / di / 40354306213

26 Oct 2026 03:56PM UTC coverage: 90.858% (+19.0%) from 71.881%
40354306213

push

github

dg
removed Statement compatibility shims from expression classes WIP

3 of 3 new or added lines in 2 files covered. (100.0%)

188 existing lines in 38 files now uncovered.

2733 of 3008 relevant lines covered (90.86%)

0.91 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.31
/src/DI/Extensions/ExtensionsExtension.php
1
<?php declare(strict_types=1);
2

3
/**
4
 * This file is part of the Nette Framework (https://nette.org)
5
 * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
6
 */
7

8
namespace Nette\DI\Extensions;
9

10
use Nette;
11
use Nette\DI\Attributes\Hook;
12
use Nette\DI\{ContainerBuilder, Phase};
13
use Nette\DI\Definitions\Statement;
14
use function is_int, is_string, sprintf;
15

16

17
/**
18
 * Enables registration of additional compiler extensions via configuration.
19
 */
20
class ExtensionsExtension extends Nette\DI\CompilerExtension
21
{
22
        /** @var array<int|string, string|Statement> */
23
        protected $config = [];
24

25

26
        public function getConfigSchema(): Nette\Schema\Schema
27
        {
28
                return Nette\Schema\Expect::arrayOf('string|Nette\DI\Definitions\Statement');
1 ✔
29
        }
30

31

32
        #[Hook(Phase::Setup, after: ParametersExtension::class)]
33
        public function doSetup(ContainerBuilder $builder): void
34
        {
35
                foreach ($this->config as $name => $class) {
1 ✔
36
                        if (is_int($name)) {
1 ✔
UNCOV
37
                                $name = null;
×
38
                        }
39

40
                        $args = [];
1 ✔
41
                        if ($class instanceof Nette\DI\Definitions\Statement) {
1 ✔
42
                                [$class, $args] = [$class->getEntity(), $class->arguments];
1 ✔
43
                        }
44

45
                        if (!is_string($class) || !is_a($class, Nette\DI\CompilerExtension::class, allow_string: true)) {
1 ✔
46
                                throw new Nette\DI\InvalidConfigurationException(sprintf(
1 ✔
47
                                        "Extension '%s' not found or is not Nette\\DI\\CompilerExtension descendant.",
48
                                        is_string($class) ? $class : get_debug_type($class),
1 ✔
49
                                ));
50
                        }
51

52
                        $this->compiler->addExtension($name, (new \ReflectionClass($class))->newInstanceArgs($args));
1 ✔
53
                }
54
        }
1 ✔
55
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc