You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thrownewServiceCreationException(sprintf('Method %s() is not callable.', Nette\Utils\Callback::toString($entity)), 0, $e ?? null);
125
+
thrownewServiceCreationException(sprintf('Method %s() is not callable.', Callback::toString($entity)), 0, $e ?? null);
125
126
}
126
127
$this->addDependency($reflection);
127
128
128
-
$type = Helpers::getReturnType($reflection);
129
-
if ($type && !class_exists($type) && !interface_exists($type)) {
130
-
thrownewServiceCreationException(sprintf("Class or interface '%s' not found. Check the return type of %s() method.", $type, Nette\Utils\Callback::toString($entity)));
Copy file name to clipboardExpand all lines: tests/DI/ContainerBuilder.factory.resolveBuiltinTypes.phpt
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -82,7 +82,7 @@ namespace
82
82
$builder->addDefinition('a')
83
83
->setFactory('@factory::createArray');
84
84
$container = createContainer($builder);
85
-
}, Nette\DI\ServiceCreationException::class, "Service 'a': Class or interface 'array' not found. Check the return type of A\\Factory::createArray() method.");
85
+
}, Nette\DI\ServiceCreationException::class, "Service 'a': Return type of A\\Factory::createArray() is not expected to be union/intersection/built-in, 'array' given.");
86
86
87
87
Assert::exception(function () {
88
88
$builder = newDI\ContainerBuilder;
@@ -91,7 +91,7 @@ namespace
91
91
$builder->addDefinition('c')
92
92
->setFactory('@factory::createCallable');
93
93
$container = createContainer($builder);
94
-
}, Nette\DI\ServiceCreationException::class, "Service 'c': Class or interface 'callable' not found. Check the return type of A\\Factory::createCallable() method.");
94
+
}, Nette\DI\ServiceCreationException::class, "Service 'c': Return type of A\\Factory::createCallable() is not expected to be union/intersection/built-in, 'callable' given.");
95
95
96
96
Assert::exception(function () {
97
97
$builder = newDI\ContainerBuilder;
@@ -100,7 +100,7 @@ namespace
100
100
$builder->addDefinition('s')
101
101
->setFactory('@factory::createString');
102
102
$container = createContainer($builder);
103
-
}, Nette\DI\ServiceCreationException::class, "Service 's': Class or interface 'string' not found. Check the return type of A\\Factory::createString() method.");
103
+
}, Nette\DI\ServiceCreationException::class, "Service 's': Return type of A\\Factory::createString() is not expected to be union/intersection/built-in, 'string' given.");
104
104
105
105
Assert::exception(function () {
106
106
$builder = newDI\ContainerBuilder;
@@ -109,7 +109,7 @@ namespace
109
109
$builder->addDefinition('i')
110
110
->setFactory('@factory::createInt');
111
111
$container = createContainer($builder);
112
-
}, Nette\DI\ServiceCreationException::class, "Service 'i': Class or interface 'int' not found. Check the return type of A\\Factory::createInt() method.");
112
+
}, Nette\DI\ServiceCreationException::class, "Service 'i': Return type of A\\Factory::createInt() is not expected to be union/intersection/built-in, 'int' given.");
113
113
114
114
Assert::exception(function () {
115
115
$builder = newDI\ContainerBuilder;
@@ -118,7 +118,7 @@ namespace
118
118
$builder->addDefinition('b')
119
119
->setFactory('@factory::createBool');
120
120
$container = createContainer($builder);
121
-
}, Nette\DI\ServiceCreationException::class, "Service 'b': Class or interface 'bool' not found. Check the return type of A\\Factory::createBool() method.");
121
+
}, Nette\DI\ServiceCreationException::class, "Service 'b': Return type of A\\Factory::createBool() is not expected to be union/intersection/built-in, 'bool' given.");
122
122
123
123
Assert::exception(function () {
124
124
$builder = newDI\ContainerBuilder;
@@ -127,7 +127,7 @@ namespace
127
127
$builder->addDefinition('f')
128
128
->setFactory('@factory::createFloat');
129
129
$container = createContainer($builder);
130
-
}, Nette\DI\ServiceCreationException::class, "Service 'f': Class or interface 'float' not found. Check the return type of A\\Factory::createFloat() method.");
130
+
}, Nette\DI\ServiceCreationException::class, "Service 'f': Return type of A\\Factory::createFloat() is not expected to be union/intersection/built-in, 'float' given.");
0 commit comments