Skip to content

Commit

Permalink
Prepare EXT:staticfilecache for TYPO3 next level :-)
Browse files Browse the repository at this point in the history
  • Loading branch information
lochmueller committed Nov 15, 2023
1 parent 7bf0ed5 commit db8a6d8
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
php-version: 8.1
extensions: intl, mbstring, json, zip, curl
tools: composer:v2

Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ '8.0', '8.1', '8.2' ]
typo3: [ '11', '12' ]
exclude:
- php: '8.0'
typo3: '12'
php: [ '8.1', '8.2' ]
typo3: [ '12' ]
steps:
- uses: actions/checkout@v1
- name: Setup PHP with PECL extension
Expand Down
2 changes: 1 addition & 1 deletion Classes/Generator/HtaccessGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ protected function cleanupHeaderValues(array $headers): array
}

// illegal chars
$headers = array_map(fn ($item) => str_replace('"', '\"', $item), $headers);
$headers = array_map(fn($item) => str_replace('"', '\"', $item), $headers);

return $headers;
}
Expand Down
2 changes: 1 addition & 1 deletion Classes/Generator/PhpGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function generate(string $entryIdentifier, string $fileName, ResponseInte
if ($configuration->isBool('debugHeaders')) {
$headers['X-SFC-State'] = 'StaticFileCache - via PhpGenerator';
}
$headers = array_map(fn ($item) => str_replace("'", "\'", $item), $headers);
$headers = array_map(fn($item) => str_replace("'", "\'", $item), $headers);
$requestUri = GeneralUtility::getIndpEnv('REQUEST_URI');

$variables = [
Expand Down
1 change: 1 addition & 0 deletions Classes/Middleware/GenerateMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace SFC\Staticfilecache\Middleware;

use TYPO3\CMS\Core\Context\Context;
use Psr\EventDispatcher\EventDispatcherInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
Expand Down
4 changes: 2 additions & 2 deletions Classes/Service/HttpPush/AbstractHttpPush.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ protected function streamlineFilePaths(array $paths): array
return $url;
}, $paths);

$paths = array_filter($paths, fn ($path) => GeneralUtility::isOnCurrentHost($path) && ':' !== $path[0]);
$paths = array_filter($paths, fn($path) => GeneralUtility::isOnCurrentHost($path) && ':' !== $path[0]);

return array_map(fn ($url) => '/' . ltrim(str_replace(GeneralUtility::getIndpEnv('TYPO3_REQUEST_HOST'), '', $url), '/'), $paths);
return array_map(fn($url) => '/' . ltrim(str_replace(GeneralUtility::getIndpEnv('TYPO3_REQUEST_HOST'), '', $url), '/'), $paths);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Classes/Service/InlineAssets/AbstractInlineAssets.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ abstract public function replaceInline(string $content): string;

protected function includeAssets(string $regex, string $content): string
{
return preg_replace_callback($regex, fn (array $match): string => $this->parseAsset($match), $content);
return preg_replace_callback($regex, fn(array $match): string => $this->parseAsset($match), $content);
}

protected function parseAsset(array $match): string
Expand Down
2 changes: 1 addition & 1 deletion Classes/Service/InlineAssets/InlineImages.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ public function canHandleExtension(string $fileExtension): bool
*/
public function replaceInline(string $content): string
{
return preg_replace_callback('/(?<=<img src=")(?<src>\/.+?\.(?<ext>' . implode('|', $this->imageExtensions) . '))(?=")/', fn (array $match): string => $this->parseAsset($match), $content);
return preg_replace_callback('/(?<=<img src=")(?<src>\/.+?\.(?<ext>' . implode('|', $this->imageExtensions) . '))(?=")/', fn(array $match): string => $this->parseAsset($match), $content);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace SFC\Staticfilecache\ViewHelpers\Format;
Expand Down
15 changes: 6 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,12 @@
}
],
"require": {
"php": "^8.0",
"php": "^8.1",
"ext-pdo": "*",
"ext-zlib": "*",
"typo3/cms-core": "^11.5||^12.4",
"typo3/cms-backend": "^11.5||^12.4",
"typo3/cms-extensionmanager": "^11.5||^12.4"
},
"replace": {
"typo3-ter/staticfilecache": "self.version"
"typo3/cms-core": "^12.4||13.*.*@dev",
"typo3/cms-backend": "^12.4||13.*.*@dev",
"typo3/cms-extensionmanager": "^12.4||13.*.*@dev"
},
"license": "GPL-2.0-or-later",
"homepage": "https://extensions.typo3.org/extension/staticfilecache",
Expand All @@ -48,7 +45,7 @@
"source": "https://github.com/lochmueller/staticfilecache"
},
"require-dev": {
"typo3/testing-framework": "^7.0",
"typo3/testing-framework": "^8.0",
"friendsofphp/php-cs-fixer": "^3.30",
"phpmetrics/phpmetrics": "^2.5",
"ssch/typo3-rector": "^1.2",
Expand Down Expand Up @@ -92,7 +89,7 @@
"phpunit -c Tests/UnitTests.xml"
],
"phpstan": [
".Build/bin/phpstan"
".Build/bin/phpstan --memory-limit=1024M"
]
}
}
7 changes: 3 additions & 4 deletions ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@
'category' => 'fe',
'constraints' => [
'depends' => [
'typo3' => '11.5.0-12.4.99',
'backend' => '11.5.0-12.4.99',
'php' => '8.0.0-8.99.99',
'typo3' => '12.4.0-13.4.99',
'backend' => '12.4.0-13.4.99',
'php' => '8.1.0-8.99.99',
],
],
'state' => 'stable',
'clearCacheOnLoad' => true,
'author' => 'StaticFileCache Team',
'author_email' => 'tim@fruit-lab.de',
'author_company' => 'StaticFileCache Team',
Expand Down
4 changes: 2 additions & 2 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
$parameters->set(Typo3Option::TYPOSCRIPT_INDENT_SIZE, 4);

$rectorConfig->sets([
Typo3LevelSetList::UP_TO_TYPO3_11,
Typo3LevelSetList::UP_TO_TYPO3_12,
]);

$rectorConfig->phpVersion(PhpVersion::PHP_80);
$rectorConfig->phpVersion(PhpVersion::PHP_81);

$rectorConfig->paths([
__DIR__ . '/',
Expand Down

0 comments on commit db8a6d8

Please sign in to comment.