From 01f381a3b4df8278d589f181eb76c55545a6cede Mon Sep 17 00:00:00 2001 From: Matthias Vogel Date: Mon, 12 Dec 2022 18:15:39 +0100 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=90=9B=20fix=20phpstan?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- phpstan.neon | 3 +++ 1 file changed, 3 insertions(+) diff --git a/phpstan.neon b/phpstan.neon index d994959..bdeda83 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -6,3 +6,6 @@ parameters: excludePaths: - Classes/XClass/ExtbaseDispatcherLegacy.php - Classes/XClass/ExtbaseDispatcherV11.php + typo3: + requestGetAttributeMapping: + server-timing:middleware:inward: Kanti\ServerTiming\Dto\StopWatch|null From 26631e671f3e220d05f6441c095b1d649110708d Mon Sep 17 00:00:00 2001 From: Matthias Vogel Date: Mon, 12 Dec 2022 18:25:35 +0100 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=94=A5=20remove=20TYPO3=209=20compati?= =?UTF-8?q?bility?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/tasks.yml | 17 ++++----- Classes/Utility/VersionUtility.php | 25 ------------ Classes/XClass/CoreRequestFactory.php | 35 ----------------- Configuration/RequestMiddlewares.php | 1 + Tests/CoreRequestFactoryTest.php | 55 --------------------------- composer.json | 13 ++++--- ext_emconf.php | 4 +- ext_localconf.php | 5 --- 8 files changed, 17 insertions(+), 138 deletions(-) delete mode 100644 Classes/Utility/VersionUtility.php delete mode 100644 Classes/XClass/CoreRequestFactory.php delete mode 100644 Tests/CoreRequestFactoryTest.php diff --git a/.github/workflows/tasks.yml b/.github/workflows/tasks.yml index c7237c6..ac7d7c8 100644 --- a/.github/workflows/tasks.yml +++ b/.github/workflows/tasks.yml @@ -9,18 +9,15 @@ jobs: strategy: fail-fast: false matrix: - php: [ '7.4', '8.0', '8.1' ] - typo3: [ '9', '10', '11' ] + php: [ '7.4', '8.0', '8.1', '8.2' ] + typo3: [ '10', '11' ] exclude: - php: '8.0' typo3: '10' - php: '8.1' typo3: '10' - - - php: '8.0' - typo3: '9' - - php: '8.1' - typo3: '9' + - php: '8.2' + typo3: '10' steps: - name: Setup PHP with PECL extension uses: shivammathur/setup-php@v2 @@ -38,8 +35,8 @@ jobs: key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} restore-keys: | ${{ runner.os }}-${{ matrix.php }}-composer- - - run: composer require typo3/minimal="^${{ matrix.typo3 }}" --dev - - run: composer install --no-interaction --no-progress + - run: composer require typo3/minimal="^${{ matrix.typo3 }}" --dev --ignore-platform-req=php+ + - run: composer install --no-interaction --no-progress --ignore-platform-req=php+ - run: ./vendor/bin/grumphp run --ansi - run: composer test - run: jq 'del(.logs.html)' infection.json > infection.json.new && mv infection.json.new infection.json @@ -77,7 +74,7 @@ jobs: - name: Upload EXT:server_timing to TER run: | - sed -i 's/\\Kanti\\ServerTiming\\Utility\\VersionUtility::getVersion()/'\''${{ steps.get_version.outputs.VERSION }}'\''/g' ext_emconf.php \ + sed -i 's/\\Composer\\InstalledVersions::getPrettyVersion('\''kanti\/server-timing'\'')/'\''${{ steps.get_version.outputs.VERSION }}'\''/g' ext_emconf.php \ && git config --global user.email "no@one" \ && git config --global user.name "No One" \ && git add ext_emconf.php \ diff --git a/Classes/Utility/VersionUtility.php b/Classes/Utility/VersionUtility.php deleted file mode 100644 index 820fb22..0000000 --- a/Classes/Utility/VersionUtility.php +++ /dev/null @@ -1,25 +0,0 @@ -=v10 - */ -class CoreRequestFactory extends RequestFactory -{ - protected function getClient(): ClientInterface - { - $httpOptions = $GLOBALS['TYPO3_CONF_VARS']['HTTP']; - $httpOptions['verify'] = filter_var($httpOptions['verify'], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) ?? $httpOptions['verify']; - - if (isset($GLOBALS['TYPO3_CONF_VARS']['HTTP']['handler']) && is_array($GLOBALS['TYPO3_CONF_VARS']['HTTP']['handler'])) { - $stack = HandlerStack::create(); - foreach ($GLOBALS['TYPO3_CONF_VARS']['HTTP']['handler'] ?? [] as $name => $handler) { - $stack->push($handler, (string)$name); - } - $httpOptions['handler'] = $stack; - } - - return GeneralUtility::makeInstance(Client::class, $httpOptions); - } -} diff --git a/Configuration/RequestMiddlewares.php b/Configuration/RequestMiddlewares.php index fd77d68..a0568e5 100644 --- a/Configuration/RequestMiddlewares.php +++ b/Configuration/RequestMiddlewares.php @@ -37,6 +37,7 @@ 'typo3/cms-backend/site-resolver', 'typo3/cms-backend/legacy-document-template', 'typo3/cms-extbase/signal-slot-deprecator', + 'typo3/cms-core/response-propagation', ], ], ], diff --git a/Tests/CoreRequestFactoryTest.php b/Tests/CoreRequestFactoryTest.php deleted file mode 100644 index 001c5d6..0000000 --- a/Tests/CoreRequestFactoryTest.php +++ /dev/null @@ -1,55 +0,0 @@ -setUpTypo3ConfVars(); - - $this->expectExceptionMessage('Call to protected method Kanti\ServerTiming\XClass\CoreRequestFactory::getClient()'); - /** @phpstan-ignore-next-line */ - (new CoreRequestFactory())->getClient(); - } - - /** - * @test - * @covers ::getClient - */ - public function getClient(): void - { - $this->setUpTypo3ConfVars(); - - $requestFactory = new ReflectionClass(CoreRequestFactory::class); - $reflectionMethod = $requestFactory->getMethod('getClient'); - $reflectionMethod->setAccessible(true); - $client = $reflectionMethod->invoke(new CoreRequestFactory()); - self::assertInstanceOf(ClientInterface::class, $client); - } - - private function setUpTypo3ConfVars(): void - { - $GLOBALS['TYPO3_CONF_VARS']['HTTP'] = [ - 'verify' => true, - 'handler' => [ - 'testKey' => function () { - }, - ], - ]; - } -} diff --git a/composer.json b/composer.json index dc8572b..3429484 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description" : "Show timings of Database and HTTP Calls", "type" : "typo3-cms-extension", "minimum-stability" : "stable", - "license" : "GPL-2.0+", + "license" : "GPL-2.0-or-later", "authors" : [ { "name" : "Matthias Vogel", @@ -46,14 +46,15 @@ "infection" : "infection --only-covered" }, "require" : { - "php" : "^7.3 || ~8.0 || ~8.1", - "typo3/cms-core" : "9.* || 10.* || 11.*", - "typo3/cms-extbase" : "9.* || 10.* || 11.*", - "ocramius/package-versions": "^2.1" + "php" : "~7.4 || ~8.0 || ~8.1 || ~8.2", + "typo3/cms-core" : "10.* || 11.*", + "typo3/cms-extbase" : "10.* || 11.*", + "ocramius/package-versions": "^2.1", + "composer-runtime-api": "^2.0.0" }, "require-dev" : { "pluswerk/grumphp-config" : "^4.0 || ^5.0", - "typo3/cms-adminpanel" : "9.* || 10.* || 11.*", + "typo3/cms-adminpanel" : "10.* || 11.*", "phpunit/phpunit" : "^9.5", "infection/infection" : "^0.18.2 || ^0.26.13", "saschaegerer/phpstan-typo3": "^1.1", diff --git a/ext_emconf.php b/ext_emconf.php index 7f0f850..363621d 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -12,10 +12,10 @@ 'uploadfolder' => '0', 'createDirs' => '', 'clearCacheOnLoad' => 0, - 'version' => \Kanti\ServerTiming\Utility\VersionUtility::getVersion(), + 'version' => \Composer\InstalledVersions::getPrettyVersion('kanti/server-timing'), 'constraints' => [ 'depends' => [ - 'typo3' => '9.0.0-11.999.999', + 'typo3' => '10.0.0-11.999.999', ], 'conflicts' => [], 'suggests' => [], diff --git a/ext_localconf.php b/ext_localconf.php index cea05b5..169e992 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -23,9 +23,4 @@ 'className' => AdminpanelSqlLoggingMiddleware::class, ]; -if (version_compare((new Typo3Version())->getBranch(), '10.0', '<')) { - $GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][RequestFactory::class] = [ - 'className' => CoreRequestFactory::class, - ]; -} $GLOBALS['TYPO3_CONF_VARS']['HTTP']['handler']['server_timing'] = GuzzleUtility::getHandler();