Skip to content

Commit 2645ec3

Browse files
committed
removed dead code
1 parent 023d506 commit 2645ec3

6 files changed

+4
-40
lines changed

src/DI/Container.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ public function isCreated(string $name): bool
217217
* Creates new instance of the service.
218218
* @throws MissingServiceException
219219
*/
220-
public function createService(string $name, array $args = []): object
220+
public function createService(string $name): object
221221
{
222222
$name = $this->aliases[$name] ?? $name;
223223
$method = self::getMethodName($name);
@@ -226,10 +226,10 @@ public function createService(string $name, array $args = []): object
226226
throw new MissingServiceException(sprintf("Service '%s' not found.", $name));
227227
}
228228

229-
$service = $this->preventDeadLock($name, function () use ($callback, $args, $method) {
229+
$service = $this->preventDeadLock($name, function () use ($callback, $method) {
230230
return $callback instanceof \Closure
231-
? $callback(...$args)
232-
: $this->$method(...$args);
231+
? $callback()
232+
: $this->$method();
233233
});
234234

235235
if (!is_object($service)) {

tests/DI/Compiler.generatedFactory.phpt

-17
Original file line numberDiff line numberDiff line change
@@ -324,20 +324,3 @@ Assert::exception(function () {
324324
->setImplement(Bad6::class);
325325
$builder->complete();
326326
}, Nette\InvalidStateException::class, "Service 'one' (type of Bad6): Cannot implement Bad6::create(): factory method parameters (\$baz) are not matching Bad5::__construct() parameters (\$xxx).");
327-
328-
329-
330-
interface Bad7
331-
{
332-
public function get(): stdClass;
333-
}
334-
335-
Assert::exception(function () {
336-
$builder = new DI\ContainerBuilder;
337-
$builder->addDefinition(stdClass::class)->setCreator(stdClass::class);
338-
$builder->addAccessorDefinition('one')
339-
->setImplement(Bad7::class)
340-
->setClass(stdClass::class)
341-
->addSetup('method');
342-
$builder->complete();
343-
}, Nette\MemberAccessException::class, 'Call to undefined method Nette\DI\Definitions\AccessorDefinition::addSetup().');

tests/DI/Definitions.AccessorDefinition.api.phpt

-6
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,6 @@ interface Good1
4646
}
4747

4848

49-
Assert::exception(function () {
50-
$def = new AccessorDefinition;
51-
$def->setType('Foo');
52-
}, Nette\MemberAccessException::class);
53-
54-
5549
Assert::exception(function () {
5650
$def = new AccessorDefinition;
5751
$def->setImplement('Foo');

tests/DI/Definitions.FactoryDefinition.api.phpt

-6
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,6 @@ interface Good1
4040
}
4141

4242

43-
Assert::exception(function () {
44-
$def = new FactoryDefinition;
45-
$def->setType('Foo');
46-
}, Nette\MemberAccessException::class);
47-
48-
4943
Assert::exception(function () {
5044
$def = new FactoryDefinition;
5145
$def->setImplement('Foo');

tests/DI/Definitions.FactoryDefinition.render.phpt

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ test('', function () {
2525
$def->setImplement(Good2::class);
2626

2727
$builder = new Nette\DI\ContainerBuilder;
28-
$builder->addDefinition('a')->setType(stdClass::class);
2928
$resolver = new Nette\DI\Resolver($builder);
3029

3130
$resolver->resolveDefinition($def);

tests/DI/Definitions.LocatorDefinition.api.phpt

-6
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,6 @@ interface Good3
6363
}
6464

6565

66-
Assert::exception(function () {
67-
$def = new LocatorDefinition;
68-
$def->setType('Foo');
69-
}, Nette\MemberAccessException::class);
70-
71-
7266
Assert::exception(function () {
7367
$def = new LocatorDefinition;
7468
$def->setImplement('Foo');

0 commit comments

Comments
 (0)