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
// The exception code is set to 1 if the exception must be thrown even if it's an optional setter
308
-
if (1 === $e->getCode() || self::MODE_REQUIRED === $mode) {
309
-
throw$e;
310
-
}
311
-
312
-
returnarray();
313
-
}
314
-
}
315
-
} else {
316
-
// Typehint against a non-existing class
317
-
318
-
if (!$parameter->isDefaultValueAvailable()) {
319
-
if (self::MODE_REQUIRED === $mode) {
320
-
thrownewRuntimeException(sprintf('Cannot autowire argument $%s of method %s::%s() for service "%s": Class %s does not exist.', $parameter->name, $reflectionMethod->class, $reflectionMethod->name, $this->currentId, $typeName));
$message = sprintf('Unable to autowire argument of type "%s" for the service "%s". No services were found matching this %s and it cannot be auto-registered.', $typeName, $this->currentId, $classOrInterface);
286
+
} else {
287
+
$message = sprintf('Cannot autowire argument $%s of method %s::%s() for service "%s": Class %s does not exist.', $parameter->name, $reflectionMethod->class, $reflectionMethod->name, $this->currentId, $typeName);
324
288
}
325
289
326
-
$value = $parameter->getDefaultValue();
290
+
thrownewRuntimeException($message);
291
+
} else {
292
+
returnarray();
327
293
}
328
294
329
295
$arguments[$index] = $value;
@@ -356,42 +322,39 @@ private function autowireOverridenGetters(array $overridenGetters, array $autowi
thrownewRuntimeException(sprintf('Unable to autowire argument of type "%s" for the service "%s". Multiple services exist for this %s (%s).', $typeHint->name, $this->currentId, $classOrInterface, $matchingServices), 1);
453
+
thrownewRuntimeException(sprintf('Unable to autowire argument of type "%s" for the service "%s". Multiple services exist for this %s (%s).', $typeHint->name, $this->currentId, $classOrInterface, $matchingServices));
thrownewRuntimeException(sprintf('Unable to autowire argument of type "%s" for the service "%s". No services were found matching this %s and it cannot be auto-registered.', $typeHint->name, $this->currentId, $classOrInterface));
457
+
return;
496
458
}
497
459
498
460
$currentId = $this->currentId;
@@ -504,14 +466,8 @@ private function createAutowiredDefinition(\ReflectionClass $typeHint)
$message = sprintf('Unable to autowire argument of type "%s" for the service "%s". No services were found matching this %s and it cannot be auto-registered.', $typeHint->name, $this->currentId, $classOrInterface);
thrownewInvalidArgumentException(sprintf('You cannot dump a container with parameters that contain special arguments. "%s" found in "%s".', get_class($value), $path.'/'.$key));
1292
1295
} elseif ($valueinstanceof Variable) {
1293
1296
thrownewInvalidArgumentException(sprintf('You cannot dump a container with parameters that contain variable references. Variable "%s" found in "%s".', $value, $path.'/'.$key));
1294
1297
} elseif ($valueinstanceof Definition) {
@@ -1461,6 +1464,8 @@ private function getDefinitionsFromArguments(array $arguments)