Skip to content

Commit 9c56ef3

Browse files
committed
⬆️ allow TYPO3 13 and PHP 8.4
1 parent e25771b commit 9c56ef3

7 files changed

Lines changed: 28 additions & 24 deletions

File tree

.github/workflows/tasks.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,20 @@ jobs:
99
strategy:
1010
fail-fast: false
1111
matrix:
12-
php: [ '8.1', '8.2', '8.3' ]
13-
typo3: [ '11', '12' ]
12+
php: [ '8.1', '8.2', '8.3', '8.4' ]
13+
typo3: [ '11', '12', '13' ]
14+
exclude:
15+
- php: '8.1'
16+
typo3: '13'
17+
- php: '8.4'
18+
typo3: '11'
1419
steps:
1520
- name: Setup PHP with PECL extension
1621
uses: shivammathur/setup-php@v2
1722
with:
1823
php-version: ${{ matrix.php }}
19-
- uses: actions/checkout@v2
20-
- uses: actions/cache@v2
24+
- uses: actions/checkout@v5
25+
- uses: actions/cache@v3
2126
with:
2227
path: ~/.composer/cache/files
2328
key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
@@ -26,4 +31,3 @@ jobs:
2631
- run: composer require typo3/minimal="^${{ matrix.typo3 }}" --dev
2732
- run: composer install --no-interaction --no-progress
2833
- run: ./vendor/bin/grumphp run --ansi
29-

Classes/Middleware/MinifyMiddleware.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@
1111
use Psr\Http\Server\RequestHandlerInterface;
1212
use TYPO3\CMS\Core\Http\Response;
1313
use TYPO3\CMS\Core\Http\Stream;
14-
use TYPO3\CMS\Core\Utility\GeneralUtility;
1514

1615
class MinifyMiddleware implements MiddlewareInterface
1716
{
17+
public function __construct(private readonly MinifyService $minifyService)
18+
{
19+
}
20+
1821
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
1922
{
2023
// minimize only html
@@ -30,9 +33,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
3033
$body->rewind();
3134
$html = $body->getContents();
3235

33-
$minifyService = GeneralUtility::makeInstance(MinifyService::class);
34-
assert($minifyService instanceof MinifyService);
35-
$html = $minifyService->minify($html);
36+
$html = $this->minifyService->minify($html);
3637
$body = new Stream('php://temp', 'wb+');
3738
$body->write($html);
3839
$response = $response->withBody($body);

Classes/Service/MinifyService.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44

55
namespace Pluswerk\PlusMinify\Service;
66

7+
use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
78
use voku\helper\HtmlMin;
89

10+
#[Autoconfigure(public: true)]
911
class MinifyService
1012
{
1113
public function minify(string $html): string
@@ -39,7 +41,7 @@ public function minify(string $html): string
3941
$output = [];
4042
$languageMeta = preg_match_all('#<meta charset=[a-zA-Z0-9-_"]*>#', $html, $output);
4143
if ($languageMeta) {
42-
$insertAt = strpos($html, (string)$output[0][0]) + strlen($output[0][0]);
44+
$insertAt = strpos($html, $output[0][0]) + strlen($output[0][0]);
4345
$html = substr($html, 0, $insertAt) . $typo3Comment . substr($html, $insertAt);
4446
} else {
4547
$html = $htmlMin->minify($html);

Configuration/Services.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ services:
44
autoconfigure: true
55
public: false
66

7-
Pluswerk\PlusMinify\Service\:
8-
resource: '../Classes/Service/*'
9-
public: true
10-
117
Pluswerk\PlusMinify\EventListener\RenderedEventListener:
128
tags:
139
- name: event.listener

composer.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@
88
"source": "https://github.com/pluswerk/minify"
99
},
1010
"require": {
11-
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
11+
"php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0",
1212
"composer-runtime-api": "^2",
13-
"typo3/cms-core": "^11.5 || ^12.4",
14-
"voku/html-min": "^4.5"
13+
"typo3/cms-core": "^11.5 || ^12.4 || ^13.4",
14+
"voku/html-min": "^4.5.1"
1515
},
1616
"require-dev": {
17-
"andersundsehr/ssi-include": "^1.1.0",
18-
"pluswerk/grumphp-config": "^7",
19-
"saschaegerer/phpstan-typo3": "^1.10.0",
20-
"ssch/typo3-rector": "^2.5.0"
17+
"andersundsehr/ssi-include": "^1.1.0 || ^2.2.0",
18+
"pluswerk/grumphp-config": "^7 || ^10",
19+
"saschaegerer/phpstan-typo3": "^1.10.0 || ^2.1.1",
20+
"ssch/typo3-rector": "^2.5.0 || ^3.6.2"
2121
},
2222
"autoload": {
2323
"psr-4": {

ext_emconf.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
'version' => InstalledVersions::getPrettyVersion('pluswerk/minify'),
1414
'constraints' => [
1515
'depends' => [
16-
'typo3' => '11.5.0 - 12.99.99',
16+
'typo3' => '11.5.0 - 13.99.99',
1717
],
1818
'conflicts' => [],
1919
'suggests' => [],

rector.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
$rectorConfig->cacheDirectory('./var/cache/rector');
1515

1616
$rectorConfig->paths(
17-
array_filter(explode("\n", (string)shell_exec("git ls-files | xargs ls -d 2>/dev/null | grep '\.php$'")))
17+
array_filter(explode("\n", (string)shell_exec("git ls-files | xargs ls -d 2>/dev/null | grep -E '\.(php)$'")))
1818
);
1919

2020
// define sets of rules
2121
$rectorConfig->sets(
2222
[
2323
...RectorSettings::sets(true),
24-
...RectorSettings::setsTypo3(true),
24+
...RectorSettings::setsTypo3(false),
2525
]
2626
);
2727

@@ -31,6 +31,7 @@
3131
[
3232
...RectorSettings::skip(),
3333
...RectorSettings::skipTypo3(),
34+
3435
/**
3536
* rector should not touch these files
3637
*/

0 commit comments

Comments
 (0)