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
@@ -58,11 +58,11 @@ public function __construct(
58
58
if ($typeinstanceof SubscribedService) {
59
59
$key = $type->key ?? $key;
60
60
$attributes = $type->attributes;
61
-
$type = ($type->nullable ? '?' : '').($type->type ?? thrownewInvalidArgumentException(sprintf('When "%s" is used, a type must be set.', SubscribedService::class)));
61
+
$type = ($type->nullable ? '?' : '').($type->type ?? thrownewInvalidArgumentException(\sprintf('When "%s" is used, a type must be set.', SubscribedService::class)));
62
62
}
63
63
64
64
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)) {
65
-
thrownewInvalidArgumentException(sprintf('"%s" is not a PHP type for key "%s".', \is_string($type) ? $type : get_debug_type($type), $key));
65
+
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
@@ -30,7 +30,7 @@ public function __construct(
30
30
publicfunctiongetParsedName(): string
31
31
{
32
32
if (null === $this->name) {
33
-
thrownewLogicException(sprintf('Cannot parse the name of a #[Target] attribute that has not been resolved. Did you forget to call "%s::parseName()"?', __CLASS__));
33
+
thrownewLogicException(\sprintf('Cannot parse the name of a #[Target] attribute that has not been resolved. Did you forget to call "%s::parseName()"?', __CLASS__));
@@ -56,7 +56,7 @@ public static function parseName(\ReflectionParameter $parameter, ?self &$attrib
56
56
$function = $function->name;
57
57
}
58
58
59
-
thrownewInvalidArgumentException(sprintf('Invalid #[Target] name "%s" on parameter "$%s" of "%s()": the first character must be a letter.', $name, $parameter->name, $function));
59
+
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)) {
176
176
if (null === $class) {
177
-
thrownewRuntimeException(sprintf('Invalid service "%s": the class is not set.', $this->currentId));
177
+
thrownewRuntimeException(\sprintf('Invalid service "%s": the class is not set.', $this->currentId));
178
178
}
179
179
180
-
thrownewRuntimeException(sprintf('Invalid service "%s": class "%s" does not exist.', $this->currentId, $class));
180
+
thrownewRuntimeException(\sprintf('Invalid service "%s": class "%s" does not exist.', $this->currentId, $class));
181
181
}
182
182
} catch (\ReflectionException$e) {
183
-
thrownewRuntimeException(sprintf('Invalid service "%s": ', $this->currentId).lcfirst($e->getMessage()));
183
+
thrownewRuntimeException(\sprintf('Invalid service "%s": ', $this->currentId).lcfirst($e->getMessage()));
184
184
}
185
185
if (!$r = $r->getConstructor()) {
186
186
if ($required) {
187
-
thrownewRuntimeException(sprintf('Invalid service "%s": class%s has no constructor.', $this->currentId, sprintf($class !== $this->currentId ? ' "%s"' : '', $class)));
187
+
thrownewRuntimeException(\sprintf('Invalid service "%s": class%s has no constructor.', $this->currentId, \sprintf($class !== $this->currentId ? ' "%s"' : '', $class)));
188
188
}
189
189
} elseif (!$r->isPublic()) {
190
-
thrownewRuntimeException(sprintf('Invalid service "%s": ', $this->currentId).sprintf($class !== $this->currentId ? 'constructor of class "%s"' : 'its constructor', $class).' must be public.');
190
+
thrownewRuntimeException(\sprintf('Invalid service "%s": ', $this->currentId).\sprintf($class !== $this->currentId ? 'constructor of class "%s"' : 'its constructor', $class).' must be public.');
191
191
}
192
192
193
193
return$r;
@@ -207,11 +207,11 @@ protected function getReflectionMethod(Definition $definition, string $method):
207
207
}
208
208
209
209
if (null === $class) {
210
-
thrownewRuntimeException(sprintf('Invalid service "%s": the class is not set.', $this->currentId));
210
+
thrownewRuntimeException(\sprintf('Invalid service "%s": the class is not set.', $this->currentId));
211
211
}
212
212
213
213
if (!$r = $this->container->getReflectionClass($class)) {
214
-
thrownewRuntimeException(sprintf('Invalid service "%s": class "%s" does not exist.', $this->currentId, $class));
214
+
thrownewRuntimeException(\sprintf('Invalid service "%s": class "%s" does not exist.', $this->currentId, $class));
215
215
}
216
216
217
217
if (!$r->hasMethod($method)) {
@@ -223,12 +223,12 @@ protected function getReflectionMethod(Definition $definition, string $method):
thrownewRuntimeException(sprintf('Invalid service "%s": method "%s()" does not exist.', $this->currentId, $class !== $this->currentId ? $class.'::'.$method : $method));
226
+
thrownewRuntimeException(\sprintf('Invalid service "%s": method "%s()" does not exist.', $this->currentId, $class !== $this->currentId ? $class.'::'.$method : $method));
227
227
}
228
228
229
229
$r = $r->getMethod($method);
230
230
if (!$r->isPublic()) {
231
-
thrownewRuntimeException(sprintf('Invalid service "%s": method "%s()" must be public.', $this->currentId, $class !== $this->currentId ? $class.'::'.$method : $method));
231
+
thrownewRuntimeException(\sprintf('Invalid service "%s": method "%s()" must be public.', $this->currentId, $class !== $this->currentId ? $class.'::'.$method : $method));
232
232
}
233
233
234
234
return$r;
@@ -249,12 +249,12 @@ private function getExpressionLanguage(): ExpressionLanguage
249
249
$arg = $this->processValue(newReference($id));
250
250
$this->inExpression = false;
251
251
if (!$arginstanceof Reference) {
252
-
thrownewRuntimeException(sprintf('"%s::processValue()" must return a Reference when processing an expression, "%s" returned for service("%s").', static::class, get_debug_type($arg), $id));
252
+
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