8000 [DependencyInjection] remove deprecation layer · symfony/symfony@ed30e4c · GitHub
[go: up one dir, main page]

Skip to content

Commit ed30e4c

Browse files
committed
[DependencyInjection] remove deprecation layer
1 parent 982bdc1 commit ed30e4c

File tree

3 files changed

+0
-62
lines changed

3 files changed

+0
-62
lines changed

src/Symfony/Contracts/Service/ServiceSubscriberTrait.php

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ public static function getSubscribedServices(): array
3636
return $services;
3737
}
3838

39-
$attributeOptIn = false;
4039
$services = \is_callable(['parent', __FUNCTION__]) ? parent::getSubscribedServices() : [];
4140

4241
foreach ((new \ReflectionClass(self::class))->getMethods() as $method) {
@@ -63,31 +62,6 @@ public static function getSubscribedServices(): array
6362
}
6463

6564
$services[$attribute->newInstance()->key ?? self::class.'::'.$method->name] = $serviceId;
66-
$attributeOptIn = true;
67-
}
68-
69-
if (!$attributeOptIn) {
70-
foreach ((new \ReflectionClass(self::class))->getMethods() as $method) {
71-
if ($method->isStatic() || $method->isAbstract() || $method->isGenerator() || $method->isInternal() || $method->getNumberOfRequiredParameters()) {
72-
continue;
73-
}
74-
75-
if (self::class !== $method->getDeclaringClass()->name) {
76-
continue;
77-
}
78-
79-
if (!($returnType = $method->getReturnType()) instanceof \ReflectionNamedType) {
80-
continue;
81-
}
82-
83-
if ($returnType->isBuiltin()) {
84-
continue;
85-
}
86-
87-
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);
88-
89-
$services[self::class.'::'.$method->name] = '?'.($returnType instanceof \ReflectionNamedType ? $returnType->getName() : $returnType);
90-
}
9165
}
9266

9367
return $services;

src/Symfony/Contracts/Tests/Fixtures/TestServiceSubscriberUnion.php

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/Symfony/Contracts/Tests/Service/ServiceSubscriberTraitTest.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
use Symfony\Contracts\Service\ServiceLocatorTrait;
2020
use Symfony\Contracts\Service\ServiceSubscriberInterface;
2121
use Symfony\Contracts\Service\ServiceSubscriberTrait;
22-
use Symfony\Contracts\Tests\Fixtures\TestServiceSubscriberUnion;
2322

2423
class ServiceSubscriberTraitTest extends TestCase
2524
{
@@ -41,16 +40,6 @@ public function testSetContainerIsCalledOnParent()
4140

4241
$this->assertSame($container, (new TestService())->setContainer($container));
4342
}
44-
45-
/**
46-
* @group legacy
47-
*/
48-
public function testMethodsWithUnionReturnTypesAreIgnored()
49-
{
50-
$expected = [TestServiceSubscriberUnion::class.'::method1' => '?Symfony\Contracts\Tests\Fixtures\Service1'];
51-
52-
$this->assertEquals($expected, TestServiceSubscriberUnion::getSubscribedServices());
53-
}
5443
}
5544

5645
class ParentTestService

0 commit comments

Comments
 (0)
0