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 6e47eaa

Browse filesBrowse files
fancywebfabpot
authored andcommitted
[SecurityBundle] Deprecate public services to private
1 parent b762977 commit 6e47eaa
Copy full SHA for 6e47eaa

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.