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 (self::class !== $method->getDeclaringClass()->name) {
47
+
continue;
48
+
}
49
+
50
+
if (!$returnType = $method->getReturnType()) {
51
+
continue;
52
+
}
53
+
54
+
if ($returnType->isBuiltin()) {
55
+
continue;
56
+
}
57
+
58
+
if (\PHP_VERSION_ID >= 80000) {
59
+
if (\count($method->getAttributes(SubscribedService::class))) {
60
+
continue;
61
+
}
62
+
63
+
trigger_deprecation('symfony/service-contracts', '5.4', 'Using the "%s" trait in "%s" without subscribed service methods marked with the "%s" attribute is deprecated and will not be allowed in Symfony 6.0.', ServiceSubscriberTrait::class, self::class, SubscribedService::class);
thrownew \RuntimeException(sprintf('Cannot use "%s" on method "%s::%s()" (can only be used on non-static, non-abstract methods with no parameters).', SubscribedService::class, self::class, $method->name));
82
+
}
83
+
84
+
if (!$returnType = $method->getReturnType()) {
85
+
// todo, what exception to throw?
86
+
thrownew \RuntimeException(sprintf('Cannot use "%s" on methods without a return type in "%s::%s()".', SubscribedService::class, $method->name, self::class));
87
+
}
88
+
89
+
if (!$returnTypeinstanceof \ReflectionNamedType) {
90
+
// todo, what exception to throw?
91
+
thrownew \RuntimeException(sprintf('Cannot use "%s" on methods with a union return type in "%s::%s()".', SubscribedService::class, $method->name, self::class));
92
+
}
93
+
94
+
if ($returnType->isBuiltin()) {
95
+
// todo, what exception to throw?
96
+
thrownew \RuntimeException(sprintf('Cannot use "%s" on methods with a native return type in "%s::%s()".', SubscribedService::class, $method->name, self::class));
0 commit comments