Skip to content

Commit 52cf618

Browse files
authored
Merge pull request #23 from mmunz/development
v1.1.0
2 parents cf6c540 + 7fcc017 commit 52cf618

Some content is hidden

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

47 files changed

+319
-562
lines changed

.github/workflows/ci.yml

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ on: [push, pull_request]
44

55
jobs:
66
lint:
7-
runs-on: ubuntu-22.04
7+
runs-on: ubuntu-24.04
88
name: Linting
99
steps:
10-
- uses: actions/checkout@v3
10+
- uses: actions/checkout@v4
1111
- name: Set up PHP Version
1212
uses: shivammathur/setup-php@v2
1313
with:
14-
php-version: 8.1
14+
php-version: 8.2
1515
coverage: none
1616
tools: composer:v2
1717
- name: Cache dependencies
18-
uses: actions/cache@v3
18+
uses: actions/cache@v4
1919
with:
2020
path: ~/.composer/cache
2121
key: dependencies-composer-${{ runner.os }}-${{ hashFiles('composer.json') }}
@@ -24,7 +24,7 @@ jobs:
2424
- name: Install composer dependencies
2525
run: |
2626
rm -f composer.lock
27-
composer require typo3/minimal:^11.0
27+
composer require typo3/minimal:^12.4
2828
- name: phpstan
2929
run: composer phpstan
3030
- name: PHPCS
@@ -33,27 +33,31 @@ jobs:
3333
run: composer ts:lint
3434

3535
build_doc:
36-
runs-on: ubuntu-20.04
36+
runs-on: ubuntu-24.04
3737
name: Build documentation
3838
steps:
39-
- uses: actions/checkout@v3
39+
- uses: actions/checkout@v4
4040
- name: Build doc
4141
run: composer build:doc
4242

4343
tests:
44-
runs-on: ubuntu-22.04
44+
runs-on: ubuntu-24.04
4545
strategy:
4646
fail-fast: false
4747
matrix:
4848
env:
49-
- { php: 8.2, TYPO3_VERSION: ^12.0 }
50-
- { php: 8.1, TYPO3_VERSION: ^12.0 }
51-
- { php: 8.1, TYPO3_VERSION: ^11.0 }
52-
- { php: 8.0, TYPO3_VERSION: ^11.0 }
53-
- { php: 7.4, TYPO3_VERSION: ^11.0 }
49+
- { php: 8.4, TYPO3_VERSION: ^13.4 }
50+
- { php: 8.3, TYPO3_VERSION: ^13.4 }
51+
- { php: 8.2, TYPO3_VERSION: ^13.4 }
52+
- { php: 8.4, TYPO3_VERSION: ^12.4 }
53+
- { php: 8.3, TYPO3_VERSION: ^12.4 }
54+
- { php: 8.2, TYPO3_VERSION: ^12.4 }
55+
- { php: 8.1, TYPO3_VERSION: ^12.4 }
5456
name: Tests on TYPO3 ${{ matrix.env.TYPO3_VERSION }} / PHP${{ matrix.env.php }}
5557
steps:
56-
- uses: actions/checkout@v3
58+
- uses: actions/checkout@v4
59+
- name: Install ImageMagick
60+
run: sudo apt-get update && sudo apt-get install -y imagemagick
5761
- name: Set up PHP Version
5862
uses: shivammathur/setup-php@v2
5963
with:
@@ -62,7 +66,7 @@ jobs:
6266
tools: composer:v2
6367
coverage: none
6468
- name: Cache dependencies
65-
uses: actions/cache@v3
69+
uses: actions/cache@v4
6670
with:
6771
path: ~/.composer/cache
6872
key: dependencies-composer-${{ runner.os }}-${{ hashFiles('composer.json') }}
@@ -74,7 +78,7 @@ jobs:
7478
apt update && apt install -y wget sqlite3 && \
7579
wget "https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb" && \
7680
apt install -y ./google-chrome-stable_current_amd64.deb
77-
- uses: nanasess/setup-chromedriver@v1
81+
- uses: nanasess/setup-chromedriver@v2
7882
- name: Install composer dependencies
7983
run: |
8084
rm -f composer.lock
@@ -88,8 +92,8 @@ jobs:
8892
- name: Start chromedriver
8993
run: |
9094
export DISPLAY=:99
91-
sudo Xvfb -ac :99 -screen 0 1920x1080x24 > /dev/null 2>&1 &
92-
chromedriver --url-base=/wd/hub &
95+
sudo Xvfb -ac :99 -screen 0 2560x1440x24 > /dev/null 2>&1 &
96+
chromedriver --url-base=/wd/hub --port=9515 &
9397
sleep 10
9498
- name: Unit tests (TYPO3 ${{ matrix.env.TYPO3_VERSION }} with PHP${{ matrix.env.php }})
9599
run: |
@@ -110,7 +114,7 @@ jobs:
110114
composer tests:acceptance
111115
- name: Upload Codeception output
112116
if: failure()
113-
uses: actions/upload-artifact@v3
117+
uses: actions/upload-artifact@v4
114118
with:
115119
name: codeception-results
116120
path: Tests/Acceptance/_output/

