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
Copy file name to clipboardExpand all lines: Attribute/AutowireLocator.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -62,11 +62,11 @@ public function __construct(
62
62
if ($typeinstanceof SubscribedService) {
63
63
$key = $type->key ?? $key;
64
64
$attributes = $type->attributes;
65
-
$type = ($type->nullable ? '?' : '').($type->type ?? thrownewInvalidArgumentException(sprintf('When "%s" is used, a type must be set.', SubscribedService::class)));
65
+
$type = ($type->nullable ? '?' : '').($type->type ?? thrownewInvalidArgumentException(\sprintf('When "%s" is used, a type must be set.', SubscribedService::class)));
66
66
}
67
67
68
68
if (!\is_string($type) || !preg_match('/(?(DEFINE)(?<cn>[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+))(?(DEFINE)(?<fqcn>(?&cn)(?:\\\\(?&cn))*+))^\??(?&fqcn)(?:(?:\|(?&fqcn))*+|(?:&(?&fqcn))*+)$/', $type)) {
69
-
thrownewInvalidArgumentException(sprintf('"%s" is not a PHP type for key "%s".', \is_string($type) ? $type : get_debug_type($type), $key));
69
+
thrownewInvalidArgumentException(\sprintf('"%s" is not a PHP type for key "%s".', \is_string($type) ? $type : get_debug_type($type), $key));
Copy file name to clipboardExpand all lines: Attribute/Target.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@ public function __construct(public ?string $name = null)
32
32
publicfunctiongetParsedName(): string
33
33
{
34
34
if (null === $this->name) {
35
-
thrownewLogicException(sprintf('Cannot parse the name of a #[Target] attribute that has not been resolved. Did you forget to call "%s::parseName()"?', __CLASS__));
35
+
thrownewLogicException(\sprintf('Cannot parse the name of a #[Target] attribute that has not been resolved. Did you forget to call "%s::parseName()"?', __CLASS__));
@@ -58,7 +58,7 @@ public static function parseName(\ReflectionParameter $parameter, ?self &$attrib
58
58
$function = $function->name;
59
59
}
60
60
61
-
thrownewInvalidArgumentException(sprintf('Invalid #[Target] name "%s" on parameter "$%s" of "%s()": the first character must be a letter.', $name, $parameter->name, $function));
61
+
thrownewInvalidArgumentException(\sprintf('Invalid #[Target] name "%s" on parameter "$%s" of "%s()": the first character must be a letter.', $name, $parameter->name, $function));
if (!$r = $this->container->getReflectionClass($class)) {
170
170
if (null === $class) {
171
-
thrownewRuntimeException(sprintf('Invalid service "%s": the class is not set.', $this->currentId));
171
+
thrownewRuntimeException(\sprintf('Invalid service "%s": the class is not set.', $this->currentId));
172
172
}
173
173
174
-
thrownewRuntimeException(sprintf('Invalid service "%s": class "%s" does not exist.', $this->currentId, $class));
174
+
thrownewRuntimeException(\sprintf('Invalid service "%s": class "%s" does not exist.', $this->currentId, $class));
175
175
}
176
176
} catch (\ReflectionException$e) {
177
-
thrownewRuntimeException(sprintf('Invalid service "%s": ', $this->currentId).lcfirst($e->getMessage()));
177
+
thrownewRuntimeException(\sprintf('Invalid service "%s": ', $this->currentId).lcfirst($e->getMessage()));
178
178
}
179
179
if (!$r = $r->getConstructor()) {
180
180
if ($required) {
181
-
thrownewRuntimeException(sprintf('Invalid service "%s": class%s has no constructor.', $this->currentId, sprintf($class !== $this->currentId ? ' "%s"' : '', $class)));
181
+
thrownewRuntimeException(\sprintf('Invalid service "%s": class%s has no constructor.', $this->currentId, \sprintf($class !== $this->currentId ? ' "%s"' : '', $class)));
182
182
}
183
183
} elseif (!$r->isPublic()) {
184
-
thrownewRuntimeException(sprintf('Invalid service "%s": ', $this->currentId).sprintf($class !== $this->currentId ? 'constructor of class "%s"' : 'its constructor', $class).' must be public.');
184
+
thrownewRuntimeException(\sprintf('Invalid service "%s": ', $this->currentId).\sprintf($class !== $this->currentId ? 'constructor of class "%s"' : 'its constructor', $class).' must be public.');
185
185
}
186
186
187
187
return$r;
@@ -201,24 +201,24 @@ protected function getReflectionMethod(Definition $definition, string $method):
201
201
}
202
202
203
203
if (null === $class) {
204
-
thrownewRuntimeException(sprintf('Invalid service "%s": the class is not set.', $this->currentId));
204
+
thrownewRuntimeException(\sprintf('Invalid service "%s": the class is not set.', $this->currentId));
205
205
}
206
206
207
207
if (!$r = $this->container->getReflectionClass($class)) {
208
-
thrownewRuntimeException(sprintf('Invalid service "%s": class "%s" does not exist.', $this->currentId, $class));
208
+
thrownewRuntimeException(\sprintf('Invalid service "%s": class "%s" does not exist.', $this->currentId, $class));
209
209
}
210
210
211
211
if (!$r->hasMethod($method)) {
212
212
if ($r->hasMethod('__call') && ($r = $r->getMethod('__call')) && $r->isPublic()) {
thrownewRuntimeException(sprintf('Invalid service "%s": method "%s()" does not exist.', $this->currentId, $class !== $this->currentId ? $class.'::'.$method : $method));
216
+
thrownewRuntimeException(\sprintf('Invalid service "%s": method "%s()" does not exist.', $this->currentId, $class !== $this->currentId ? $class.'::'.$method : $method));
217
217
}
218
218
219
219
$r = $r->getMethod($method);
220
220
if (!$r->isPublic()) {
221
-
thrownewRuntimeException(sprintf('Invalid service "%s": method "%s()" must be public.', $this->currentId, $class !== $this->currentId ? $class.'::'.$method : $method));
221
+
thrownewRuntimeException(\sprintf('Invalid service "%s": method "%s()" must be public.', $this->currentId, $class !== $this->currentId ? $class.'::'.$method : $method));
222
222
}
223
223
224
224
return$r;
@@ -239,12 +239,12 @@ private function getExpressionLanguage(): ExpressionLanguage
239
239
$arg = $this->processValue(newReference($id));
240
240
$this->inExpression = false;
241
241
if (!$arginstanceof Reference) {
242
-
thrownewRuntimeException(sprintf('"%s::processValue()" must return a Reference when processing an expression, "%s" returned for service("%s").', static::class, get_debug_type($arg), $id));
242
+
thrownewRuntimeException(\sprintf('"%s::processValue()" must return a Reference when processing an expression, "%s" returned for service("%s").', static::class, get_debug_type($arg), $id));
thrownewLogicException(sprintf('Argument "$%s" of attribute autoconfigurator should have a type, use one or more of "\ReflectionClass|\ReflectionMethod|\ReflectionProperty|\ReflectionParameter|\Reflector" in "%s" on line "%d".', $reflectorParameter->getName(), $callableReflector->getFileName(), $callableReflector->getStartLine()));
55
+
thrownewLogicException(\sprintf('Argument "$%s" of attribute autoconfigurator should have a type, use one or more of "\ReflectionClass|\ReflectionMethod|\ReflectionProperty|\ReflectionParameter|\Reflector" in "%s" on line "%d".', $reflectorParameter->getName(), $callableReflector->getFileName(), $callableReflector->getStartLine()));
56
56
}
57
57
58
58
try {
@@ -70,7 +70,7 @@ public function process(ContainerBuilder $container): void
70
70
continue;
71
71
}
72
72
if (!($targets & \constant('Attribute::TARGET_'.strtoupper($symbol)))) {
73
-
thrownewLogicException(sprintf('Invalid type "Reflection%s" on argument "$%s": attribute "%s" cannot target a '.$symbol.' in "%s" on line "%d".', ucfirst($symbol), $reflectorParameter->getName(), $attributeName, $callableReflector->getFileName(), $callableReflector->getStartLine()));
73
+
thrownewLogicException(\sprintf('Invalid type "Reflection%s" on argument "$%s": attribute "%s" cannot target a '.$symbol.' in "%s" on line "%d".', ucfirst($symbol), $reflectorParameter->getName(), $attributeName, $callableReflector->getFileName(), $callableReflector->getStartLine()));
0 commit comments