From a5e73b6dcb478e505830d2fe0422699b060d6a56 Mon Sep 17 00:00:00 2001 From: blanchonvincent Date: Fri, 28 Nov 2014 16:49:28 +0100 Subject: [PATCH 1/5] Remove abstract class and use Interface+Trait --- .../Bundle/FrameworkBundle/Controller/Controller.php | 7 +++++-- .../FrameworkBundle/Controller/RedirectController.php | 7 +++++-- .../FrameworkBundle/Controller/TemplateController.php | 7 +++++-- .../Bundle/TestBundle/Controller/FragmentController.php | 7 +++++-- .../Bundle/TestBundle/Controller/ProfilerController.php | 7 +++++-- .../Bundle/TestBundle/Controller/SessionController.php | 7 +++++-- .../Bundle/TestBundle/Controller/SubRequestController.php | 7 +++++-- .../CsrfFormLoginBundle/Controller/LoginController.php | 7 +++++-- .../FormLoginBundle/Controller/LocalizedController.php | 7 +++++-- .../Bundle/FormLoginBundle/Controller/LoginController.php | 7 +++++-- .../Component/DependencyInjection/ContainerAware.php | 2 ++ src/Symfony/Component/HttpKernel/Bundle/Bundle.php | 7 +++++-- 12 files changed, 57 insertions(+), 22 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php b/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php index b3c7f42c2ce27..5a42379022c52 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php @@ -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; @@ -33,8 +34,10 @@ * * @author Fabien Potencier */ -class Controller extends ContainerAware +class Controller implements ContainerAwareInterface { + use ContainerAwareTrait; + /** * Generates a URL from the given parameters. * diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/RedirectController.php b/src/Symfony/Bundle/FrameworkBundle/Controller/RedirectController.php index 0e79d79152f7a..3b86750258080 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/RedirectController.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/RedirectController.php @@ -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; @@ -23,8 +24,10 @@ * * @author Fabien Potencier */ -class RedirectController extends ContainerAware +class RedirectController implements ContainerAwareInterface { + use ContainerAwareTrait; + /** * Redirects to another route with the given name. * diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/TemplateController.php b/src/Symfony/Bundle/FrameworkBundle/Controller/TemplateController.php index db8acbe48b260..0d0ccffcb47b7 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/TemplateController.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/TemplateController.php @@ -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\Response; /** @@ -19,8 +20,10 @@ * * @author Fabien Potencier */ -class TemplateController extends ContainerAware +class TemplateController implements ContainerAwareInterface { + use ContainerAwareTrait; + /** * Renders a template. * diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/FragmentController.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/FragmentController.php index cefa7de7c126d..f1e71ad098db3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/FragmentController.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/FragmentController.php @@ -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) { $actions = $this->container->get('templating')->get('actions'); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/ProfilerController.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/ProfilerController.php index 0452e255eafe4..dd518a12a8d54 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/ProfilerController.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/ProfilerController.php @@ -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'); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/SessionController.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/SessionController.php index bf22e63370139..a97ae9c599b79 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/SessionController.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/SessionController.php @@ -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(); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/SubRequestController.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/SubRequestController.php index e1bd050ce0afe..5df6e29590a5b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/SubRequestController.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/SubRequestController.php @@ -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'); diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/CsrfFormLoginBundle/Controller/LoginController.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/CsrfFormLoginBundle/Controller/LoginController.php index 1eccbfd795bea..ebf459ee191f2 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/CsrfFormLoginBundle/Controller/LoginController.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/CsrfFormLoginBundle/Controller/LoginController.php @@ -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('user_login'); diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Controller/LocalizedController.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Controller/LocalizedController.php index 271322481f2d2..3b0d18506a5fb 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Controller/LocalizedController.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Controller/LocalizedController.php @@ -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\SecurityContext; 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 diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Controller/LoginController.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Controller/LoginController.php index e8ad74a2a696b..0103d91309604 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Controller/LoginController.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Controller/LoginController.php @@ -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\SecurityContext; -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 diff --git a/src/Symfony/Component/DependencyInjection/ContainerAware.php b/src/Symfony/Component/DependencyInjection/ContainerAware.php index 40969153118c2..5702873a6a165 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerAware.php +++ b/src/Symfony/Component/DependencyInjection/ContainerAware.php @@ -17,6 +17,8 @@ * @author Fabien Potencier * * @api + * + * @deprecated Deprecated since version 2.7, to be removed in 3.0. Use the trait ContainerAwareTrait instead. */ abstract class ContainerAware implements ContainerAwareInterface { diff --git a/src/Symfony/Component/HttpKernel/Bundle/Bundle.php b/src/Symfony/Component/HttpKernel/Bundle/Bundle.php index 93048c408b0d1..da0507de99267 100644 --- a/src/Symfony/Component/HttpKernel/Bundle/Bundle.php +++ b/src/Symfony/Component/HttpKernel/Bundle/Bundle.php @@ -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; @@ -26,8 +27,10 @@ * * @api */ -abstract class Bundle extends ContainerAware implements BundleInterface +abstract class Bundle implements BundleInterface { + use ContainerAwareTrait; + protected $name; protected $extension; protected $path; From 603f617471fd8c9a0d37e49acebd3b6f2954f512 Mon Sep 17 00:00:00 2001 From: blanchonvincent Date: Fri, 28 Nov 2014 16:54:22 +0100 Subject: [PATCH 2/5] Add doc --- src/Symfony/Component/DependencyInjection/CHANGELOG.md | 5 +++++ src/Symfony/Component/DependencyInjection/ContainerAware.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/DependencyInjection/CHANGELOG.md b/src/Symfony/Component/DependencyInjection/CHANGELOG.md index b78e440974b2c..c30a5551affa2 100644 --- a/src/Symfony/Component/DependencyInjection/CHANGELOG.md +++ b/src/Symfony/Component/DependencyInjection/CHANGELOG.md @@ -1,6 +1,11 @@ CHANGELOG ========= +2.7.0 +----- + + * deprecated ContainerAware class + 2.6.0 ----- diff --git a/src/Symfony/Component/DependencyInjection/ContainerAware.php b/src/Symfony/Component/DependencyInjection/ContainerAware.php index 5702873a6a165..c45c868d319f7 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerAware.php +++ b/src/Symfony/Component/DependencyInjection/ContainerAware.php @@ -18,7 +18,7 @@ * * @api * - * @deprecated Deprecated since version 2.7, to be removed in 3.0. Use the trait ContainerAwareTrait instead. + * @deprecated Deprecated since version 2.7, to be removed in 3.0. Use ContainerAwareTrait with ContainerAwareInterface instead. */ abstract class ContainerAware implements ContainerAwareInterface { From ae492120e990f0bc0ce36fe2c69ee3ee6b79131b Mon Sep 17 00:00:00 2001 From: blanchonvincent Date: Sun, 27 Sep 2015 10:46:38 +0200 Subject: [PATCH 3/5] remove useless files from versioning --- .idea/.name | 1 - .idea/encodings.xml | 5 ----- .idea/misc.xml | 5 ----- .idea/modules.xml | 9 --------- .idea/scopes/scope_settings.xml | 5 ----- .idea/symfony.iml | 19 ------------------- .idea/vcs.xml | 7 ------- 7 files changed, 51 deletions(-) delete mode 100644 .idea/.name delete mode 100644 .idea/encodings.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/scopes/scope_settings.xml delete mode 100644 .idea/symfony.iml delete mode 100644 .idea/vcs.xml diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index 6bc5995f62e34..0000000000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -symfony \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index e206d70d8595e..0000000000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 1162f43828b56..0000000000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 0a22f7544be9f..0000000000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml deleted file mode 100644 index 922003b8433bc..0000000000000 --- a/.idea/scopes/scope_settings.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/symfony.iml b/.idea/symfony.iml deleted file mode 100644 index 154f68f274eff..0000000000000 --- a/.idea/symfony.iml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index c80f2198b5f68..0000000000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - From e2eb0de406e3f917761db4c53d24716ea3fea419 Mon Sep 17 00:00:00 2001 From: blanchonvincent Date: Sun, 27 Sep 2015 10:49:02 +0200 Subject: [PATCH 4/5] remove useless files from versioning --- autoload.php | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 autoload.php diff --git a/autoload.php b/autoload.php deleted file mode 100644 index d79dfe35a8fb7..0000000000000 --- a/autoload.php +++ /dev/null @@ -1,15 +0,0 @@ -=') && gc_enabled()) { - // Disabling Zend Garbage Collection to prevent segfaults with PHP5.4+ - // https://bugs.php.net/bug.php?id=53976 - gc_disable(); -} - -$loader = include __DIR__.'/vendor/autoload.php'; - -use Doctrine\Common\Annotations\AnnotationRegistry; - -AnnotationRegistry::registerLoader(array($loader, 'loadClass')); - -return $loader; From 25a952e8516efe92b7e63060bf9dd51fecd34c25 Mon Sep 17 00:00:00 2001 From: blanchonvincent Date: Sun, 27 Sep 2015 10:58:42 +0200 Subject: [PATCH 5/5] fix CS --- .../Bundle/TestBundle/Controller/SessionController.php | 2 +- src/Symfony/Component/HttpKernel/Bundle/Bundle.php | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/SessionController.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/SessionController.php index a97ae9c599b79..76146376d009f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/SessionController.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/SessionController.php @@ -20,7 +20,7 @@ class SessionController implements ContainerAwareInterface { use ContainerAwareTrait; - + public function welcomeAction(Request $request, $name = null) { $session = $request->getSession(); diff --git a/src/Symfony/Component/HttpKernel/Bundle/Bundle.php b/src/Symfony/Component/HttpKernel/Bundle/Bundle.php index 1f8be7cfd3f8a..772b6e9ff3b8e 100644 --- a/src/Symfony/Component/HttpKernel/Bundle/Bundle.php +++ b/src/Symfony/Component/HttpKernel/Bundle/Bundle.php @@ -11,7 +11,6 @@ namespace Symfony\Component\HttpKernel\Bundle; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerAwareTrait; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Container;