From f216ae44466ef11e6a5a88440862ab7fee7d4d76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georg=20Gro=C3=9Fberger?= Date: Fri, 15 Dec 2023 14:40:02 +0100 Subject: [PATCH] [TASK] Update code style definition and apply fixers --- .php-cs-fixer.php | 126 +++++++++++++++--- Classes/CSP/SupiPolicyExtender.php | 12 +- Classes/DataProcessing/AddressProcessor.php | 2 +- Classes/DataProcessing/SpotifyProcessor.php | 1 + Classes/DataProcessing/YoutubeProcessor.php | 2 +- Configuration/Icons.php | 5 +- .../TCA/Overrides/sys_file_reference.php | 12 +- Configuration/TCA/Overrides/tt_content.php | 59 ++++---- Makefile | 2 +- .../ContentObject/SupiJsContentObjectTest.php | 4 +- Tests/DataProcessing/AddressProcessorTest.php | 5 +- Tests/DataProcessing/ItemsProcessorTest.php | 12 +- .../DataProcessing/ServicesProcessorTest.php | 2 +- Tests/DataProcessing/YoutubeProcessorTest.php | 18 +-- Tests/TCA/ArrayUtilTest.php | 3 +- Tests/TCA/SelectOptionsTest.php | 8 +- ext_emconf.php | 2 + ext_localconf.php | 2 + 18 files changed, 184 insertions(+), 93 deletions(-) diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 37b8e6a..e37b246 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -2,27 +2,111 @@ declare(strict_types=1); -$finder = PhpCsFixer\Finder::create() - ->in(__DIR__ . DIRECTORY_SEPARATOR . 'Tests') - ->in(__DIR__ . DIRECTORY_SEPARATOR . 'Classes'); +use Symfony\Component\Finder\Finder; -$config = new PhpCsFixer\Config(); +$finder = Finder::create() + ->in(__DIR__) + ->notPath('Build') + ->notPath('Documentation') + ->notPath('Resources') + ->notPath('vendor'); -return $config->setUsingCache(true)->setRiskyAllowed(true)->setRules([ - '@PSR12' => true, - 'array_indentation' => true, - 'no_unused_imports' => true, - 'cast_spaces' => ['space' => 'none'], - 'no_extra_blank_lines' => [ - 'tokens' => ['break', 'case', 'continue', 'curly_brace_block', 'default', 'extra', 'parenthesis_brace_block', 'return', 'square_brace_block', 'switch', 'throw', 'use'], - ], - 'types_spaces' => ['space' => 'single'], - 'binary_operator_spaces' => [ - 'operators' => [ - '|' => 'no_space', - '=>' => 'align', - ], - ], - 'no_trailing_comma_in_singleline_array' => true, -]) +return (new PhpCsFixer\Config()) + ->setUsingCache(true) + ->setRiskyAllowed(true) + ->setRules([ + '@DoctrineAnnotation' => true, + '@PSR12' => true, + '@PHP81Migration' => true, + '@PHP80Migration:risky' => true, + '@PHPUnit84Migration:risky' => true, + 'align_multiline_comment' => [ + 'comment_type' => 'phpdocs_like', + ], + 'array_syntax' => ['syntax' => 'short'], + 'binary_operator_spaces' => [ + 'default' => 'single_space', + 'operators' => [ + '=>' => 'align_single_space_minimal', + ], + ], + 'blank_line_before_statement' => [ + 'statements' => ['if', 'try', 'return'], + ], + 'cast_spaces' => ['space' => 'none'], + 'concat_space' => ['spacing' => 'one'], + 'declare_equal_normalize' => ['space' => 'none'], + 'declare_strict_types' => true, + 'doctrine_annotation_array_assignment' => [ + 'operator' => '=', + ], + 'dir_constant' => true, + 'ereg_to_preg' => true, + 'escape_implicit_backslashes' => [ + 'double_quoted' => true, + 'heredoc_syntax' => true, + 'single_quoted' => true, + ], + 'explicit_indirect_variable' => true, + 'explicit_string_variable' => true, + 'type_declaration_spaces' => ['elements' => ['function', 'property']], + 'linebreak_after_opening_tag' => true, + 'lowercase_cast' => true, + 'magic_constant_casing' => true, + 'modernize_types_casting' => true, + 'native_function_casing' => true, + 'new_with_parentheses' => [ + 'anonymous_class' => true, + 'named_class' => true, + ], + 'no_alias_functions' => true, + 'no_blank_lines_after_phpdoc' => true, + 'no_empty_comment' => true, + 'no_empty_phpdoc' => true, + 'no_empty_statement' => true, + 'no_extra_blank_lines' => true, + 'no_leading_import_slash' => true, + 'no_leading_namespace_whitespace' => true, + 'no_mixed_echo_print' => [ + 'use' => 'echo', + ], + 'no_multiline_whitespace_around_double_arrow' => true, + 'no_null_property_initialization' => true, + 'no_php4_constructor' => true, + 'no_short_bool_cast' => true, + 'no_singleline_whitespace_before_semicolons' => true, + 'no_superfluous_elseif' => true, + 'no_spaces_after_function_name' => true, + 'no_spaces_around_offset' => [ + 'positions' => ['inside', 'outside'], + ], + 'spaces_inside_parentheses' => ['space' => 'none'], + 'no_trailing_comma_in_singleline' => true, + 'no_unneeded_control_parentheses' => true, + 'no_unused_imports' => true, + 'no_useless_else' => true, + 'no_useless_return' => true, + 'no_whitespace_in_blank_line' => true, + 'non_printable_character' => false, + 'ordered_class_elements' => true, + 'ordered_imports' => true, + 'phpdoc_indent' => true, + 'phpdoc_scalar' => true, + 'short_scalar_cast' => true, + 'single_line_comment_style' => true, + 'phpdoc_no_access' => true, + 'phpdoc_no_empty_return' => true, + 'phpdoc_no_package' => true, + 'phpdoc_trim' => true, + 'phpdoc_types' => true, + 'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'], + 'return_type_declaration' => ['space_before' => 'none'], + 'single_quote' => [ + 'strings_containing_single_quote_chars' => true, + ], + 'standardize_not_equals' => true, + 'visibility_required' => true, + 'ternary_operator_spaces' => true, + 'whitespace_after_comma_in_array' => true, + ]) ->setFinder($finder); diff --git a/Classes/CSP/SupiPolicyExtender.php b/Classes/CSP/SupiPolicyExtender.php index df3e357..dee2081 100644 --- a/Classes/CSP/SupiPolicyExtender.php +++ b/Classes/CSP/SupiPolicyExtender.php @@ -18,16 +18,16 @@ class SupiPolicyExtender implements SingletonInterface { private array $extensions = []; - public function addInlineScript(string $data): void - { - $hash = hash('sha256', $data); - $this->extensions[] = [Directive::ScriptSrc, new HashValue($hash)]; - } - public function __invoke(PolicyMutatedEvent $event): void { foreach ($this->extensions as $extension) { $event->getCurrentPolicy()->extend(...$extension); } } + + public function addInlineScript(string $data): void + { + $hash = hash('sha256', $data); + $this->extensions[] = [Directive::ScriptSrc, new HashValue($hash)]; + } } diff --git a/Classes/DataProcessing/AddressProcessor.php b/Classes/DataProcessing/AddressProcessor.php index 82f2b21..8dc12aa 100644 --- a/Classes/DataProcessing/AddressProcessor.php +++ b/Classes/DataProcessing/AddressProcessor.php @@ -20,7 +20,7 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu $address = $cObj->data[$processorConfiguration['field'] ?? 'bodytext'] ?? ''; if (str_contains($address, ',')) { - $address = GeneralUtility::trimExplode(",", $address, true); + $address = GeneralUtility::trimExplode(',', $address, true); } else { $address = GeneralUtility::trimExplode("\n", $address, true); } diff --git a/Classes/DataProcessing/SpotifyProcessor.php b/Classes/DataProcessing/SpotifyProcessor.php index d3c8350..5bc545d 100644 --- a/Classes/DataProcessing/SpotifyProcessor.php +++ b/Classes/DataProcessing/SpotifyProcessor.php @@ -20,6 +20,7 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu $url = ($processedData['settings']['spotify']['url'] ?? '') ?: 'https://open.spotify.com/embed/playlist/{id}'; $vals['src'] = str_replace('{id}', $id, $url); $processedData[$as] = json_encode($vals, JSON_FORCE_OBJECT); + return $processedData; } } diff --git a/Classes/DataProcessing/YoutubeProcessor.php b/Classes/DataProcessing/YoutubeProcessor.php index e97480c..8568f23 100644 --- a/Classes/DataProcessing/YoutubeProcessor.php +++ b/Classes/DataProcessing/YoutubeProcessor.php @@ -59,7 +59,7 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu } foreach (GeneralUtility::trimExplode("\n", $cObj->data[$processorConfiguration['urlsField'] ?? 'tx_supi_youtube_urls'] ?? '', true) as $url) { - preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $url, $match); + preg_match('%(?:youtube(?:-nocookie)?\\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\\.be/)([^"&?/ ]{11})%i', $url, $match); if (is_array($match) && !empty($match[1])) { $videoId = $match[1]; diff --git a/Configuration/Icons.php b/Configuration/Icons.php index 756c01a..1256524 100644 --- a/Configuration/Icons.php +++ b/Configuration/Icons.php @@ -1,7 +1,10 @@ [ 'provider' => \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, - 'source' => 'EXT:supi/Resources/Public/Icons/Extension.svg', + 'source' => 'EXT:supi/Resources/Public/Icons/Extension.svg', ], ]; diff --git a/Configuration/TCA/Overrides/sys_file_reference.php b/Configuration/TCA/Overrides/sys_file_reference.php index c57be08..42df835 100644 --- a/Configuration/TCA/Overrides/sys_file_reference.php +++ b/Configuration/TCA/Overrides/sys_file_reference.php @@ -2,7 +2,7 @@ declare(strict_types=1); -(function ($extKey, $table) { +(function ($extKey, $table): void { $ll = 'LLL:EXT:supi/Resources/Private/Language/locallang_db.xlf:'; /** @@ -10,12 +10,12 @@ */ $additionalColumns = [ 'tx_supi_video_cover' => [ - 'label' => $ll . $table . '.tx_supi_video_cover.label', - 'description' => $ll . $table . '.tx_supi_video_cover.description', - 'config' => [ - 'type' => 'file', + 'label' => $ll . $table . '.tx_supi_video_cover.label', + 'description' => $ll . $table . '.tx_supi_video_cover.description', + 'config' => [ + 'type' => 'file', 'maxitems' => 1, - 'allowed' => ['jpg', 'jpeg', 'png', 'svg'], + 'allowed' => ['jpg', 'jpeg', 'png', 'svg'], ], ], ]; diff --git a/Configuration/TCA/Overrides/tt_content.php b/Configuration/TCA/Overrides/tt_content.php index df6cf04..5ae59a0 100644 --- a/Configuration/TCA/Overrides/tt_content.php +++ b/Configuration/TCA/Overrides/tt_content.php @@ -1,10 +1,11 @@ $ll . $table . '.field.tx_supi_youtube_ids.title', + 'label' => $ll . $table . '.field.tx_supi_youtube_ids.title', 'config' => [ 'type' => 'input', - 'max' => 255, + 'max' => 255, 'eval' => 'trim', ], ]; $GLOBALS['TCA'][$table]['columns']['tx_supi_youtube_urls'] = [ - 'label' => $ll . $table . '.field.tx_supi_youtube_urls.title', + 'label' => $ll . $table . '.field.tx_supi_youtube_urls.title', 'config' => [ 'type' => 'input', - 'max' => 255, + 'max' => 255, 'eval' => 'trim', ], ]; @@ -115,8 +116,8 @@ 'columnsOverrides' => [ 'assets' => [ 'config' => [ - 'type' => 'file', - 'allowed' => ['youtube'], + 'type' => 'file', + 'allowed' => ['youtube'], 'minitems' => 1, 'maxitems' => 1, ], @@ -128,6 +129,7 @@ // Remove youtube from default assets fields if configured if (!empty($GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['supi']['supiYoutubeOnly'])) { $GLOBALS['TCA'][$table]['columns']['assets'] = ArrayUtil::removeValue($GLOBALS['TCA'][$table]['columns']['assets'], 'youtube'); + if (is_array($GLOBALS['TCA'][$table]['columns']['image'] ?? null)) { $GLOBALS['TCA'][$table]['columns']['image'] = ArrayUtil::removeValue($GLOBALS['TCA'][$table]['columns']['image'], 'youtube'); } @@ -138,9 +140,9 @@ $table, 'CType', [ - $ll . $table .'.maps.title', + $ll . $table . '.maps.title', 'tx_supi_maps', - 'supi' + 'supi', ] ); @@ -148,8 +150,8 @@ '--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general', '--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general', '--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.headers;headers', - 'bodytext;'. $ll . $table .'.field.bodytext.tx_supi_maps.title', - 'image;'. $ll . $table .'.field.image.tx_supi_maps.title', + 'bodytext;' . $ll . $table . '.field.bodytext.tx_supi_maps.title', + 'image;' . $ll . $table . '.field.image.tx_supi_maps.title', '--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance', '--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.frames;frames', '--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.appearanceLinks;appearanceLinks', @@ -169,7 +171,7 @@ 'showitem' => implode(',', $showitem), 'columnsOverrides' => [ 'bodytext' => [ - 'description' => $ll . $table .'.field.bodytext.tx_supi_maps.description', + 'description' => $ll . $table . '.field.bodytext.tx_supi_maps.description', 'config' => [ 'rows' => 5, 'placeholder' => "Max Muster\nMusterstraße 1\n1234 Musterstadt\nÖsterreich", @@ -178,10 +180,10 @@ ], ], 'image' => [ - 'description' => $ll . $table .'.field.image.tx_supi_maps.description', - 'config' => [ - 'type' => 'file', - 'allowed' => ['jpeg', 'jpg', 'png'], + 'description' => $ll . $table . '.field.image.tx_supi_maps.description', + 'config' => [ + 'type' => 'file', + 'allowed' => ['jpeg', 'jpg', 'png'], 'minitems' => 1, 'maxitems' => 1, ], @@ -195,9 +197,9 @@ $table, 'CType', [ - $ll . $table .'.tx_supi_embed.title', + $ll . $table . '.tx_supi_embed.title', 'tx_supi_embed', - 'supi' + 'supi', ] ); @@ -205,7 +207,7 @@ '--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general', '--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general', '--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.headers;headers', - 'bodytext;'. $ll . $table .'.field.bodytext.tx_supi_embed.title', + 'bodytext;' . $ll . $table . '.field.bodytext.tx_supi_embed.title', '--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance', '--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.frames;frames', '--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.appearanceLinks;appearanceLinks', @@ -225,7 +227,7 @@ 'showitem' => implode(',', $showitem), 'columnsOverrides' => [ 'bodytext' => [ - 'description' => $ll . $table .'.field.bodytext.tx_supi_embed.description', + 'description' => $ll . $table . '.field.bodytext.tx_supi_embed.description', 'config' => [ 'type' => 'select', 'renderType' => 'selectSingle', @@ -240,15 +242,14 @@ ]; $GLOBALS['TCA'][$table]['ctrl']['typeicon_classes']['tx_supi_embed'] = 'supi'; - // Spotify Player CE ExtensionManagementUtility::addTcaSelectItem( $table, 'CType', [ - $ll . $table .'.tx_supi_spotify.title', + $ll . $table . '.tx_supi_spotify.title', 'tx_supi_spotify', - 'supi' + 'supi', ] ); @@ -256,7 +257,7 @@ '--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general', '--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general', '--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.headers;headers', - 'bodytext;'. $ll . $table .'.field.bodytext.tx_supi_spotify.title', + 'bodytext;' . $ll . $table . '.field.bodytext.tx_supi_spotify.title', '--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance', '--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.frames;frames', '--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.appearanceLinks;appearanceLinks', @@ -276,7 +277,7 @@ 'showitem' => implode(',', $showitem), 'columnsOverrides' => [ 'bodytext' => [ - 'description' => $ll . $table .'.field.bodytext.tx_supi_spotify.description', + 'description' => $ll . $table . '.field.bodytext.tx_supi_spotify.description', 'config' => [ 'type' => 'input', 'eval' => 'required,trim', diff --git a/Makefile b/Makefile index ae2fd78..e42b634 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ frontend: Resources/Public/Css/Supi.css Resources/Public/JavaScript/Supi.js .PHONY: fix fix: vendor/autoload.php Build/node_modules/.yarn-integrity - PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --diff + vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --diff cd Build && ./node_modules/.bin/prettier --write . .PHONY: lint diff --git a/Tests/ContentObject/SupiJsContentObjectTest.php b/Tests/ContentObject/SupiJsContentObjectTest.php index 989d7a9..0857f2d 100644 --- a/Tests/ContentObject/SupiJsContentObjectTest.php +++ b/Tests/ContentObject/SupiJsContentObjectTest.php @@ -4,8 +4,8 @@ namespace Supseven\Supi\Tests\ContentObject; -use Supseven\Supi\ContentObject\SupiJsContentObject; use PHPUnit\Framework\TestCase; +use Supseven\Supi\ContentObject\SupiJsContentObject; use Supseven\Supi\CSP\SupiPolicyExtender; use TYPO3\CMS\Core\Http\ServerRequest; use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; @@ -28,7 +28,7 @@ public function testRender(): void 'service' => 'service_name', 'stdWrap.' => [ 'wrap' => 'Some | string', - ] + ], ]; $cObj = $this->createMock(ContentObjectRenderer::class); diff --git a/Tests/DataProcessing/AddressProcessorTest.php b/Tests/DataProcessing/AddressProcessorTest.php index ab49301..ba43d7d 100644 --- a/Tests/DataProcessing/AddressProcessorTest.php +++ b/Tests/DataProcessing/AddressProcessorTest.php @@ -4,8 +4,8 @@ namespace Supseven\Supi\Tests\DataProcessing; -use Supseven\Supi\DataProcessing\AddressProcessor; use PHPUnit\Framework\TestCase; +use Supseven\Supi\DataProcessing\AddressProcessor; use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; /** @@ -17,10 +17,9 @@ class AddressProcessorTest extends TestCase * @dataProvider processDataProvider * @param $in * @param $expected - * @return void * @throws \ReflectionException */ - public function testProcess($in, $expected) + public function testProcess($in, $expected): void { $subject = new AddressProcessor(); $field = 'address'; diff --git a/Tests/DataProcessing/ItemsProcessorTest.php b/Tests/DataProcessing/ItemsProcessorTest.php index abc1f52..72cb74d 100644 --- a/Tests/DataProcessing/ItemsProcessorTest.php +++ b/Tests/DataProcessing/ItemsProcessorTest.php @@ -4,8 +4,8 @@ namespace Supseven\Supi\Tests\DataProcessing; -use Supseven\Supi\DataProcessing\ItemsProcessor; use PHPUnit\Framework\TestCase; +use Supseven\Supi\DataProcessing\ItemsProcessor; use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; /** @@ -13,7 +13,7 @@ */ class ItemsProcessorTest extends TestCase { - public function testProcess() + public function testProcess(): void { $policyUid = '12'; $policyUrl = 'https://www.domain.tld/privacy/'; @@ -24,7 +24,7 @@ public function testProcess() 'items' => [ 'session' => [ 'table' => [ - 'policy' => $policyUid + 'policy' => $policyUid, ], ], ], @@ -33,7 +33,7 @@ public function testProcess() 'items' => [ 'googleMaps' => [ 'table' => [ - 'policy' => 'https://www.google.com/privacy/' + 'policy' => 'https://www.google.com/privacy/', ], ], ], @@ -49,7 +49,7 @@ public function testProcess() 'session' => [ 'table' => [ 'policyUrl' => $policyUrl, - 'policy' => $policyUid + 'policy' => $policyUid, ], ], ], @@ -59,7 +59,7 @@ public function testProcess() 'googleMaps' => [ 'table' => [ 'policyUrl' => 'https://www.google.com/privacy/', - 'policy' => 'https://www.google.com/privacy/' + 'policy' => 'https://www.google.com/privacy/', ], ], ], diff --git a/Tests/DataProcessing/ServicesProcessorTest.php b/Tests/DataProcessing/ServicesProcessorTest.php index bc9b535..747e012 100644 --- a/Tests/DataProcessing/ServicesProcessorTest.php +++ b/Tests/DataProcessing/ServicesProcessorTest.php @@ -13,7 +13,7 @@ */ class ServicesProcessorTest extends TestCase { - public function testProcess() + public function testProcess(): void { $cObj = $this->createMock(ContentObjectRenderer::class); diff --git a/Tests/DataProcessing/YoutubeProcessorTest.php b/Tests/DataProcessing/YoutubeProcessorTest.php index 2570c3b..1ddb574 100644 --- a/Tests/DataProcessing/YoutubeProcessorTest.php +++ b/Tests/DataProcessing/YoutubeProcessorTest.php @@ -5,8 +5,8 @@ namespace Supseven\Supi\Tests\DataProcessing; use org\bovigo\vfs\vfsStream; -use Supseven\Supi\DataProcessing\YoutubeProcessor; use PHPUnit\Framework\TestCase; +use Supseven\Supi\DataProcessing\YoutubeProcessor; use TYPO3\CMS\Core\Core\ApplicationContext; use TYPO3\CMS\Core\Core\Environment; use TYPO3\CMS\Core\Resource\FileReference; @@ -19,9 +19,9 @@ */ class YoutubeProcessorTest extends TestCase { - public function testFileReferences() + public function testFileReferences(): void { - list($id, $root, $previewUrl, $storage, $cObj, $embedUrl, $preview) = $this->createShared(); + [$id, $root, $previewUrl, $storage, $cObj, $embedUrl, $preview] = $this->createShared(); $fileRepo = $this->createMock(FileRepository::class); $ref = $this->createMock(FileReference::class); @@ -54,7 +54,7 @@ public function testFileReferences() 'preview' => $preview, 'id' => $id, 'url' => $embedUrl . $id, - ] + ], ], ]); @@ -62,9 +62,9 @@ public function testFileReferences() static::assertEquals($expected, $actual); } - public function testId() + public function testId(): void { - list($id, $root, $previewUrl, $storage, $cObj, $embedUrl, $preview) = $this->createShared(); + [$id, $root, $previewUrl, $storage, $cObj, $embedUrl, $preview] = $this->createShared(); $fileRepo = $this->createMock(FileRepository::class); $ref = $this->createMock(FileReference::class); @@ -105,9 +105,9 @@ public function testId() static::assertEquals($expected, $actual); } - public function testUrl() + public function testUrl(): void { - list($id, $root, $previewUrl, $storage, $cObj, $embedUrl, $preview) = $this->createShared(); + [$id, $root, $previewUrl, $storage, $cObj, $embedUrl, $preview] = $this->createShared(); $fileRepo = $this->createMock(FileRepository::class); $ref = $this->createMock(FileReference::class); @@ -176,6 +176,6 @@ protected function createShared() $storageRepository = $this->createMock(StorageRepository::class); $storageRepository->method('getDefaultStorage')->willReturn($storage); - return array($id, $root, $previewUrl, $storageRepository, $cObj, $embedUrl, $preview); + return [$id, $root, $previewUrl, $storageRepository, $cObj, $embedUrl, $preview]; } } diff --git a/Tests/TCA/ArrayUtilTest.php b/Tests/TCA/ArrayUtilTest.php index e366e52..d8639f2 100644 --- a/Tests/TCA/ArrayUtilTest.php +++ b/Tests/TCA/ArrayUtilTest.php @@ -17,9 +17,8 @@ class ArrayUtilTest extends TestCase * @param $input * @param $value * @param $expected - * @return void */ - public function testRemoveValue($input, $value, $expected) + public function testRemoveValue($input, $value, $expected): void { $actual = ArrayUtil::removeValue($input, $value); self::assertEquals($expected, $actual); diff --git a/Tests/TCA/SelectOptionsTest.php b/Tests/TCA/SelectOptionsTest.php index 15e0d0a..b1231ec 100644 --- a/Tests/TCA/SelectOptionsTest.php +++ b/Tests/TCA/SelectOptionsTest.php @@ -22,7 +22,7 @@ */ class SelectOptionsTest extends TestCase { - public function testGetFromExistingRecords() + public function testGetFromExistingRecords(): void { $pid = 2; $rootLine = [['uid' => $pid], ['uid' => 1]]; @@ -82,14 +82,14 @@ public function testGetFromExistingRecords() 'row' => [ 'uid' => 3, 'pid' => $pid, - ] + ], ]; $subject->addServices($actual); static::assertSame($expected, $actual); } - public function testGetFromNewRecords() + public function testGetFromNewRecords(): void { $pid = 2; $rootLine = [['uid' => $pid], ['uid' => 1]]; @@ -166,7 +166,7 @@ public function testGetFromNewRecords() 'row' => [ 'uid' => 'NEW123', 'pid' => -$pid, - ] + ], ]; $subject->addServices($actual); diff --git a/ext_emconf.php b/ext_emconf.php index d91080a..ad07738 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -1,5 +1,7 @@ 'Super User Privacy Interface', 'description' => 'Cookie Consent popout, easy, yet powerful', diff --git a/ext_localconf.php b/ext_localconf.php index 09aa885..709a3af 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -1,4 +1,6 @@ '); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('');