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

nette / di / 6739042234

02 Nov 2023 10:31PM UTC coverage: 93.846% (+41.8%) from 52.037%
6739042234

push

github

dg
Option 'class' is allowed again

Partially reverts commit 046f89cc3.

1 of 1 new or added line in 1 file covered. (100.0%)

2257 of 2405 relevant lines covered (93.85%)

0.94 hits per line

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

91.67
/src/DI/Extensions/ExtensionsExtension.php
1
<?php
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
declare(strict_types=1);
9

10
namespace Nette\DI\Extensions;
11

12
use Nette;
13

14

15
/**
16
 * Enables registration of other extensions in $config file
17
 */
18
class ExtensionsExtension extends Nette\DI\CompilerExtension
19
{
20
        public function getConfigSchema(): Nette\Schema\Schema
21
        {
22
                return Nette\Schema\Expect::arrayOf('string|Nette\DI\Definitions\Statement');
1✔
23
        }
24

25

26
        public function loadConfiguration()
27
        {
28
                foreach ($this->getConfig() as $name => $class) {
1✔
29
                        if (is_int($name)) {
1✔
30
                                $name = null;
×
31
                        }
32

33
                        $args = [];
1✔
34
                        if ($class instanceof Nette\DI\Definitions\Statement) {
1✔
35
                                [$class, $args] = [$class->getEntity(), $class->arguments];
1✔
36
                        }
37

38
                        if (!is_a($class, Nette\DI\CompilerExtension::class, true)) {
1✔
39
                                throw new Nette\DI\InvalidConfigurationException(sprintf(
1✔
40
                                        "Extension '%s' not found or is not Nette\\DI\\CompilerExtension descendant.",
1✔
41
                                        $class
42
                                ));
43
                        }
44

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

© 2026 Coveralls, Inc