Skip to content

Commit

Permalink
Remove abstract class and use Interface+Trait
Browse files Browse the repository at this point in the history
Conflicts:
	src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php
	src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Controller/LocalizedController.php
	src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Controller/LoginController.php
	src/Symfony/Component/DependencyInjection/ContainerAware.php
  • Loading branch information
blanchonvincent authored and Tobion committed Nov 4, 2015
1 parent d67feb4 commit 52c50e3
Show file tree
Hide file tree
Showing 11 changed files with 55 additions and 22 deletions.
7 changes: 5 additions & 2 deletions src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php
Expand Up @@ -11,11 +11,12 @@

namespace Symfony\Bundle\FrameworkBundle\Controller;

use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
Expand All @@ -35,8 +36,10 @@
*
* @author Fabien Potencier <fabien@symfony.com>
*/
abstract class Controller extends ContainerAware
abstract class Controller implements ContainerAwareInterface
{
use ContainerAwareTrait;

/**
* Generates a URL from the given parameters.
*
Expand Down
Expand Up @@ -11,7 +11,8 @@

namespace Symfony\Bundle\FrameworkBundle\Controller;

use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
Expand All @@ -23,8 +24,10 @@
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class RedirectController extends ContainerAware
class RedirectController implements ContainerAwareInterface
{
use ContainerAwareTrait;

/**
* Redirects to another route with the given name.
*
Expand Down
Expand Up @@ -11,16 +11,19 @@

namespace Symfony\Bundle\FrameworkBundle\Controller;

use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\HttpFoundation\Response;

/**
* TemplateController.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class TemplateController extends ContainerAware
class TemplateController implements ContainerAwareInterface
{
use ContainerAwareTrait;

/**
* Renders a template.
*
Expand Down
Expand Up @@ -11,12 +11,15 @@

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

use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\DependencyInjection\ContainerAware;

class FragmentController extends ContainerAware
class FragmentController implements ContainerAwareInterface
{
use ContainerAwareTrait;

public function indexAction(Request $request)
{
return $this->container->get('templating')->renderResponse('fragment.html.php', array('bar' => new Bar()));
Expand Down
Expand Up @@ -11,11 +11,14 @@

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

use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\DependencyInjection\ContainerAware;

class ProfilerController extends ContainerAware
class ProfilerController implements ContainerAwareInterface
{
use ContainerAwareTrait;

public function indexAction()
{
return new Response('Hello');
Expand Down
Expand Up @@ -11,13 +11,16 @@

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

use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\DependencyInjection\ContainerAware;

class SessionController extends ContainerAware
class SessionController implements ContainerAwareInterface
{
use ContainerAwareTrait;

public function welcomeAction(Request $request, $name = null)
{
$session = $request->getSession();
Expand Down
Expand Up @@ -11,13 +11,16 @@

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

use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\HttpKernel\Controller\ControllerReference;

class SubRequestController extends ContainerAware
class SubRequestController implements ContainerAwareInterface
{
use ContainerAwareTrait;

public function indexAction()
{
$handler = $this->container->get('fragment.handler');
Expand Down
Expand Up @@ -11,12 +11,15 @@

namespace Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\CsrfFormLoginBundle\Controller;

use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;

class LoginController extends ContainerAware
class LoginController implements ContainerAwareInterface
{
use ContainerAwareTrait;

public function loginAction()
{
$form = $this->container->get('form.factory')->create('Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\CsrfFormLoginBundle\Form\UserLoginType');
Expand Down
Expand Up @@ -11,13 +11,16 @@

namespace Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\FormLoginBundle\Controller;

use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\DependencyInjection\ContainerAware;

class LocalizedController extends ContainerAware
class LocalizedController implements ContainerAwareInterface
{
use ContainerAwareTrait;

public function loginAction(Request $request)
{
// get the login error if there is one
Expand Down
Expand Up @@ -11,14 +11,17 @@

namespace Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\FormLoginBundle\Controller;

use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\DependencyInjection\ContainerAware;

class LoginController extends ContainerAware
class LoginController implements ContainerAwareInterface
{
use ContainerAwareTrait;

public function loginAction(Request $request)
{
// get the login error if there is one
Expand Down
7 changes: 5 additions & 2 deletions src/Symfony/Component/HttpKernel/Bundle/Bundle.php
Expand Up @@ -11,7 +11,8 @@

namespace Symfony\Component\HttpKernel\Bundle;

use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\Console\Application;
Expand All @@ -24,8 +25,10 @@
*
* @author Fabien Potencier <fabien@symfony.com>
*/
abstract class Bundle extends ContainerAware implements BundleInterface
abstract class Bundle implements BundleInterface
{
use ContainerAwareTrait;

protected $name;
protected $extension;
protected $path;
Expand Down

0 comments on commit 52c50e3

Please sign in to comment.