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
if (($r = ($r ?? $container->getReflectionClass($class))) && $r->hasMethod($defaultPriorityMethod)) {
71
-
if (!($rm = $r->getMethod($defaultPriorityMethod))->isStatic()) {
72
-
thrownewInvalidArgumentException(sprintf('Method "%s::%s()" should be static: tag "%s" on service "%s".', $class, $defaultPriorityMethod, $tagName, $serviceId));
73
-
}
74
-
75
-
if (!$rm->isPublic()) {
76
-
thrownewInvalidArgumentException(sprintf('Method "%s::%s()" should be public: tag "%s" on service "%s".', $class, $defaultPriorityMethod, $tagName, $serviceId));
77
-
}
78
-
79
-
$defaultPriority = $rm->invoke(null);
80
-
81
-
if (!\is_int($defaultPriority)) {
82
-
thrownewInvalidArgumentException(sprintf('Method "%s::%s()" should return an integer, got %s: tag "%s" on service "%s".', $class, $defaultPriorityMethod, \gettype($priority), $tagName, $serviceId));
if (($r = ($r ?? $container->getReflectionClass($class))) && $r->hasMethod($defaultIndexMethod)) {
101
-
if (!($rm = $r->getMethod($defaultIndexMethod))->isStatic()) {
102
-
thrownewInvalidArgumentException(sprintf('Method "%s::%s()" should be static: tag "%s" on service "%s" is missing "%s" attribute.', $class, $defaultIndexMethod, $tagName, $serviceId, $indexAttribute));
thrownewInvalidArgumentException(sprintf('Method "%s::%s()" should be public: tag "%s" on service "%s" is missing "%s" attribute.', $class, $defaultIndexMethod, $tagName, $serviceId, $indexAttribute));
thrownewInvalidArgumentException(sprintf('Method "%s::%s()" should return a string, got %s: tag "%s" on service "%s" is missing "%s" attribute.', $class, $defaultIndexMethod, \gettype($defaultIndex), $tagName, $serviceId, $indexAttribute));
113
-
}
114
-
}
96
+
return$refs;
97
+
}
98
+
}
115
99
116
-
$defaultIndex = $defaultIndex ?? $serviceId;
117
-
}
100
+
/**
101
+
* @internal
102
+
*/
103
+
class PriorityTaggedServiceUtil
104
+
{
105
+
/**
106
+
* Gets the index defined by the default index method.
if (!($rm = $r->getMethod($defaultIndexMethod))->isStatic()) {
118
+
thrownewInvalidArgumentException(sprintf('Either method "%s::%s()" should be static or tag "%s" on service "%s" is missing attribute "%s".', $class, $defaultIndexMethod, $tagName, $serviceId, $indexAttribute));
119
+
}
129
120
130
-
$services[$priority][$index] = $reference;
131
-
}
121
+
if (!$rm->isPublic()) {
122
+
thrownewInvalidArgumentException(sprintf('Either method "%s::%s()" should be public or tag "%s" on service "%s" is missing attribute "%s".', $class, $defaultIndexMethod, $tagName, $serviceId, $indexAttribute));
123
+
}
124
+
125
+
$defaultIndex = $rm->invoke(null);
126
+
127
+
if (!\is_string($defaultIndex)) {
128
+
thrownewInvalidArgumentException(sprintf('Either method "%s::%s()" should return a string (got %s) or tag "%s" on service "%s" is missing attribute "%s".', $class, $defaultIndexMethod, \gettype($defaultIndex), $tagName, $serviceId, $indexAttribute));
129
+
}
130
+
131
+
return$defaultIndex;
132
+
}
133
+
134
+
/**
135
+
* Gets the priority defined by the default priority method.
if (!($r = $container->getReflectionClass($class)) || !$r->hasMethod($defaultPriorityMethod)) {
143
+
returnnull;
132
144
}
133
145
134
-
if ($services) {
135
-
krsort($services);
136
-
$services = array_merge(...$services);
146
+
if (!($rm = $r->getMethod($defaultPriorityMethod))->isStatic()) {
147
+
thrownewInvalidArgumentException(sprintf('Either method "%s::%s()" should be static or tag "%s" on service "%s" is missing attribute "priority".', $class, $defaultPriorityMethod, $tagName, $serviceId));
148
+
}
149
+
150
+
if (!$rm->isPublic()) {
151
+
thrownewInvalidArgumentException(sprintf('Either method "%s::%s()" should be public or tag "%s" on service "%s" is missing attribute "priority".', $class, $defaultPriorityMethod, $tagName, $serviceId));
152
+
}
153
+
154
+
$defaultPriority = $rm->invoke(null);
155
+
156
+
if (!\is_int($defaultPriority)) {
157
+
thrownewInvalidArgumentException(sprintf('Method "%s::%s()" should return an integer (got %s) or tag "%s" on service "%s" is missing attribute "priority".', $class, $defaultPriorityMethod, \gettype($defaultPriority), $tagName, $serviceId));
0 commit comments