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: src/Symfony/Component/DependencyInjection/Compiler/CheckArgumentsValidityPass.php
+32
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,13 @@ protected function processValue($value, $isRoot = false)
39
39
}
40
40
41
41
$i = 0;
42
+
$hasNamedArgs = false;
42
43
foreach ($value->getArguments() as$k => $v) {
44
+
if (\PHP_VERSION_ID >= 80000 && preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $k)) {
45
+
$hasNamedArgs = true;
46
+
continue;
47
+
}
48
+
43
49
if ($k !== $i++) {
44
50
if (!\is_int($k)) {
45
51
$msg = sprintf('Invalid constructor argument for service "%s": integer expected but found string "%s". Check your service definition.', $this->currentId, $k);
@@ -57,11 +63,27 @@ protected function processValue($value, $isRoot = false)
57
63
thrownewRuntimeException($msg);
58
64
}
59
65
}
66
+
67
+
if ($hasNamedArgs) {
68
+
$msg = sprintf('Invalid constructor argument for service "%s": cannot use positional argument after named argument. Check your service definition.', $this->currentId);
if (\PHP_VERSION_ID >= 80000 && preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $k)) {
83
+
$hasNamedArgs = true;
84
+
continue;
85
+
}
86
+
65
87
if ($k !== $i++) {
66
88
if (!\is_int($k)) {
67
89
$msg = sprintf('Invalid argument for method call "%s" of service "%s": integer expected but found string "%s". Check your service definition.', $methodCall[0], $this->currentId, $k);
@@ -79,6 +101,16 @@ protected function processValue($value, $isRoot = false)
79
101
thrownewRuntimeException($msg);
80
102
}
81
103
}
104
+
105
+
if ($hasNamedArgs) {
106
+
$msg = sprintf('Invalid argument for method call "%s" of service "%s": cannot use positional argument after named argument. Check your service definition.', $methodCall[0], $this->currentId);
0 commit comments