From 2912053acce479bcb0fa4a3b47d5e63bf2370537 Mon Sep 17 00:00:00 2001
From: Mathias Brodala <mbrodala@pagemachine.de>
Date: Sat, 17 Mar 2018 15:25:00 +0100
Subject: [PATCH] [TASK] Rename TypoScriptReferenceLoader to
 TypoScriptReferenceController

Change-Id: I31fcc83c20766aacd3af7d8b68df9469d3db13dc
Resolves: #84411
Releases: master
Reviewed-on: https://review.typo3.org/56310
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 ...RenamedToTypoScriptReferenceController.rst | 35 +++++++++++++++++++
 .../ExtensionScanner/Php/ClassNameMatcher.php |  5 +++
 .../TypoScriptReferenceController.php}        |  9 +++--
 .../Configuration/Backend/AjaxRoutes.php      |  2 +-
 .../Migrations/Code/ClassAliasMap.php         |  1 +
 .../Migrations/Code/LegacyClassesForIde.php   |  7 ++++
 6 files changed, 53 insertions(+), 6 deletions(-)
 create mode 100644 typo3/sysext/core/Documentation/Changelog/master/Deprecation-84411-TypoScriptReferenceLoaderRenamedToTypoScriptReferenceController.rst
 rename typo3/sysext/t3editor/Classes/{TypoScriptReferenceLoader.php => Controller/TypoScriptReferenceController.php} (92%)

diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-84411-TypoScriptReferenceLoaderRenamedToTypoScriptReferenceController.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-84411-TypoScriptReferenceLoaderRenamedToTypoScriptReferenceController.rst
new file mode 100644
index 000000000000..28d35289057e
--- /dev/null
+++ b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-84411-TypoScriptReferenceLoaderRenamedToTypoScriptReferenceController.rst
@@ -0,0 +1,35 @@
+.. include:: ../../Includes.txt
+
+========================================================================================
+Deprecation: #84411 - TypoScriptReferenceLoader renamed to TypoScriptReferenceController
+========================================================================================
+
+See :issue:`84411`
+
+Description
+===========
+
+The PHP class :php:`TYPO3\CMS\T3editor\TypoScriptReferenceLoader` has been renamed to
+:php:`TYPO3\CMS\T3editor\Controller\TypoScriptReferenceController`.
+
+
+Impact
+======
+
+The old class name has been registered as class alias and will still work.
+Old class name usage however is discouraged and should be avoided, the
+alias will vanish with core version 10.
+
+
+Affected Installations
+======================
+
+Extensions which use the old class name are affected. The extension scanner will find affected extensions using the old class name.
+
+
+Migration
+=========
+
+Use new class name instead.
+
+.. index:: Backend, PHP-API, FullyScanned, ext:t3editor
\ No newline at end of file
diff --git a/typo3/sysext/install/Configuration/ExtensionScanner/Php/ClassNameMatcher.php b/typo3/sysext/install/Configuration/ExtensionScanner/Php/ClassNameMatcher.php
index 61dfed7b006f..f4288c1ee388 100644
--- a/typo3/sysext/install/Configuration/ExtensionScanner/Php/ClassNameMatcher.php
+++ b/typo3/sysext/install/Configuration/ExtensionScanner/Php/ClassNameMatcher.php
@@ -669,4 +669,9 @@ return [
             'Deprecation-84409-ImageManipulationWizardRenamedToImageManipulationController.rst',
         ],
     ],
+    'TYPO3\CMS\T3editor\TypoScriptReferenceLoader' => [
+        'restFiles' => [
+            'Deprecation-84411-TypoScriptReferenceLoaderRenamedToTypoScriptReferenceController.rst',
+        ],
+    ],
 ];
