From b900a408cf0fed37f55ca0b66f91ab44226ca1ba Mon Sep 17 00:00:00 2001
From: Daniel Siepmann <coding@daniel-siepmann.de>
Date: Mon, 3 Feb 2025 12:53:11 +0100
Subject: [PATCH] [!!!][TASK] Remove TYPO3 v11 Support (#1578)

As official v11 support has stopped.

Resolves: #1567
---
 .github/workflows/ci.yml                      | 36 --------
 .../pipeline/jobs/func-php8.1-v11-highest.yml | 14 ---
 .../pipeline/jobs/func-php8.1-v11-lowest.yml  | 14 ---
 .../pipeline/jobs/unit-php8.1-v11-highest.yml | 12 ---
 .../pipeline/jobs/unit-php8.1-v11-lowest.yml  | 12 ---
 Build/Scripts/runTests.sh                     |  5 +-
 Configuration/TCA/tx_tea_domain_model_tea.php | 86 +------------------
 README.md                                     |  1 -
 .../FrontEndEditorControllerTest.php          | 32 ++-----
 Tests/Unit/Controller/TeaControllerTest.php   |  4 -
 composer.json                                 | 10 +--
 ext_emconf.php                                |  8 +-
 rector.php                                    |  5 +-
 13 files changed, 19 insertions(+), 220 deletions(-)
 delete mode 100644 .gitlab/pipeline/jobs/func-php8.1-v11-highest.yml
 delete mode 100644 .gitlab/pipeline/jobs/func-php8.1-v11-lowest.yml
 delete mode 100644 .gitlab/pipeline/jobs/unit-php8.1-v11-highest.yml
 delete mode 100644 .gitlab/pipeline/jobs/unit-php8.1-v11-lowest.yml

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 762d36b..6acc10e 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -157,24 +157,6 @@ jobs:
       fail-fast: false
       matrix:
         include:
-          - typo3-version: "^11.5"
-            php-version: "8.1"
-            composer-dependencies: lowest
-          - typo3-version: "^11.5"
-            php-version: "8.1"
-            composer-dependencies: highest
-          - typo3-version: "^11.5"
-            php-version: "8.2"
-            composer-dependencies: lowest
-          - typo3-version: "^11.5"
-            php-version: "8.2"
-            composer-dependencies: highest
-          - typo3-version: "^11.5"
-            php-version: "8.3"
-            composer-dependencies: lowest
-          - typo3-version: "^11.5"
-            php-version: "8.3"
-            composer-dependencies: highest
           - typo3-version: "^12.4"
             php-version: "8.1"
             composer-dependencies: lowest
@@ -252,24 +234,6 @@ jobs:
       fail-fast: false
       matrix:
         include:
-          - typo3-version: "^11.5"
-            php-version: "8.1"
-            composer-dependencies: lowest
-          - typo3-version: "^11.5"
-            php-version: "8.1"
-            composer-dependencies: highest
-          - typo3-version: "^11.5"
-            php-version: "8.2"
-            composer-dependencies: lowest
-          - typo3-version: "^11.5"
-            php-version: "8.2"
-            composer-dependencies: highest
-          - typo3-version: "^11.5"
-            php-version: "8.3"
-            composer-dependencies: lowest
-          - typo3-version: "^11.5"
-            php-version: "8.3"
-            composer-dependencies: highest
           - typo3-version: "^12.4"
             php-version: "8.1"
             composer-dependencies: lowest
diff --git a/.gitlab/pipeline/jobs/func-php8.1-v11-highest.yml b/.gitlab/pipeline/jobs/func-php8.1-v11-highest.yml
deleted file mode 100644
index ca7bd93..0000000
--- a/.gitlab/pipeline/jobs/func-php8.1-v11-highest.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-func-php8.1-v11-highest:
-  extends: .default
-  image: ghcr.io/typo3/core-testing-php81:latest
-  services:
-    - mariadb:10
-  stage: test
-  needs:
-    - build-composer-dependencies
-    - php-lint-php8.1
-  script:
-    - echo "Job ${CI_JOB_NAME}"
-    - composer require --no-ansi --no-interaction --no-progress --no-install typo3/cms-core:"^11.5"
-    - composer update --no-ansi --no-interaction --no-progress --with-dependencies
-    - composer ci:tests:functional
diff --git a/.gitlab/pipeline/jobs/func-php8.1-v11-lowest.yml b/.gitlab/pipeline/jobs/func-php8.1-v11-lowest.yml
deleted file mode 100644
index eab6293..0000000
--- a/.gitlab/pipeline/jobs/func-php8.1-v11-lowest.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-func-php8.1-v11-lowest:
-  extends: .default
-  image: ghcr.io/typo3/core-testing-php81:latest
-  services:
-    - mariadb:10
-  stage: test
-  needs:
-    - build-composer-dependencies
-    - php-lint-php8.1
-  script:
-    - echo "Job ${CI_JOB_NAME}"
-    - composer require --no-ansi --no-interaction --no-progress --no-install typo3/cms-core:"^11.5"
-    - composer update --no-ansi --no-interaction --no-progress --with-dependencies --prefer-lowest
-    - composer ci:tests:functional
diff --git a/.gitlab/pipeline/jobs/unit-php8.1-v11-highest.yml b/.gitlab/pipeline/jobs/unit-php8.1-v11-highest.yml
deleted file mode 100644
index c4e8a50..0000000
--- a/.gitlab/pipeline/jobs/unit-php8.1-v11-highest.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-unit-php8.1-v11-highest:
-  extends: .default
-  image: ghcr.io/typo3/core-testing-php81:latest
-  stage: test
-  needs:
-    - build-composer-dependencies
-    - php-lint-php8.1
-  script:
-    - echo "Job ${CI_JOB_NAME}"
-    - composer require --no-ansi --no-interaction --no-progress --no-install typo3/cms-core:"^11.5"
-    - composer update --no-ansi --no-interaction --no-progress --with-dependencies
-    - composer ci:tests:unit
diff --git a/.gitlab/pipeline/jobs/unit-php8.1-v11-lowest.yml b/.gitlab/pipeline/jobs/unit-php8.1-v11-lowest.yml
deleted file mode 100644
index 1eca603..0000000
--- a/.gitlab/pipeline/jobs/unit-php8.1-v11-lowest.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-unit-php8.1-v11-lowest:
-  extends: .default
-  image: ghcr.io/typo3/core-testing-php81:latest
-  stage: test
-  needs:
-    - build-composer-dependencies
-    - php-lint-php8.1
-  script:
-    - echo "Job ${CI_JOB_NAME}"
-    - composer require --no-ansi --no-interaction --no-progress --no-install typo3/cms-core:"^11.5"
-    - composer update --no-ansi --no-interaction --no-progress --with-dependencies --prefer-lowest
-    - composer ci:tests:unit
diff --git a/Build/Scripts/runTests.sh b/Build/Scripts/runTests.sh
index ed3879f..d11f14c 100755
--- a/Build/Scripts/runTests.sh
+++ b/Build/Scripts/runTests.sh
@@ -223,10 +223,9 @@ Options:
             - 15    maintained until 2027-11-11
             - 16    maintained until 2028-11-09
 
-    -t <11.5|12.4>
+    -t <12.4>
         Only with -s composerUpdateMin|composerUpdateMax
         Specifies the TYPO3 CORE Version to be used
-            - 11.5: use TYPO3 v11 with typo3/cms-composer-installers ^3
             - 12.4: (default) use TYPO3 v12 with typo3/cms-composer-installers ^5
 
     -p <8.1|8.2|8.3|8.4>
@@ -374,7 +373,7 @@ while getopts "a:b:s:d:i:p:e:t:xy:o:nhu" OPT; do
             ;;
         t)
             CORE_VERSION=${OPTARG}
