Skip to content

Commit de2ca5e

Browse files
committed
TASK: Add TYPO3 13 compatibility
1 parent 3ea7a5a commit de2ca5e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+233
-494
lines changed

.github/workflows/coding_standard.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
strategy:
1717
matrix:
18-
php-versions: [ 7.4, 8.0, 8.1 ]
18+
php-versions: [ 8.1 ]
1919
steps:
2020
- uses: actions/checkout@v4
2121

.github/workflows/php_linter.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
strategy:
1717
matrix:
18-
php-versions: [ 7.4, 8.0, 8.1 ]
18+
php-versions: [ 8.1, 8.2, 8.3 ]
1919
steps:
2020
- uses: actions/checkout@v4
2121

.github/workflows/phpstan.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818

1919
- uses: shivammathur/setup-php@v2
2020
with:
21-
php-version: 7.4
21+
php-version: 8.1
2222
coverage: none
2323
env:
2424
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/tests.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ jobs:
1616
strategy:
1717
matrix:
1818
typo3-php-versions:
19-
- { typo3: 10, php: 7.4 }
20-
- { typo3: 11, php: 7.4 }
2119
- { typo3: 12, php: 8.1 }
20+
- { typo3: 13, php: 8.1 }
2221

2322
name: "Run tests with PHP ${{ matrix.typo3-php-versions.php }} using TYPO3 ${{ matrix.typo3-php-versions.typo3 }}"
2423
steps:

Build/FunctionalTests.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?xml version="1.0"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="true" bootstrap="../.Build/vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTestsBootstrap.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3-
<coverage>
4-
<include>
5-
<directory>../Classes/</directory>
6-
</include>
7-
</coverage>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="true" bootstrap="../.Build/vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTestsBootstrap.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.4/phpunit.xsd">
83
<testsuites>
94
<testsuite name="typo3_encore tests">
105
<directory>../Tests/Functional/</directory>
116
</testsuite>
127
</testsuites>
8+
<source>
9+
<include>
10+
<directory>../Classes/</directory>
11+
</include>
12+
</source>
1313
</phpunit>

Build/UnitTests.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?xml version="1.0"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="true" bootstrap="../.Build/vendor/typo3/testing-framework/Resources/Core/Build/UnitTestsBootstrap.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3-
<coverage>
4-
<include>
5-
<directory>../Classes/</directory>
6-
</include>
7-
</coverage>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="true" bootstrap="../.Build/vendor/typo3/testing-framework/Resources/Core/Build/UnitTestsBootstrap.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.4/phpunit.xsd">
83
<testsuites>
94
<testsuite name="typo3_encore tests">
105
<directory>../Tests/Unit/</directory>
116
</testsuite>
127
</testsuites>
8+
<source>
9+
<include>
10+
<directory>../Classes/</directory>
11+
</include>
12+
</source>
1313
</phpunit>

