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