Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3de1b65

Browse filesBrowse files
committed
feature #40838 [SecurityBundle] Deprecate public services to private (fancyweb)
This PR was merged into the 5.3-dev branch. Discussion ---------- [SecurityBundle] Deprecate public services to private | Q | A | ------------- | --- | Branch? | 5.x | Bug fix? | no | New feature? | no | Deprecations? | yes | Tickets | - | License | MIT | Doc PR | - Follow up of symfony/symfony#36691 on the SecurityBundle Commits ------- 56be86aa7d [SecurityBundle] Deprecate public services to private
2 parents d9cc909 + 6e47eaa commit 3de1b65
Copy full SHA for 3de1b65

File tree

Expand file treeCollapse file tree

2 files changed

+26
-4
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+26
-4
lines changed

‎Tests/Functional/Bundle/TestBundle/Controller/SecurityController.php

Copy file name to clipboardExpand all lines: Tests/Functional/Bundle/TestBundle/Controller/SecurityController.php
+20-4Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,32 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\Controller;
1313

14-
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
15-
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
14+
use Psr\Container\ContainerInterface;
1615
use Symfony\Component\HttpFoundation\Response;
16+
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
17+
use Symfony\Contracts\Service\ServiceSubscriberInterface;
1718

18-
class SecurityController implements ContainerAwareInterface
19+
class SecurityController implements ServiceSubscriberInterface
1920
{
20-
use ContainerAwareTrait;
21+
private $container;
22+
23+
public function __construct(ContainerInterface $container)
24+
{
25+
$this->container = $container;
26+
}
2127

2228
public function profileAction()
2329
{
2430
return new Response('Welcome '.$this->container->get('security.token_storage')->getToken()->getUserIdentifier().'!');
2531
}
32+
33+
/**
34+
* {@inheritdoc}
35+
*/
36+
public static function getSubscribedServices(): array
37+
{
38+
return [
39+
'security.token_storage' => TokenStorageInterface::class,
40+
];
41+
}
2642
}

‎Tests/Functional/app/Security/config.yml

Copy file name to clipboardExpand all lines: Tests/Functional/app/Security/config.yml
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
imports:
22
- { resource: ./../config/default.yml }
33

4+
services:
5+
Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\Controller\SecurityController:
6+
public: true
7+
tags:
8+
- container.service_subscriber
9+
410
security:
511
providers:
612
main:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.