-            if ! [[ ${CORE_VERSION} =~ ^(11.5|12.4)$ ]]; then
+            if ! [[ ${CORE_VERSION} =~ ^(12.4)$ ]]; then
                 INVALID_OPTIONS+=("-t ${OPTARG}")
             fi
             ;;
diff --git a/Configuration/TCA/tx_tea_domain_model_tea.php b/Configuration/TCA/tx_tea_domain_model_tea.php
index f1b6b6c..e8986ae 100644
--- a/Configuration/TCA/tx_tea_domain_model_tea.php
+++ b/Configuration/TCA/tx_tea_domain_model_tea.php
@@ -1,9 +1,6 @@
 <?php
 
-use TYPO3\CMS\Core\Information\Typo3Version;
-use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
-
-$tca = [
+return [
     'ctrl' => [
         'title' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_tea',
         'label' => 'title',
@@ -208,84 +205,3 @@ $tca = [
         ],
     ],
 ];
-
-$typo3Version = new Typo3Version();
-if ($typo3Version->getMajorVersion() < 12) {
-    $tca = array_replace_recursive(
-        $tca,
-        [
-            'ctrl' => [
-                'cruser_id' => 'cruser_id',
-            ],
-            'columns' => [
-                'title' => [
-                    'config' => [
-                        'eval' => 'trim,required',
-                    ],
-                ],
-            ],
-        ]
-    );
-    unset($tca['columns']['title']['required']);
-
-    $tca['columns']['l18n_parent']['config']['items'] = [
-        [
-            0 => '',
-            1 => 0,
-        ],
-    ];
-    $tca['columns']['image'] = [
-        'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_tea.image',
-        'config' => ExtensionManagementUtility::getFileFieldTCAConfig(
-            'image',
-            [
-                'maxitems' => 1,
-                'appearance' => [
-                    'collapseAll' => true,
-                    'useSortable' => false,
-                    'enabledControls' => [
-                        'hide' => false,
-                    ],
-                ],
-            ]
-        ),
-    ];
-    $tca['columns']['hidden']['config'] = [
-        'type' => 'check',
-        'label' => 'LLL:EXT:tea/Resources/Private/Language/locallang_db.xlf:tx_tea_domain_model_tea.hidden',
-        'items' => [
-            [
-                0 => '',
-                'invertStateDisplay' => true,
-            ],
-        ],
-    ];
-    $tca['columns']['starttime']['config'] = [
-        'type' => 'input',
-        'renderType' => 'inputDateTime',
-        'eval' => 'datetime,int',
-        'default' => 0,
-    ];
-    $tca['columns']['endtime']['config'] = [
-        'type' => 'input',
-        'renderType' => 'inputDateTime',
-        'eval' => 'datetime,int',
-        'default' => 0,
-    ];
-    $tca['columns']['fe_group']['config']['items'] = [
-        [
-            0 => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.hide_at_login',
-            1 => -1,
-        ],
-        [
-            0 => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.any_login',
-            1 => -2,
-        ],
-        [
-            0 => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.usergroups',
-            1 => '--div--',
-        ],
-    ];
-}
-
-return $tca;
diff --git a/README.md b/README.md
index 19651a9..6e9c522 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,6 @@
 # Example TYPO3 extension for code quality checks and automated tests
 
 [![TYPO3 V12](https://img.shields.io/badge/TYPO3-12-orange.svg)](https://get.typo3.org/version/12)
-[![TYPO3 V11](https://img.shields.io/badge/TYPO3-11-orange.svg)](https://get.typo3.org/version/11)
 [![License](https://img.shields.io/github/license/TYPO3-Documentation/tea)](https://packagist.org/packages/ttn/tea)
 [![Total downloads](https://poser.pugx.org/ttn/tea/downloads.svg)](https://packagist.org/packages/ttn/tea)
 [![GitHub CI status](https://github.com/TYPO3BestPractices/tea/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/TYPO3BestPractices/tea/actions)
diff --git a/Tests/Unit/Controller/FrontEndEditorControllerTest.php b/Tests/Unit/Controller/FrontEndEditorControllerTest.php
index b871613..a90712b 100644
--- a/Tests/Unit/Controller/FrontEndEditorControllerTest.php
+++ b/Tests/Unit/Controller/FrontEndEditorControllerTest.php
@@ -12,10 +12,8 @@ use TYPO3\CMS\Core\Context\Context;
 use TYPO3\CMS\Core\Context\UserAspect;
 use TYPO3\CMS\Core\Http\HtmlResponse;
 use TYPO3\CMS\Core\Http\RedirectResponse;
-use TYPO3\CMS\Core\Information\Typo3Version;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
-use TYPO3\CMS\Extbase\Mvc\Exception\StopActionException;
 use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
 use TYPO3\CMS\Fluid\View\TemplateView;
 use TYPO3\TestingFramework\Core\AccessibleObjectInterface;
@@ -55,9 +53,6 @@ final class FrontEndEditorControllerTest extends UnitTestCase
 
         // We need to create an accessible mock in order to be able to set the protected `view`.
         $methodsToMock = ['htmlResponse', 'redirect', 'redirectToUri'];
-        if ((new Typo3Version())->getMajorVersion() < 12) {
-            $methodsToMock[] = 'forward';
-        }
         $this->subject = $this->getAccessibleMock(
             FrontEndEditorController::class,
             $methodsToMock,
@@ -214,32 +209,15 @@ final class FrontEndEditorControllerTest extends UnitTestCase
 
     private function mockRedirect(string $actionName): void
     {
-        if ((new Typo3Version())->getMajorVersion() < 12) {
-            $this->subject->expects(self::once())->method('redirect')
-                ->with($actionName)
-                // @phpstan-ignore-next-line This class does not exist in V12 anymore, but this branch is V11-only.
-                ->willThrowException(new StopActionException('redirectToUri', 1476045828));
-            // @phpstan-ignore-next-line This class does not exist in V12 anymore, but this branch is V11-only.
-            $this->expectException(StopActionException::class);
-        } else {
-            $redirectResponse = $this->createStub(RedirectResponse::class);
-            $this->subject->expects(self::once())->method('redirect')->with($actionName)
-                ->willReturn($redirectResponse);
-        }
+        $redirectResponse = $this->createStub(RedirectResponse::class);
+        $this->subject->expects(self::once())->method('redirect')->with($actionName)
+            ->willReturn($redirectResponse);
     }
 
     private function stubRedirect(string $actionName): void
     {
-        if ((new Typo3Version())->getMajorVersion() < 12) {
-            $this->subject->method('redirect')
-                // @phpstan-ignore-next-line This class does not exist in V12 anymore, but this branch is V11-only.
-                ->willThrowException(new StopActionException('redirectToUri', 1476045828));
-            // @phpstan-ignore-next-line This class does not exist in V12 anymore, but this branch is V11-only.
-            $this->expectException(StopActionException::class);
-        } else {
-            $redirectResponse = $this->createStub(RedirectResponse::class);
-            $this->subject->method('redirect')->willReturn($redirectResponse);
-        }
+        $redirectResponse = $this->createStub(RedirectResponse::class);
+        $this->subject->method('redirect')->willReturn($redirectResponse);
     }
 
     /**
diff --git a/Tests/Unit/Controller/TeaControllerTest.php b/Tests/Unit/Controller/TeaControllerTest.php
index b8913d9..568f1f4 100644
--- a/Tests/Unit/Controller/TeaControllerTest.php
+++ b/Tests/Unit/Controller/TeaControllerTest.php
@@ -9,7 +9,6 @@ use TTN\Tea\Controller\TeaController;
 use TTN\Tea\Domain\Model\Tea;
 use TTN\Tea\Domain\Repository\TeaRepository;
 use TYPO3\CMS\Core\Http\HtmlResponse;
-use TYPO3\CMS\Core\Information\Typo3Version;
 use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
 use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
 use TYPO3\CMS\Fluid\View\TemplateView;
@@ -46,9 +45,6 @@ final class TeaControllerTest extends UnitTestCase
         $this->teaRepositoryMock = $this->createMock(TeaRepository::class);
         // We need to create an accessible mock in order to be able to set the protected `view`.
         $methodsToMock = ['htmlResponse', 'redirect', 'redirectToUri'];
-        if ((new Typo3Version())->getMajorVersion() < 12) {
-            $methodsToMock[] = 'forward';
-        }
         $this->subject = $this->getAccessibleMock(TeaController::class, $methodsToMock, [$this->teaRepositoryMock]);
 
         $this->viewMock = $this->createMock(TemplateView::class);
diff --git a/composer.json b/composer.json
index d5cf2ed..0cf6830 100644
--- a/composer.json
+++ b/composer.json
@@ -41,10 +41,10 @@
 	"require": {
 		"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
 		"psr/http-message": "^1.0.1",
-		"typo3/cms-core": "^11.5.41 || ^12.4.26",
-		"typo3/cms-extbase": "^11.5.41 || ^12.4.26",
-		"typo3/cms-fluid": "^11.5.41 || ^12.4.26",
-		"typo3/cms-frontend": "^11.5.41 || ^12.4.26"
+		"typo3/cms-core": "^12.4.26",
+		"typo3/cms-extbase": "^12.4.26",
+		"typo3/cms-fluid": "^12.4.26",
+		"typo3/cms-frontend": "^12.4.26"
 	},
 	"require-dev": {
 		"ergebnis/composer-normalize": "2.45.0",
@@ -69,7 +69,7 @@
 		"symfony/yaml": "5.4.45 || 6.4.18 || 7.2.3",
 		"tomasvotruba/cognitive-complexity": "0.2.3",
 		"tomasvotruba/type-coverage": "1.0.0",
-		"typo3/cms-fluid-styled-content": "^11.5.41 || ^12.4.26",
+		"typo3/cms-fluid-styled-content": "^12.4.26",
 		"typo3/coding-standards": "0.6.1 || 0.8.0",
 		"typo3/testing-framework": "7.1.1",
 		"webmozart/assert": "^1.11.0"
diff --git a/ext_emconf.php b/ext_emconf.php
index b41745f..aca4b50 100644
--- a/ext_emconf.php
+++ b/ext_emconf.php
@@ -8,10 +8,10 @@ $EM_CONF[$_EXTKEY] = [
     'constraints' => [
         'depends' => [
             'php' => '8.1.0-8.3.99',
-            'typo3' => '11.5.41-12.4.99',
-            'extbase' => '11.5.41-12.4.99',
-            'fluid' => '11.5.41-12.4.99',
-            'frontend' => '11.5.41-12.4.99',
+            'typo3' => '12.4.26-12.4.99',
+            'extbase' => '12.4.26-12.4.99',
+            'fluid' => '12.4.26-12.4.99',
+            'frontend' => '12.4.26-12.4.99',
         ],
     ],
     'state' => 'stable',
diff --git a/rector.php b/rector.php
index aaaf1b0..ba12c0e 100644
--- a/rector.php
+++ b/rector.php
@@ -80,8 +80,7 @@ return RectorConfig::configure()
         Typo3SetList::CODE_QUALITY,
         Typo3SetList::GENERAL,
 
-        Typo3LevelSetList::UP_TO_TYPO3_11,
-        // Typo3LevelSetList::UP_TO_TYPO3_12,
+        Typo3LevelSetList::UP_TO_TYPO3_12,
 
         // TYPO3TestingFrameworkSetList::TYPO3_TESTING_FRAMEWORK_7,
     ])
@@ -96,7 +95,7 @@ return RectorConfig::configure()
     ->withImportNames(true, true, false)
     ->withConfiguredRule(ExtEmConfRector::class, [
         ExtEmConfRector::PHP_VERSION_CONSTRAINT => '8.1.0-8.3.99',
-        ExtEmConfRector::TYPO3_VERSION_CONSTRAINT => '11.5.41-12.4.99',
+        ExtEmConfRector::TYPO3_VERSION_CONSTRAINT => '12.4.26-12.4.99',
         ExtEmConfRector::ADDITIONAL_VALUES_TO_BE_REMOVED => [],
     ])
     ->withSkip([