From 74c8cbe80e833c43fa022e8af343ee837b60b11b Mon Sep 17 00:00:00 2001 From: Dmitry Dulepov Date: Thu, 21 Mar 2024 16:43:12 +0300 Subject: [PATCH 1/7] [UPDATE] Fix #106: allow installation on TYPO3 v13 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f3fb07b..cdec7f4 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "issues": "https://github.com/sitegeist/sms-responsive-images/issues" }, "require": { - "typo3/cms-core": "^12.2 || ^11.5 || ^10.4" + "typo3/cms-core": "^13.1 || ^12.2 || ^11.5 || ^10.4" }, "require-dev": { "typo3/testing-framework": "^7.0 || ^6.0 || dev-main", From a43d3235fff7ac1a053f1318675b3413249553aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albrecht=20K=C3=B6hnlein?= Date: Wed, 27 Nov 2024 09:14:07 +0100 Subject: [PATCH 2/7] [TASK] Allow version 13 in ext_emconf.php --- ext_emconf.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext_emconf.php b/ext_emconf.php index 9b5a30f..2669f6b 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -12,7 +12,7 @@ 'version' => '3.0.0', 'constraints' => [ 'depends' => [ - 'typo3' => '10.4.0-12.9.99', + 'typo3' => '10.4.0-13.9.99', ], 'conflicts' => [ ], From a8a4cb198f3d2fa4d02352c58f8ba9f8bb204de7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albrecht=20K=C3=B6hnlein?= Date: Wed, 27 Nov 2024 09:24:05 +0100 Subject: [PATCH 3/7] [TASK] Add TYPO3 13 with PHP 8.2., 8.3 and 8.4 to testing matrix --- .github/workflows/tests.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index dd2e2c2..ee112fc 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -50,6 +50,12 @@ jobs: typo3-versions: 11 - php-versions: 7.4 typo3-versions: 10 + - php-versions: 8.2 + typo3-versions: 13 + - php-versions: 8.3 + typo3-versions: 13 + - php-versions: 8.4 + typo3-versions: 13 name: Unit Testing (PHP ${{ matrix.php-versions }}, TYPO3 ${{ matrix.typo3-versions }}) steps: From cc8854f70da9ca082f788201a5b60e5dfebf7611 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albrecht=20K=C3=B6hnlein?= Date: Wed, 27 Nov 2024 17:34:56 +0100 Subject: [PATCH 4/7] [TASK] Add TYPO3 13 with PHP 8.2., 8.3 and 8.4 to functional testing matrix --- .github/workflows/tests.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ee112fc..1a75421 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -93,6 +93,13 @@ jobs: matrix: php-versions: [8.2, 8.1] typo3-versions: [12] + include: + - php-versions: 8.2 + typo3-versions: 13 + - php-versions: 8.3 + typo3-versions: 13 + - php-versions: 8.4 + typo3-versions: 13 name: Functional Testing (PHP ${{ matrix.php-versions }}, TYPO3 ${{ matrix.typo3-versions }}) steps: From 8423ec5a6d68ed7fbc72ba71c0d1e23cee9f8efb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albrecht=20K=C3=B6hnlein?= Date: Wed, 27 Nov 2024 20:04:25 +0100 Subject: [PATCH 5/7] [BUGFIX] Solve PHP 8 warnings --- Classes/ViewHelpers/MediaViewHelper.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Classes/ViewHelpers/MediaViewHelper.php b/Classes/ViewHelpers/MediaViewHelper.php index 4e390ed..8ccfcab 100644 --- a/Classes/ViewHelpers/MediaViewHelper.php +++ b/Classes/ViewHelpers/MediaViewHelper.php @@ -89,9 +89,9 @@ public function initializeArguments(): void public function render(): string { $file = $this->arguments['file']; - $additionalConfig = (array)$this->arguments['additionalConfig']; - $width = $this->arguments['width']; - $height = $this->arguments['height']; + $additionalConfig = (array)($this->arguments['additionalConfig'] ?? []); + $width = $this->arguments['width'] ?? ''; + $height = $this->arguments['height'] ?? ''; // get Resource Object (non ExtBase version) if (is_callable([$file, 'getOriginalResource'])) { From 671556a5a1cd8877f55af348b27eb5345e29684f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albrecht=20K=C3=B6hnlein?= Date: Wed, 27 Nov 2024 20:12:49 +0100 Subject: [PATCH 6/7] [TASK] Make functional test compatible with TYPO3 13 --- Tests/Functional/ImageViewHelperTest.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Tests/Functional/ImageViewHelperTest.php b/Tests/Functional/ImageViewHelperTest.php index a06d59f..a5ae7b4 100644 --- a/Tests/Functional/ImageViewHelperTest.php +++ b/Tests/Functional/ImageViewHelperTest.php @@ -78,11 +78,12 @@ public static function basicScalingCroppingDataProvider(): \Generator 150 ]; // would be 200x150, but image will be stretched (why!?) up to have a width of 250 + // @todo remove multiple possible heights when dropping support for versions before TYPO3 13 yield 'min width' => [ '', - '@^$@', + '@^$@', 250, - 150 + [188, 150] ]; // would be 200x150, but image will be scaled down to have a width of 100 yield 'max width' => [ @@ -92,9 +93,11 @@ public static function basicScalingCroppingDataProvider(): \Generator 75 ]; // would be 200x150, but image will be stretched (why!?) up to have a height of 200 + // @todo remove multiple possible widths when dropping support for versions before TYPO3 13 yield 'min height' => [ '', - '@^$@', + '@^$@', + [267, 200], 200, 200 ]; @@ -108,10 +111,14 @@ public static function basicScalingCroppingDataProvider(): \Generator } /** + * @TODO convert parameters to `int` only when dropping support for versions before TYPO3 13 + * @param int|int[] $expectedWidth + * @param int|int[] $expectedHeight + * * @test * @dataProvider basicScalingCroppingDataProvider */ - public function basicScalingCropping(string $template, string $expected, int $expectedWidth, int $expectedHeight): void + public function basicScalingCropping(string $template, string $expected, $expectedWidth, $expectedHeight): void { $view = GeneralUtility::makeInstance(StandaloneView::class); $view->setTemplateSource('instancePath . '/' . $matches[1]); - self::assertEquals($expectedWidth, $width, 'width of generated image does not match expected width'); - self::assertEquals($expectedHeight, $height, 'height of generated image does not match expected height'); + self::assertContains($width, is_array($expectedWidth) ? $expectedWidth : [$expectedWidth], 'width of generated image does not match expected width'); + self::assertContains($height, is_array($expectedHeight) ? $expectedHeight : [$expectedHeight], 'height of generated image does not match expected height'); } public static function cropVariantCollectionDataProvider(): \Generator From 431ee27a93073b0586d53edd4078d8265d6288dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albrecht=20K=C3=B6hnlein?= Date: Mon, 20 Jan 2025 15:11:50 +0100 Subject: [PATCH 7/7] [TASK] Define explicit nullable types for compatibility with PHP 8.4 --- Classes/Utility/ResponsiveImagesUtility.php | 28 ++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Classes/Utility/ResponsiveImagesUtility.php b/Classes/Utility/ResponsiveImagesUtility.php index d0757a2..f4ad6c6 100644 --- a/Classes/Utility/ResponsiveImagesUtility.php +++ b/Classes/Utility/ResponsiveImagesUtility.php @@ -63,10 +63,10 @@ public function createImageTagWithSrcset( FileInterface $originalImage, FileInterface $fallbackImage, $srcset, - Area $cropArea = null, - Area $focusArea = null, - string $sizesQuery = null, - TagBuilder $tag = null, + ?Area $cropArea = null, + ?Area $focusArea = null, + ?string $sizesQuery = null, + ?TagBuilder $tag = null, bool $absoluteUri = false, bool $lazyload = false, $ignoreFileExtensions = 'svg, gif', @@ -177,9 +177,9 @@ public function createPictureTag( FileInterface $fallbackImage, array $breakpoints, CropVariantCollection $cropVariantCollection, - Area $focusArea = null, - TagBuilder $tag = null, - TagBuilder $fallbackTag = null, + ?Area $focusArea = null, + ?TagBuilder $tag = null, + ?TagBuilder $fallbackTag = null, bool $absoluteUri = false, bool $lazyload = false, $ignoreFileExtensions = 'svg, gif', @@ -288,7 +288,7 @@ public function createPictureSourceTag( $srcset, string $mediaQuery = '', string $sizesQuery = '', - Area $cropArea = null, + ?Area $cropArea = null, bool $absoluteUri = false, bool $lazyload = false, ?string $fileExtension = null @@ -338,9 +338,9 @@ public function createPictureSourceTag( */ public function createSimpleImageTag( FileInterface $originalImage, - FileInterface $fallbackImage = null, - TagBuilder $tag = null, - Area $focusArea = null, + ?FileInterface $fallbackImage = null, + ?TagBuilder $tag = null, + ?Area $focusArea = null, bool $absoluteUri = false, bool $lazyload = false, int $placeholderSize = 0, @@ -406,7 +406,7 @@ public function addMetadataToImageTag( TagBuilder $tag, FileInterface $originalImage, FileInterface $fallbackImage, - Area $focusArea = null + ?Area $focusArea = null ) { $focusArea = $focusArea ?: Area::createEmpty(); @@ -451,7 +451,7 @@ public function generateSrcsetImages( FileInterface $image, int $defaultWidth, $srcset, - Area $cropArea = null, + ?Area $cropArea = null, bool $absoluteUri = false, ?string $fileExtension = null ): array { @@ -519,7 +519,7 @@ public function generateSrcsetImages( public function generatePlaceholderImage( FileInterface $image, int $width = 20, - Area $cropArea = null, + ?Area $cropArea = null, bool $inline = false, bool $absoluteUri = false, ?string $fileExtension = null