From 031c2389cf5d727539df6bdb4a345e6fc06686df Mon Sep 17 00:00:00 2001
From: Christian Kuhn <lolli@schwarzbu.ch>
Date: Thu, 26 Aug 2021 14:33:02 +0200
Subject: [PATCH] [TASK] Deprecate extbase EmptyView

Extbase EmptyView is unused since its introduction in
4.5. Calling render() returns a html comment. It has
been substituted by NotFoundView within 4.5 development
already. NotFoundView is removed with a different
patch, too.

Resolves: #95005
Related: #95003
Releases: master
Change-Id: I8bbb4a641fa05fe34e2f7eabd7621ec3c0fe7bdd
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/70769
Tested-by: core-ci <typo3@b13.com>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Jochen <rothjochen@gmail.com>
Tested-by: Oliver Bartsch <bo@cedev.de>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Jochen <rothjochen@gmail.com>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 .../Deprecation-95005-ExtbaseEmptyView.rst    | 41 +++++++++++++++++++
 .../extbase/Classes/Mvc/View/EmptyView.php    |  7 ++++
 .../ExtensionScanner/Php/ClassNameMatcher.php |  5 +++
 3 files changed, 53 insertions(+)
 create mode 100644 typo3/sysext/core/Documentation/Changelog/master/Deprecation-95005-ExtbaseEmptyView.rst

diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-95005-ExtbaseEmptyView.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-95005-ExtbaseEmptyView.rst
new file mode 100644
index 000000000000..137a4ecb99cb
--- /dev/null
+++ b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-95005-ExtbaseEmptyView.rst
@@ -0,0 +1,41 @@
+.. include:: ../../Includes.txt
+
+=======================================
+Deprecation: #95005 - Extbase EmptyView
+=======================================
+
+See :issue:`95005`
+
+Description
+===========
+
+To further clean up and streamline fluid view related functionality,
+extbase related view class :php:`TYPO3\CMS\Extbase\Mvc\View\EmptyView`
+has been deprecated.
+
+
+Impact
+======
+
+Using :php:`EmptyView` has been deprecated and logs a deprecation
+level error upon use.
+
+
+Affected Installations
+======================
+
+The class has been unused within TYPO3 core since its introduction in 4.5.
+It is rather unlikely instances have extensions using the class. The extension
+scanner finds usages with a strong match.
+
+
+Migration
+=========
+
+If rendering "nothing" by a view instance is needed for whatever reason, the
+same result can be achieved with a :php:`TYPO3\CMS\Fluid\View\StandaloneView`
+view instance by setting :php:`$view->setTemplateSource('')` and calling
+:php:`$view->render()`. But it's of course quicker to simply not render
+anything at all.
+
+.. index:: PHP-API, FullyScanned, ext:extbase
diff --git a/typo3/sysext/extbase/Classes/Mvc/View/EmptyView.php b/typo3/sysext/extbase/Classes/Mvc/View/EmptyView.php
index 453095da8fd4..a980ecbe4334 100644
--- a/typo3/sysext/extbase/Classes/Mvc/View/EmptyView.php
+++ b/typo3/sysext/extbase/Classes/Mvc/View/EmptyView.php
@@ -19,9 +19,16 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext;
 
 /**
  * An empty view - a special case.
+ *
+ * @deprecated since v11, will be removed with 12.
  */
 class EmptyView implements ViewInterface
 {
+    public function __construct()
+    {
+        trigger_error('Class ' . __CLASS__ . ' has been deprecated in v11 and will be removed with v12.');
+    }
+
     /**
      * Dummy method to satisfy the ViewInterface
      *
diff --git a/typo3/sysext/install/Configuration/ExtensionScanner/Php/ClassNameMatcher.php b/typo3/sysext/install/Configuration/ExtensionScanner/Php/ClassNameMatcher.php
index 8d17caa32685..39539a6cd0ba 100644
--- a/typo3/sysext/install/Configuration/ExtensionScanner/Php/ClassNameMatcher.php
+++ b/typo3/sysext/install/Configuration/ExtensionScanner/Php/ClassNameMatcher.php
@@ -1779,4 +1779,9 @@ return [
             'Deprecation-94991-ExtbaseAbstractView.rst',
         ],
     ],
+    'TYPO3\CMS\Extbase\Mvc\View\EmptyView' => [
+        'restFiles' => [
+            'Deprecation-95005-ExtbaseEmptyView.rst',
+        ],
+    ],
 ];
-- 
GitLab