From 2c97a8a41dd076968980f4863a30d7cbd5fe6ba6 Mon Sep 17 00:00:00 2001
From: Andreas Wolf <andreas.wolf@typo3.org>
Date: Fri, 4 Mar 2016 12:56:06 +0100
Subject: [PATCH] [CLEANUP] Rename AbstractContentObject::getContentObject()

The method is renamed to getContentObjectRenderer(), as this better
reflects what it actually does. The old method is marked as deprecated
and scheduled for removal in v9.

Change-Id: Idaaba8856f7cca31bdc1d5c301a221dee2059048
Resolves: #68748
Releases: master
Reviewed-on: https://review.typo3.org/42272
Reviewed-by: Andreas Wolf <andreas.wolf@typo3.org>
Tested-by: Andreas Wolf <andreas.wolf@typo3.org>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
---
 ...ecateAbstractContentObjectgetContentObject.rst | 15 +++++++++++++++
 .../ContentObject/AbstractContentObject.php       | 14 +++++++++++++-
 .../FluidTemplateContentObjectTest.php            |  2 +-
 3 files changed, 29 insertions(+), 2 deletions(-)
 create mode 100644 typo3/sysext/core/Documentation/Changelog/master/Deprecation-68748-DeprecateAbstractContentObjectgetContentObject.rst

diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-68748-DeprecateAbstractContentObjectgetContentObject.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-68748-DeprecateAbstractContentObjectgetContentObject.rst
new file mode 100644
index 000000000000..669f21b95e1b
--- /dev/null
+++ b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-68748-DeprecateAbstractContentObjectgetContentObject.rst
@@ -0,0 +1,15 @@
+=========================================================================
+Deprecation: #68748 - Deprecate AbstractContentObject::getContentObject()
+=========================================================================
+
+Description
+===========
+
+The method is renamed to getContentObjectRenderer(). The old method name is still present as a
+deprecated alias, which will be removed in TYPO3 v10.
+
+
+Impact
+======
+
+All method calls to getContentObject() must be changed to getContentObjectRenderer() until TYPO3 v9.
diff --git a/typo3/sysext/frontend/Classes/ContentObject/AbstractContentObject.php b/typo3/sysext/frontend/Classes/ContentObject/AbstractContentObject.php
index 120b2b1a7c94..4fd1eb9eb1d8 100644
--- a/typo3/sysext/frontend/Classes/ContentObject/AbstractContentObject.php
+++ b/typo3/sysext/frontend/Classes/ContentObject/AbstractContentObject.php
@@ -51,11 +51,23 @@ abstract class AbstractContentObject
     abstract public function render($conf = array());
 
     /**
-     * Getter for current cObj
+     * Getter for current ContentObjectRenderer
      *
      * @return ContentObjectRenderer
+     * @deprecated since TYPO3 v8, will be removed with TYPO3 v9. Use getContentObjectRenderer() instead.
      */
     public function getContentObject()
+    {
+        GeneralUtility::logDeprecatedFunction();
+        return $this->getContentObjectRenderer();
+    }
+
+    /**
+     * Getter for current ContentObjectRenderer
+     *
+     * @return ContentObjectRenderer
+     */
+    public function getContentObjectRenderer()
     {
         return $this->cObj;
     }
diff --git a/typo3/sysext/frontend/Tests/Unit/ContentObject/FluidTemplateContentObjectTest.php b/typo3/sysext/frontend/Tests/Unit/ContentObject/FluidTemplateContentObjectTest.php
index c4c3727e8bac..479a0d877f84 100644
--- a/typo3/sysext/frontend/Tests/Unit/ContentObject/FluidTemplateContentObjectTest.php
+++ b/typo3/sysext/frontend/Tests/Unit/ContentObject/FluidTemplateContentObjectTest.php
@@ -99,7 +99,7 @@ class FluidTemplateContentObjectTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
      */
     public function constructSetsContentObjectRenderer()
     {
-        $this->assertSame($this->contentObjectRenderer, $this->subject->getContentObject());
+        $this->assertSame($this->contentObjectRenderer, $this->subject->getContentObjectRenderer());
     }
 
     /**
-- 
GitLab