diff --git a/typo3/sysext/t3editor/Classes/TypoScriptReferenceLoader.php b/typo3/sysext/t3editor/Classes/Controller/TypoScriptReferenceController.php
similarity index 92%
rename from typo3/sysext/t3editor/Classes/TypoScriptReferenceLoader.php
rename to typo3/sysext/t3editor/Classes/Controller/TypoScriptReferenceController.php
index ceec7d6df337..5cd9ceaecdd8 100644
--- a/typo3/sysext/t3editor/Classes/TypoScriptReferenceLoader.php
+++ b/typo3/sysext/t3editor/Classes/Controller/TypoScriptReferenceController.php
@@ -1,5 +1,5 @@
 <?php
-namespace TYPO3\CMS\T3editor;
+namespace TYPO3\CMS\T3editor\Controller;
 
 /*
  * This file is part of the TYPO3 CMS project.
@@ -21,7 +21,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
 /**
  * Loads TSref information from a XML file an responds to an AJAX call.
  */
-class TypoScriptReferenceLoader
+class TypoScriptReferenceController
 {
     /**
      * @var \DOMDocument
@@ -37,13 +37,12 @@ class TypoScriptReferenceLoader
     }
 
     /**
-     * General processor for AJAX requests.
-     * Called by AjaxRequestHandler
+     * Load TypoScript reference
      *
      * @param ServerRequestInterface $request
      * @return ResponseInterface
      */
-    public function processAjaxRequest(ServerRequestInterface $request): ResponseInterface
+    public function loadReference(ServerRequestInterface $request): ResponseInterface
     {
         // Load the TSref XML information:
         $this->loadFile(GeneralUtility::getFileAbsFileName('EXT:t3editor/Resources/Private/tsref.xml'));
diff --git a/typo3/sysext/t3editor/Configuration/Backend/AjaxRoutes.php b/typo3/sysext/t3editor/Configuration/Backend/AjaxRoutes.php
index 7a0f00cbd67d..64283feee6db 100644
--- a/typo3/sysext/t3editor/Configuration/Backend/AjaxRoutes.php
+++ b/typo3/sysext/t3editor/Configuration/Backend/AjaxRoutes.php
@@ -7,7 +7,7 @@ return [
     // Get TSRef
     't3editor_tsref' => [
         'path' => '/t3editor/tsref',
-        'target' => \TYPO3\CMS\T3editor\TypoScriptReferenceLoader::class . '::processAjaxRequest'
+        'target' => \TYPO3\CMS\T3editor\Controller\TypoScriptReferenceController::class . '::loadReference'
     ],
 
     // Load code completion templates
diff --git a/typo3/sysext/t3editor/Migrations/Code/ClassAliasMap.php b/typo3/sysext/t3editor/Migrations/Code/ClassAliasMap.php
index d8e5c23a48d7..9483d2a76a6d 100644
--- a/typo3/sysext/t3editor/Migrations/Code/ClassAliasMap.php
+++ b/typo3/sysext/t3editor/Migrations/Code/ClassAliasMap.php
@@ -1,4 +1,5 @@
 <?php
 return [
     'TYPO3\\CMS\\T3editor\\CodeCompletion' => \TYPO3\CMS\T3editor\Controller\CodeCompletionController::class,
+    'TYPO3\\CMS\\T3editor\\TypoScriptReferenceLoader' => \TYPO3\CMS\T3editor\Controller\TypoScriptReferenceController::class,
 ];
diff --git a/typo3/sysext/t3editor/Migrations/Code/LegacyClassesForIde.php b/typo3/sysext/t3editor/Migrations/Code/LegacyClassesForIde.php
index 44cfd020bcfb..d8b41e8b6c95 100644
--- a/typo3/sysext/t3editor/Migrations/Code/LegacyClassesForIde.php
+++ b/typo3/sysext/t3editor/Migrations/Code/LegacyClassesForIde.php
@@ -10,4 +10,11 @@ namespace TYPO3\CMS\T3editor {
     class CodeCompletion extends \TYPO3\CMS\T3editor\Controller\CodeCompletionController
     {
     }
+
+    /**
+     * @deprecated since v9, will be removed in v10
+     */
+    class TypoScriptReferenceLoader extends \TYPO3\CMS\T3editor\Controller\TypoScriptReferenceController
+    {
+    }
 }
-- 
GitLab