Classes/Asset/EntrypointLookup.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,20 @@ final class EntrypointLookup implements EntrypointLookupInterface, IntegrityData
2020
{
2121
private ?array $entriesData = null;
2222

23-
private string $entrypointJsonPath;
23+
private readonly string $entrypointJsonPath;
2424

2525
private array $returnedFiles = [];
2626

27-
private JsonDecoderInterface $jsonDecoder;
28-
29-
private FilesystemInterface $filesystem;
30-
31-
private bool $strictMode;
27+
private readonly FilesystemInterface $filesystem;
3228

3329
public function __construct(
3430
string $entrypointJsonPath,
35-
bool $strictMode,
36-
JsonDecoderInterface $jsonDecoder,
31+
private readonly bool $strictMode,
32+
private readonly JsonDecoderInterface $jsonDecoder,
3733
FilesystemInterface $filesystem
3834
) {
3935
$this->entrypointJsonPath = $filesystem->getFileAbsFileName($entrypointJsonPath);
40-
$this->jsonDecoder = $jsonDecoder;
4136
$this->filesystem = $filesystem;
42-
$this->strictMode = $strictMode;
4337
}
4438

4539
public function getJavaScriptFiles(string $entryName): array
@@ -127,7 +121,7 @@ private function getEntriesData(): array
127121

128122
try {
129123
$this->entriesData = $this->jsonDecoder->decode($this->filesystem->get($this->entrypointJsonPath));
130-
} catch (JsonDecodeException $e) {
124+
} catch (JsonDecodeException) {
131125
throw new InvalidArgumentException(sprintf(
132126
'There was a problem JSON decoding the "%s" file',
133127
$this->entrypointJsonPath

Classes/Asset/EntrypointLookupCollection.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,15 @@
1515

1616
class EntrypointLookupCollection implements EntrypointLookupCollectionInterface
1717
{
18-
private EntryLookupFactoryInterface $entryLookupFactory;
19-
2018
/**
2119
* @var array|EntrypointLookupInterface[]
2220
*/
2321
private ?array $buildEntrypoints = null;
2422

25-
private ?string $defaultBuildName;
26-
27-
public function __construct(EntryLookupFactoryInterface $entryLookupFactory, string $defaultBuildName = null)
28-
{
29-
$this->entryLookupFactory = $entryLookupFactory;
30-
$this->defaultBuildName = $defaultBuildName;
23+
public function __construct(
24+
private readonly EntryLookupFactoryInterface $entryLookupFactory,
25+
private readonly ?string $defaultBuildName = null
26+
) {
3127
}
3228

3329
public function getEntrypointLookup(string $buildName = null): EntrypointLookupInterface

Classes/Asset/TagRenderer.php

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,11 @@
2525

2626
final class TagRenderer implements TagRendererInterface
2727
{
28-
private EntrypointLookupCollectionInterface $entrypointLookupCollection;
29-
30-
private AssetRegistryInterface $assetRegistry;
31-
3228
private ?ApplicationType $applicationType = null;
3329

3430
public function __construct(
35-
EntrypointLookupCollectionInterface $entrypointLookupCollection,
36-
AssetRegistryInterface $assetRegistry
31+
private readonly EntrypointLookupCollectionInterface $entrypointLookupCollection,
32+
private readonly AssetRegistryInterface $assetRegistry
3733
) {
3834
try {
3935
$this->applicationType = array_key_exists(
@@ -42,12 +38,9 @@ public function __construct(
4238
) && $GLOBALS['TYPO3_REQUEST'] instanceof ServerRequestInterface ? ApplicationType::fromRequest(
4339
$GLOBALS['TYPO3_REQUEST']
4440
) : null;
45-
} catch (RuntimeException $e) {
41+
} catch (RuntimeException) {
4642
$this->applicationType = null;
4743
}
48-
49-
$this->entrypointLookupCollection = $entrypointLookupCollection;
50-
$this->assetRegistry = $assetRegistry;
5144
}
5245

5346
public function renderWebpackScriptTags(ScriptTag $scriptTag): void
@@ -71,7 +64,7 @@ public function renderWebpackScriptTags(ScriptTag $scriptTag): void
7164
// To do this, it's split up into two parts. The first part wraps the first file
7265
// and the second part wraps the last file.
7366
$splitChar = ! empty($parameters['splitChar']) ? $parameters['splitChar'] : '|';
74-
$wrapArr = explode($splitChar, $parameters['allWrap'], 2);
67+
$wrapArr = explode($splitChar, (string) $parameters['allWrap'], 2);
7568
$wrapFirst = $wrapArr[0] . $splitChar;
7669
$wrapLast = $splitChar . $wrapArr[1];
7770
unset($parameters['allWrap']);
@@ -93,7 +86,7 @@ public function renderWebpackScriptTags(ScriptTag $scriptTag): void
9386
}
9487

9588
$attributes = array_replace([
96-
'file' => $this->removeLeadingSlash($file, $parameters) ? ltrim($file, '/') : $file,
89+
'file' => $this->removeLeadingSlash($file, $parameters) ? ltrim((string) $file, '/') : $file,
9790
'type' => $this->removeType($parameters) ? '' : 'text/javascript',
9891
'compress' => false,
9992
'forceOnTop' => false,
@@ -112,7 +105,7 @@ public function renderWebpackScriptTags(ScriptTag $scriptTag): void
112105

113106
if ($scriptTag->isLibrary()) {
114107
$pageRendererMethodName .= 'Library';
115-
$filename = basename($file);
108+
$filename = basename((string) $file);
116109
$pageRenderer->{$pageRendererMethodName}($filename, ...$attributes);
117110
} else {
118111
$pageRendererMethodName .= 'File';
@@ -146,7 +139,7 @@ public function renderWebpackLinkTags(LinkTag $linkTag): void
146139
// To do this, it's split up into two parts. The first part wraps the first file
147140
// and the second part wraps the last file.
148141
$splitChar = ! empty($parameters['splitChar']) ? $parameters['splitChar'] : '|';
149-
$wrapArr = explode($splitChar, $parameters['allWrap'], 2);
142+
$wrapArr = explode($splitChar, (string) $parameters['allWrap'], 2);
150143
$wrapFirst = $wrapArr[0] . $splitChar;
151144
$wrapLast = $splitChar . $wrapArr[1];
152145
unset($parameters['allWrap']);
@@ -165,7 +158,7 @@ public function renderWebpackLinkTags(LinkTag $linkTag): void
165158
}
166159

167160
$attributes = array_replace([
168-
'file' => $this->removeLeadingSlash($file, $parameters) ? ltrim($file, '/') : $file,
161+
'file' => $this->removeLeadingSlash($file, $parameters) ? ltrim((string) $file, '/') : $file,
169162
'rel' => 'stylesheet',
170163
'media' => $linkTag->getMedia(),
171164
'title' => '',

Classes/Form/FormDataProvider/RichtextEncoreConfiguration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
final class RichtextEncoreConfiguration implements FormDataProviderInterface
2121
{
22-
private EntrypointLookupCollectionInterface $entrypointLookupCollection;
22+
private readonly EntrypointLookupCollectionInterface $entrypointLookupCollection;
2323

2424
public function __construct(EntrypointLookupCollectionInterface $entrypointLookupCollection = null)
2525
{

0 commit comments

Comments
 (0)