From d6f1e42ac497f07ad1c1b997867c0cbd8b53c802 Mon Sep 17 00:00:00 2001 From: Lukas Neugebauer <25110308+lneugebauer@users.noreply.github.com> Date: Fri, 15 May 2026 16:21:07 +0200 Subject: [PATCH 1/6] refactor: add php-cs-fixer and apply rules --- .gitignore | 4 ++++ .php-cs-fixer.dist.php | 28 ++++++++++++++++++++++++++++ Classes/Service/GeoService.php | 2 +- Classes/Service/RadiusService.php | 2 +- composer.json | 9 +++++++++ 5 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 .gitignore create mode 100644 .php-cs-fixer.dist.php diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7728bb7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.idea +vendor +public +.php-cs-fixer.cache \ No newline at end of file diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 0000000..4324ce9 --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,28 @@ +setRiskyAllowed(false) + ->setRules([ + '@auto' => true + ]) + // 💡 by default, Fixer looks for `*.php` files excluding `./vendor/` - here, you can groom this config + ->setFinder( + (new Finder()) + // 💡 root folder to check + ->in(__DIR__) + // 💡 additional files, eg bin entry file + // ->append([__DIR__.'/bin-entry-file']) + // 💡 folders to exclude, if any + // ->exclude([/* ... */]) + // 💡 path patterns to exclude, if any + // ->notPath([/* ... */]) + // 💡 extra configs + // ->ignoreDotFiles(false) // true by default in v3, false in v4 or future mode + // ->ignoreVCS(true) // true by default + ) +; diff --git a/Classes/Service/GeoService.php b/Classes/Service/GeoService.php index 70cbdc5..c266fb6 100644 --- a/Classes/Service/GeoService.php +++ b/Classes/Service/GeoService.php @@ -41,7 +41,7 @@ public function __construct( if (!empty($apiKey)) { $this->geocodingUrl .= '&key=' . $apiKey; } - $this->maxRetries = (int)($geoCodingConfig['maxRetries'] ?? 0); + $this->maxRetries = (int) ($geoCodingConfig['maxRetries'] ?? 0); } /** diff --git a/Classes/Service/RadiusService.php b/Classes/Service/RadiusService.php index 9463a43..3cd477f 100644 --- a/Classes/Service/RadiusService.php +++ b/Classes/Service/RadiusService.php @@ -66,7 +66,7 @@ public function findAllDatabaseRecordsInRadius( $fields = GeneralUtility::trimExplode(',', 'uid,' . $additionalFields, true); $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($tableName); - $distanceSqlCalc = 'ACOS(SIN(RADIANS(' . $queryBuilder->quoteIdentifier($latitudeField) . ')) * SIN(RADIANS(' . (float)$coordinates['latitude'] . ')) + COS(RADIANS(' . $queryBuilder->quoteIdentifier($latitudeField) . ')) * COS(RADIANS(' . (float)($coordinates['latitude'] ?? 0) . ')) * COS(RADIANS(' . $queryBuilder->quoteIdentifier($longitudeField) . ') - RADIANS(' . (float)($coordinates['longitude'] ?? 0) . '))) * ' . $this->earthRadius; + $distanceSqlCalc = 'ACOS(SIN(RADIANS(' . $queryBuilder->quoteIdentifier($latitudeField) . ')) * SIN(RADIANS(' . (float) $coordinates['latitude'] . ')) + COS(RADIANS(' . $queryBuilder->quoteIdentifier($latitudeField) . ')) * COS(RADIANS(' . (float) ($coordinates['latitude'] ?? 0) . ')) * COS(RADIANS(' . $queryBuilder->quoteIdentifier($longitudeField) . ') - RADIANS(' . (float) ($coordinates['longitude'] ?? 0) . '))) * ' . $this->earthRadius; return $queryBuilder ->select(...$fields) diff --git a/composer.json b/composer.json index 3d78126..543ee61 100644 --- a/composer.json +++ b/composer.json @@ -18,5 +18,14 @@ "psr-4": { "B13\\Geocoding\\": "Classes/" } + }, + "require-dev": { + "typo3/coding-standards": "^0.8.0" + }, + "config": { + "allow-plugins": { + "typo3/cms-composer-installers": true, + "typo3/class-alias-loader": true + } } } From 6de83172494eed92fa51e72af5771a9321ec8b7e Mon Sep 17 00:00:00 2001 From: Lukas Neugebauer <25110308+lneugebauer@users.noreply.github.com> Date: Mon, 18 May 2026 17:20:35 +0200 Subject: [PATCH 2/6] refactor: add rector and apply rules --- Classes/Service/GeoService.php | 23 ++++++------- composer.json | 3 +- ext_emconf.php | 9 ++--- ext_localconf.php | 11 +++++-- rector.php | 60 ++++++++++++++++++++++++++++++++++ 5 files changed, 83 insertions(+), 23 deletions(-) create mode 100644 rector.php diff --git a/Classes/Service/GeoService.php b/Classes/Service/GeoService.php index c266fb6..61f761e 100644 --- a/Classes/Service/GeoService.php +++ b/Classes/Service/GeoService.php @@ -9,7 +9,7 @@ * the terms of the GNU General Public License, either version 2 * of the License, or any later version. */ - +use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface; use TYPO3\CMS\Core\Configuration\ExtensionConfiguration; use TYPO3\CMS\Core\Database\ConnectionPool; @@ -33,7 +33,8 @@ class GeoService implements SingletonInterface public function __construct( protected readonly FrontendInterface $cache, protected readonly ExtensionConfiguration $extensionConfiguration, - protected readonly RequestFactory $requestFactory + protected readonly RequestFactory $requestFactory, + private readonly ConnectionPool $connectionPool ) { $geoCodingConfig = $extensionConfiguration->get('geocoding'); // load from extension configuration @@ -68,7 +69,7 @@ public function getCoordinatesForAddress(?string $street = null, ?string $zip = } $address = ltrim(implode(',', $addressParts), ','); - if (empty($address)) { + if ($address === '' || $address === '0') { return []; } @@ -115,7 +116,7 @@ public function calculateCoordinatesForAllRecordsInTable( string $addWhereClause = '' ): int { // Fetch all records without latitude/longitude - $connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable($tableName); + $connection = $this->connectionPool->getConnectionForTable($tableName); $queryBuilder = $connection->createQueryBuilder(); $queryBuilder->getRestrictions() ->removeAll() @@ -126,16 +127,16 @@ public function calculateCoordinatesForAllRecordsInTable( ->where( $queryBuilder->expr()->orX( $queryBuilder->expr()->isNull($latitudeField), - $queryBuilder->expr()->eq($latitudeField, $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT)), + $queryBuilder->expr()->eq($latitudeField, $queryBuilder->createNamedParameter(0, Connection::PARAM_INT)), $queryBuilder->expr()->eq($latitudeField, 0.00000000000), $queryBuilder->expr()->isNull($longitudeField), - $queryBuilder->expr()->eq($longitudeField, $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT)), + $queryBuilder->expr()->eq($longitudeField, $queryBuilder->createNamedParameter(0, Connection::PARAM_INT)), $queryBuilder->expr()->eq($longitudeField, 0.00000000000) ) ) ->setMaxResults(500); - if (!empty($addWhereClause)) { + if ($addWhereClause !== '' && $addWhereClause !== '0') { $queryBuilder->andWhere(QueryHelper::stripLogicalOperatorPrefix($addWhereClause)); } @@ -147,18 +148,14 @@ public function calculateCoordinatesForAllRecordsInTable( if (($GLOBALS['TCA'][$tableName]['columns'][$countryField]['config']['type'] ?? '') === 'select') { foreach ($GLOBALS['TCA'][$tableName]['columns'][$countryField]['config']['items'] ?? [] as $itm) { if (($itm[1] ?? null) === $country) { - if (is_object($GLOBALS['TSFE'])) { - $country = $GLOBALS['TSFE']->sL($itm[0]); - } else { - $country = $GLOBALS['LANG']->sL($itm[0]); - } + $country = is_object($GLOBALS['TSFE']) ? $GLOBALS['TSFE']->sL($itm[0]) : $GLOBALS['LANG']->sL($itm[0]); } } } // do the geocoding if (!empty($record[$zipField]) || !empty($record[$cityField])) { $coords = $this->getCoordinatesForAddress($record[$streetField] ?? null, $record[$zipField] ?? null, $record[$cityField] ?? null, $country); - if ($coords) { + if ($coords !== []) { // Update the record to fill in the latitude and longitude values in the DB $connection->update( $tableName, diff --git a/composer.json b/composer.json index 543ee61..430f3dd 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,8 @@ } }, "require-dev": { - "typo3/coding-standards": "^0.8.0" + "typo3/coding-standards": "^0.8.0", + "ssch/typo3-rector": "^3.14" }, "config": { "allow-plugins": { diff --git a/ext_emconf.php b/ext_emconf.php index 37500ad..cb05e12 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -1,5 +1,7 @@ 'Service: Geocoding via Google Maps', 'description' => 'Provides services for google maps GeoCoding API and radius search on the database.', @@ -7,16 +9,11 @@ 'author' => 'Benjamin Mack', 'author_email' => 'benjamin.mack@b13.com', 'author_company' => 'b13 GmbH', - 'shy' => '', 'state' => 'stable', - 'uploadfolder' => 0, - 'createDirs' => '', - 'clearCacheOnLoad' => 0, - 'lockType' => '', 'version' => '5.0.0', 'constraints' => [ 'depends' => [ - 'typo3' => '11.5.0-12.4.99', + 'typo3' => '13.4.0-14.3.99', ], 'conflicts' => [ ], diff --git a/ext_localconf.php b/ext_localconf.php index 02fad65..1e51acd 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -1,11 +1,16 @@ \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::class, - 'backend' => \TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class, + 'frontend' => VariableFrontend::class, + 'backend' => Typo3DatabaseBackend::class, ]; } diff --git a/rector.php b/rector.php new file mode 100644 index 0000000..e3e137e --- /dev/null +++ b/rector.php @@ -0,0 +1,60 @@ +withPaths([ + __DIR__ . '/Classes', + __DIR__ . '/ext_emconf.php', + __DIR__ . '/ext_localconf.php', + ]) + // uncomment to reach your current PHP version + // ->withPhpSets() + ->withPhpVersion(PhpVersion::PHP_85) + ->withSets([ + // Rector rules + SetList::CODE_QUALITY, + LevelSetList::UP_TO_PHP_85, + + Typo3SetList::CODE_QUALITY, + Typo3SetList::GENERAL, + Typo3LevelSetList::UP_TO_TYPO3_14, + // To migrate to Doctrine Dbal 4, uncomment the following line + //\Rector\Doctrine\Set\DoctrineSetList::DOCTRINE_DBAL_40, + ]) + // To have a better analysis from PHPStan, we teach it here some more things + ->withPHPStanConfigs([Typo3Option::PHPSTAN_FOR_RECTOR_PATH]) + ->withImportNames(true, true, false, true) + ->withRules([ + AddVoidReturnTypeWhereNoReturnRector::class, + ]) + ->withConfiguredRule(ExtEmConfRector::class, [ + ExtEmConfRector::PHP_VERSION_CONSTRAINT => '8.2.0-8.5.99', + ExtEmConfRector::TYPO3_VERSION_CONSTRAINT => '13.4.0-14.3.99', + ExtEmConfRector::ADDITIONAL_VALUES_TO_BE_REMOVED => [], + ]) + ->withConfiguredRule( + RemoveTypo3VersionChecksRector::class, + [RemoveTypo3VersionChecksRector::TARGET_VERSION => 14] + ) + ->withSkip([ + // @see https://github.com/sabbelasichon/typo3-rector/issues/2536 + __DIR__ . '/**/Configuration/ExtensionBuilder/*', + NameImportingPostRector::class => [ + 'ClassAliasMap.php', + ], + ]) +; From a6e88c4cc81bcb2777f1f3f159d8b8d6d87b6273 Mon Sep 17 00:00:00 2001 From: Lukas Neugebauer <25110308+lneugebauer@users.noreply.github.com> Date: Mon, 18 May 2026 17:44:28 +0200 Subject: [PATCH 3/6] ci: add phpstan and apply fixes --- .github/workflows/ci.yml | 39 ++++++++++++++++++++++++++++++++++ Classes/Service/GeoService.php | 2 +- composer.json | 7 +++--- phpstan.neon | 8 +++++++ 4 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 phpstan.neon diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..502e632 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,39 @@ +name: CI + +on: + push: + pull_request: + +jobs: + static-analysis: + name: "PHPStan / PHP ${{ matrix.php }} / TYPO3 ${{ matrix.typo3 }}" + runs-on: ubuntu-latest + + strategy: + matrix: + include: + - php: "8.2" + typo3: "^13.4" + - php: "8.5" + typo3: "^14.3" + + steps: + - uses: actions/checkout@v4 + + - name: Set up PHP ${{ matrix.php }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + tools: composer + + - name: Require TYPO3 version + run: composer require typo3/cms-core "${{ matrix.typo3 }}" --no-update + + - name: Install dependencies + run: composer install --prefer-dist --no-progress --no-plugins + + - name: Validate composer.json + run: composer validate --strict + + - name: Run PHPStan + run: vendor/bin/phpstan analyse --no-progress \ No newline at end of file diff --git a/Classes/Service/GeoService.php b/Classes/Service/GeoService.php index 61f761e..83e9f37 100644 --- a/Classes/Service/GeoService.php +++ b/Classes/Service/GeoService.php @@ -125,7 +125,7 @@ public function calculateCoordinatesForAllRecordsInTable( ->select('*') ->from($tableName) ->where( - $queryBuilder->expr()->orX( + $queryBuilder->expr()->or( $queryBuilder->expr()->isNull($latitudeField), $queryBuilder->expr()->eq($latitudeField, $queryBuilder->createNamedParameter(0, Connection::PARAM_INT)), $queryBuilder->expr()->eq($latitudeField, 0.00000000000), diff --git a/composer.json b/composer.json index 430f3dd..d8948a8 100644 --- a/composer.json +++ b/composer.json @@ -6,8 +6,8 @@ "license": "GPL-2.0-or-later", "keywords": ["TYPO3 CMS", "TYPO3", "Google Geocoding"], "require": { - "php": "^8.1", - "typo3/cms-core": "^11.5 || ^12.4" + "php": "^8.2", + "typo3/cms-core": "^13.4 || ^14.3" }, "extra": { "typo3/cms": { @@ -21,7 +21,8 @@ }, "require-dev": { "typo3/coding-standards": "^0.8.0", - "ssch/typo3-rector": "^3.14" + "ssch/typo3-rector": "^3.14", + "saschaegerer/phpstan-typo3": "^2.0 || ^3.0" }, "config": { "allow-plugins": { diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..9d65d84 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,8 @@ +includes: + - vendor/saschaegerer/phpstan-typo3/extension.neon + +parameters: + level: 5 + paths: + - Classes + treatPhpDocTypesAsCertain: false \ No newline at end of file From 9503a4f5e4a0523b54125cfca676cec908ef433d Mon Sep 17 00:00:00 2001 From: Lukas Neugebauer <25110308+lneugebauer@users.noreply.github.com> Date: Tue, 19 May 2026 09:33:30 +0200 Subject: [PATCH 4/6] build: remove rector artifacts --- composer.json | 1 - rector.php | 60 --------------------------------------------------- 2 files changed, 61 deletions(-) delete mode 100644 rector.php diff --git a/composer.json b/composer.json index d8948a8..979fa74 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,6 @@ }, "require-dev": { "typo3/coding-standards": "^0.8.0", - "ssch/typo3-rector": "^3.14", "saschaegerer/phpstan-typo3": "^2.0 || ^3.0" }, "config": { diff --git a/rector.php b/rector.php deleted file mode 100644 index e3e137e..0000000 --- a/rector.php +++ /dev/null @@ -1,60 +0,0 @@ -withPaths([ - __DIR__ . '/Classes', - __DIR__ . '/ext_emconf.php', - __DIR__ . '/ext_localconf.php', - ]) - // uncomment to reach your current PHP version - // ->withPhpSets() - ->withPhpVersion(PhpVersion::PHP_85) - ->withSets([ - // Rector rules - SetList::CODE_QUALITY, - LevelSetList::UP_TO_PHP_85, - - Typo3SetList::CODE_QUALITY, - Typo3SetList::GENERAL, - Typo3LevelSetList::UP_TO_TYPO3_14, - // To migrate to Doctrine Dbal 4, uncomment the following line - //\Rector\Doctrine\Set\DoctrineSetList::DOCTRINE_DBAL_40, - ]) - // To have a better analysis from PHPStan, we teach it here some more things - ->withPHPStanConfigs([Typo3Option::PHPSTAN_FOR_RECTOR_PATH]) - ->withImportNames(true, true, false, true) - ->withRules([ - AddVoidReturnTypeWhereNoReturnRector::class, - ]) - ->withConfiguredRule(ExtEmConfRector::class, [ - ExtEmConfRector::PHP_VERSION_CONSTRAINT => '8.2.0-8.5.99', - ExtEmConfRector::TYPO3_VERSION_CONSTRAINT => '13.4.0-14.3.99', - ExtEmConfRector::ADDITIONAL_VALUES_TO_BE_REMOVED => [], - ]) - ->withConfiguredRule( - RemoveTypo3VersionChecksRector::class, - [RemoveTypo3VersionChecksRector::TARGET_VERSION => 14] - ) - ->withSkip([ - // @see https://github.com/sabbelasichon/typo3-rector/issues/2536 - __DIR__ . '/**/Configuration/ExtensionBuilder/*', - NameImportingPostRector::class => [ - 'ClassAliasMap.php', - ], - ]) -; From 26357ea928e172ced6cac42864b0e187e937bf17 Mon Sep 17 00:00:00 2001 From: Lukas Neugebauer <25110308+lneugebauer@users.noreply.github.com> Date: Tue, 19 May 2026 09:34:51 +0200 Subject: [PATCH 5/6] build: bump version --- ext_emconf.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext_emconf.php b/ext_emconf.php index cb05e12..d6e8a61 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -10,7 +10,7 @@ 'author_email' => 'benjamin.mack@b13.com', 'author_company' => 'b13 GmbH', 'state' => 'stable', - 'version' => '5.0.0', + 'version' => '6.0.0', 'constraints' => [ 'depends' => [ 'typo3' => '13.4.0-14.3.99', From 388d59066576b12038dc0517025a0659cb9d420b Mon Sep 17 00:00:00 2001 From: Lukas Neugebauer <25110308+lneugebauer@users.noreply.github.com> Date: Tue, 19 May 2026 09:41:32 +0200 Subject: [PATCH 6/6] refactor: rerun php-cs-fixer with typo3 config --- .editorconfig | 69 +++++++++++++++++++++++++++++++ .php-cs-fixer.dist.php | 30 +++----------- Classes/Service/GeoService.php | 4 +- Classes/Service/RadiusService.php | 2 +- ext_localconf.php | 2 +- 5 files changed, 78 insertions(+), 29 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..4229670 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,69 @@ +# EditorConfig is awesome: http://EditorConfig.org + +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +charset = utf-8 +end_of_line = lf +indent_style = space +indent_size = 4 +insert_final_newline = true +trim_trailing_whitespace = true + +# TS/JS-Files +[*.{ts,js}] +indent_size = 2 + +# JSON-Files +[*.json] +indent_style = tab + +# ReST-Files +[*.{rst,rst.txt}] +indent_size = 4 +max_line_length = 80 + +# Markdown-Files +[*.md] +max_line_length = 80 + +# YAML-Files +[*.{yaml,yml}] +indent_size = 2 + +# NEON-Files +[*.neon] +indent_size = 2 +indent_style = tab + +#.eslintrc.json +[.eslintrc.json] +indent_size = 2 +indent_style = space + +# stylelint +[.stylelintrc] +indent_size = 2 + +# package.json +[package.json] +indent_size = 2 + +# TypoScript +[*.{typoscript,tsconfig}] +indent_size = 2 + +# XLF-Files +[*.xlf] +indent_style = tab + +# SQL-Files +[*.sql] +indent_style = tab +indent_size = 2 + +# .htaccess +[{_.htaccess,.htaccess}] +indent_style = tab diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 4324ce9..ebb9c20 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -1,28 +1,8 @@ setRiskyAllowed(false) - ->setRules([ - '@auto' => true - ]) - // 💡 by default, Fixer looks for `*.php` files excluding `./vendor/` - here, you can groom this config - ->setFinder( - (new Finder()) - // 💡 root folder to check - ->in(__DIR__) - // 💡 additional files, eg bin entry file - // ->append([__DIR__.'/bin-entry-file']) - // 💡 folders to exclude, if any - // ->exclude([/* ... */]) - // 💡 path patterns to exclude, if any - // ->notPath([/* ... */]) - // 💡 extra configs - // ->ignoreDotFiles(false) // true by default in v3, false in v4 or future mode - // ->ignoreVCS(true) // true by default - ) +$config = \TYPO3\CodingStandards\CsFixerConfig::create(); +$config->getFinder() + ->in(__DIR__) ; + +return $config; diff --git a/Classes/Service/GeoService.php b/Classes/Service/GeoService.php index 83e9f37..8f6b813 100644 --- a/Classes/Service/GeoService.php +++ b/Classes/Service/GeoService.php @@ -9,9 +9,9 @@ * the terms of the GNU General Public License, either version 2 * of the License, or any later version. */ -use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface; use TYPO3\CMS\Core\Configuration\ExtensionConfiguration; +use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Database\Query\QueryHelper; use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction; @@ -42,7 +42,7 @@ public function __construct( if (!empty($apiKey)) { $this->geocodingUrl .= '&key=' . $apiKey; } - $this->maxRetries = (int) ($geoCodingConfig['maxRetries'] ?? 0); + $this->maxRetries = (int)($geoCodingConfig['maxRetries'] ?? 0); } /** diff --git a/Classes/Service/RadiusService.php b/Classes/Service/RadiusService.php index 3cd477f..9463a43 100644 --- a/Classes/Service/RadiusService.php +++ b/Classes/Service/RadiusService.php @@ -66,7 +66,7 @@ public function findAllDatabaseRecordsInRadius( $fields = GeneralUtility::trimExplode(',', 'uid,' . $additionalFields, true); $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($tableName); - $distanceSqlCalc = 'ACOS(SIN(RADIANS(' . $queryBuilder->quoteIdentifier($latitudeField) . ')) * SIN(RADIANS(' . (float) $coordinates['latitude'] . ')) + COS(RADIANS(' . $queryBuilder->quoteIdentifier($latitudeField) . ')) * COS(RADIANS(' . (float) ($coordinates['latitude'] ?? 0) . ')) * COS(RADIANS(' . $queryBuilder->quoteIdentifier($longitudeField) . ') - RADIANS(' . (float) ($coordinates['longitude'] ?? 0) . '))) * ' . $this->earthRadius; + $distanceSqlCalc = 'ACOS(SIN(RADIANS(' . $queryBuilder->quoteIdentifier($latitudeField) . ')) * SIN(RADIANS(' . (float)$coordinates['latitude'] . ')) + COS(RADIANS(' . $queryBuilder->quoteIdentifier($latitudeField) . ')) * COS(RADIANS(' . (float)($coordinates['latitude'] ?? 0) . ')) * COS(RADIANS(' . $queryBuilder->quoteIdentifier($longitudeField) . ') - RADIANS(' . (float)($coordinates['longitude'] ?? 0) . '))) * ' . $this->earthRadius; return $queryBuilder ->select(...$fields) diff --git a/ext_localconf.php b/ext_localconf.php index 1e51acd..07a0c26 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -2,8 +2,8 @@ declare(strict_types=1); -use TYPO3\CMS\Core\Cache\Frontend\VariableFrontend; use TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend; +use TYPO3\CMS\Core\Cache\Frontend\VariableFrontend; defined('TYPO3') || die();