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
minor #43783 [DependencyInjection] remove ServiceSubscriberTrait deprecation layer (kbond)
This PR was merged into the 6.0 branch.
Discussion
----------
[DependencyInjection] remove `ServiceSubscriberTrait` deprecation layer
| Q | A
| ------------- | ---
| Branch? | 6.0
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | Followup to #42238
| License | MIT
| Doc PR | TODO
This removes the deprecation layer we added in #42238.
Commits
-------
4a6226d [DependencyInjection] remove ServiceSubscriberTrait deprecation layer
thrownew \LogicException(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));
54
-
}
55
-
56
-
if (!$returnType = $method->getReturnType()) {
57
-
thrownew \LogicException(sprintf('Cannot use "%s" on methods without a return type in "%s::%s()".', SubscribedService::class, $method->name, self::class));
if (self::class !==$method->getDeclaringClass()->name) {
78
-
continue;
79
-
}
46
+
if (!$attribute =$method->getAttributes(SubscribedService::class)[0] ?? null) {
47
+
continue;
48
+
}
80
49
81
-
if (!$returnType =$method->getReturnType()) {
82
-
continue;
83
-
}
50
+
if ($method->isStatic() || $method->isAbstract() || $method->isGenerator() || $method->isInternal() ||$method->getNumberOfRequiredParameters()) {
51
+
thrownew \LogicException(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));
52
+
}
84
53
85
-
if ($returnType->isBuiltin()) {
86
-
continue;
87
-
}
54
+
if (!$returnType = $method->getReturnType()) {
55
+
thrownew \LogicException(sprintf('Cannot use "%s" on methods without a return type in "%s::%s()".', SubscribedService::class, $method->name, self::class));
56
+
}
88
57
89
-
if (\PHP_VERSION_ID >= 80000) {
90
-
trigger_deprecation('symfony/service-contracts', '2.5', 'Using "%s" in "%s" without using the "%s" attribute on any method is deprecated.', ServiceSubscriberTrait::class, self::class, SubscribedService::class);
0 commit comments