.php-cs-fixer.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,3 @@
6666
'no_unneeded_control_parentheses' => true
6767
])
6868
->setFinder($finder);
69-

Classes/Service/SettingsService.php

Lines changed: 8 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -7,50 +7,20 @@
77
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
88
use TYPO3\CMS\Extbase\Reflection\ObjectAccess;
99

10-
/**
11-
* Class SettingsService
12-
*
13-
*/
1410
class SettingsService
1511
{
16-
/**
17-
* @var mixed
18-
*/
19-
protected $frameworkConfiguration = null;
12+
protected ?array $frameworkConfiguration = null;
13+
protected ?array $settings = null;
2014

21-
/**
22-
* @var mixed
23-
*/
24-
protected $settings = null;
25-
26-
/**
27-
* @var ConfigurationManagerInterface
28-
*/
29-
protected $configurationManager;
30-
31-
public function __construct(ConfigurationManager $configurationManager)
32-
{
33-
$this->configurationManager = $configurationManager;
15+
public function __construct(
16+
private readonly ConfigurationManager $configurationManager
17+
) {
3418
}
3519

36-
// /**
37-
// * Injects the Configuration Manager and loads the settings
38-
// *
39-
// * @param ConfigurationManagerInterface $configurationManager
40-
// * @return void
41-
// */
42-
// public function injectConfigurationManager(
43-
// ConfigurationManagerInterface $configurationManager
44-
// ) {
45-
// $this->configurationManager = $configurationManager;
46-
// }
47-
4820
/**
4921
* Returns the framework configuration.
50-
*
51-
* @return array
5222
*/
53-
public function getFrameworkConfiguration()
23+
public function getFrameworkConfiguration(): array
5424
{
5525
if ($this->frameworkConfiguration === null) {
5626
$this->frameworkConfiguration = $this->configurationManager->getConfiguration(
@@ -67,21 +37,16 @@ public function getFrameworkConfiguration()
6737
* "settings.foo" would return $this->frameworkConfiguration['settings']['foo'].
6838
*
6939
* If the path is invalid or no entry is found, false is returned.
70-
*
71-
* @param string $path
72-
* @return mixed
7340
*/
74-
public function getByPath($path)
41+
public function getByPath(string $path): mixed
7542
{
7643
return ObjectAccess::getPropertyPath($this->getFrameworkConfiguration(), $path);
7744
}
7845

7946
/**
8047
* Returns all TypoScript settings.
81-
*
82-
* @return array
8348
*/
84-
public function getSettings()
49+
public function getSettings(): array
8550
{
8651
if ($this->settings === null) {
8752
$this->settings = $this->getByPath('settings');

Classes/Utility/CropVariantUtility.php

Lines changed: 10 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,20 @@
66
use TYPO3\CMS\Core\Imaging\ImageManipulation\CropVariantCollection;
77
use TYPO3\CMS\Core\Resource\FileInterface;
88

9-
/**
10-
* Class CropVariantUtility
11-
*/
129
class CropVariantUtility
1310
{
14-
/**
15-
* @var CropVariantCollection $cropVariantCollection
16-
*/
17-
protected $cropVariantCollection;
18-
19-
/**
20-
* @var FileInterface $file
21-
*/
22-
protected $file;
11+
protected CropVariantCollection $cropVariantCollection;
12+
protected FileInterface $file;
2313

24-
/**
25-
* @var MathUtility
26-
*/
27-
protected $mathUtility;
28-
29-
public function __construct(MathUtility $mathUtility)
30-
{
31-
$this->mathUtility = $mathUtility;
14+
public function __construct(
15+
private readonly MathUtility $mathUtility
16+
) {
3217
}
3318

3419
/**
3520
* Create a CropVariantCollection from file reference.
36-
*
37-
* @param FileInterface $file
38-
* @return void
3921
*/
40-
public function setCropVariantCollection(FileInterface $file)
22+
public function setCropVariantCollection(FileInterface $file): void
4123
{
4224
$cropString = '';
4325
$this->file = $file;
@@ -49,32 +31,25 @@ public function setCropVariantCollection(FileInterface $file)
4931

5032
/**
5133
* Get property cropVariantCollection
52-
* @return CropVariantCollection
5334
*/
54-
public function getCropVariantCollection()
35+
public function getCropVariantCollection(): CropVariantCollection
5536
{
5637
return $this->cropVariantCollection;
5738
}
5839

5940
/**
6041
* Returns a calculated Area with coordinates for cropping the actual image
61-
*
62-
* @param string $key
63-
* @return null|Area
6442
*/
65-
public function getCropAreaForVariant(string $key)
43+
public function getCropAreaForVariant(string $key): ?Area
6644
{
6745
$cropArea = $this->cropVariantCollection->getCropArea($key);
6846
return $cropArea->isEmpty() ? null : $cropArea->makeAbsoluteBasedOnFile($this->file);
6947
}
7048

7149
/**
7250
* Returns a calculated array with coordinates for cropping the actual image
73-
*
74-
* @param string $key
75-
* @return null|array
7651
*/
77-
public function getCropAreaForVariantAsArray(string $key)
52+
public function getCropAreaForVariantAsArray(string $key): ?array
7853
{
7954
$area = $this->getCropAreaForVariant($key);
8055
if (!is_null($area)) {
@@ -85,10 +60,8 @@ public function getCropAreaForVariantAsArray(string $key)
8560

8661
/**
8762
* Return a CropVariants array (beware: not related to TYPO3's CropVariants, needs a better naming - ToDo)
88-
* @param array $mediaQueries
89-
* @return array
9063
*/
91-
public function getCropVariants(array $mediaQueries)
64+
public function getCropVariants(array $mediaQueries): array
9265
{
9366
$cropVariants = [];
9467

Classes/Utility/DebugUtility.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,12 @@
22
declare(strict_types=1);
33
namespace C1\AdaptiveImages\Utility;
44

5-
/**
6-
* Class DebugUtility
7-
*/
85
class DebugUtility
96
{
107
/**
118
* returns a string with debug information for additionalParameters of a processing configuration
12-
* @param int $height
13-
* @param int $width
14-
* @param int|float $ratio
15-
* @param string $processor
16-
* @return string
179
*/
18-
public function getDebugAnnotation($width, $height, $ratio, $processor = null)
10+
public function getDebugAnnotation(int|string $width, int|string $height, float|int $ratio, ?string $processor = null): string
1911
{
2012
if (!$processor) {
2113
$processor = $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor'] ?? null;

0 commit comments

Comments
 (0)