Skip to content

Commit 123e61b

Browse files
author
Tim Schreiner
committed
[TASK] Apply current TYPO3 codestyles
1 parent 54b78f1 commit 123e61b

21 files changed

+202
-328
lines changed

.php-cs-fixer.dist.php

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?php
2+
$headerTemplate = <<<EOF
3+
This file is part of the "image_compression" Extension for TYPO3 CMS.
4+
5+
For the full copyright and license information, please read the
6+
LICENSE file that was distributed with this source code.
7+
EOF;
8+
9+
$config = new PhpCsFixer\Config();
10+
$config->setRiskyAllowed(true);
11+
$config->getFinder()->in(__DIR__);
12+
$config->getFinder()->exclude(['.Build', 'var']);
13+
$config->setRules([
14+
'@DoctrineAnnotation' => true,
15+
'@PSR2' => true,
16+
'array_syntax' => ['syntax' => 'short'],
17+
'blank_line_after_opening_tag' => true,
18+
'braces' => ['allow_single_line_closure' => true],
19+
'cast_spaces' => ['space' => 'none'],
20+
'compact_nullable_typehint' => true,
21+
'concat_space' => ['spacing' => 'one'],
22+
'declare_equal_normalize' => ['space' => 'none'],
23+
'dir_constant' => true,
24+
'function_typehint_space' => true,
25+
'header_comment' => [
26+
'header' => $headerTemplate,
27+
'commentType' => 'comment',
28+
'location' => 'after_declare_strict',
29+
'separate' => 'both',
30+
],
31+
'lowercase_cast' => true,
32+
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
33+
'modernize_types_casting' => true,
34+
'native_function_casing' => true,
35+
'new_with_braces' => true,
36+
'no_alias_functions' => true,
37+
'no_blank_lines_after_phpdoc' => true,
38+
'no_empty_phpdoc' => true,
39+
'no_empty_statement' => true,
40+
'no_extra_blank_lines' => true,
41+
'no_leading_import_slash' => true,
42+
'no_leading_namespace_whitespace' => true,
43+
'no_null_property_initialization' => true,
44+
'no_short_bool_cast' => true,
45+
'no_singleline_whitespace_before_semicolons' => true,
46+
'no_superfluous_elseif' => true,
47+
'no_trailing_comma_in_singleline_array' => true,
48+
'no_unneeded_control_parentheses' => true,
49+
'no_unused_imports' => true,
50+
'no_useless_else' => true,
51+
'no_whitespace_in_blank_line' => true,
52+
'ordered_imports' => true,
53+
'php_unit_construct' => [
54+
'assertions' => ['assertEquals', 'assertSame', 'assertNotEquals', 'assertNotSame'],
55+
],
56+
'php_unit_mock_short_will_return' => true,
57+
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
58+
'phpdoc_no_access' => true,
59+
'phpdoc_no_empty_return' => true,
60+
'phpdoc_no_package' => true,
61+
'phpdoc_scalar' => true,
62+
'phpdoc_trim' => true,
63+
'phpdoc_types' => true,
64+
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
65+
'return_type_declaration' => ['space_before' => 'none'],
66+
'single_line_comment_style' => false,
67+
'single_quote' => true,
68+
'single_trait_insert_per_statement' => true,
69+
'whitespace_after_comma_in_array' => true,
70+
]);
71+
72+
return $config;

.php_cs.dist

-78
This file was deleted.

Classes/Compressor/CompressorInterface.php

+4-13
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,17 @@
11
<?php
2-
namespace Codemonkey1988\ImageCompression\Compressor;
32

43
/*
5-
* This file is part of the TYPO3 responsive images project.
6-
*
7-
* It is free software; you can redistribute it and/or modify it under
8-
* the terms of the GNU General Public License, either version 2
9-
* of the License, or any later version.
4+
* This file is part of the "image_compression" Extension for TYPO3 CMS.
105
*
11-
* For the full copyright and license information, please read
6+
* For the full copyright and license information, please read the
127
* LICENSE file that was distributed with this source code.
13-
*
148
*/
159

10+
namespace Codemonkey1988\ImageCompression\Compressor;
11+
1612
use TYPO3\CMS\Core\Resource\FileInterface;
1713
use TYPO3\CMS\Core\SingletonInterface;
1814

19-
/**
20-
* Interface CompressorInterface
21-
*
22-
* @author Tim Schreiner <[email protected]>
23-
*/
2415
interface CompressorInterface extends SingletonInterface
2516
{
2617
/**

Classes/Compressor/TinifyCompressor.php

+5-17
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,19 @@
11
<?php
2+
23
declare(strict_types=1);
3-
namespace Codemonkey1988\ImageCompression\Compressor;
44

55
/*
6-
* This file is part of the TYPO3 responsive images project.
7-
*
8-
* It is free software; you can redistribute it and/or modify it under
9-
* the terms of the GNU General Public License, either version 2
10-
* of the License, or any later version.
6+
* This file is part of the "image_compression" Extension for TYPO3 CMS.
117
*
12-
* For the full copyright and license information, please read
8+
* For the full copyright and license information, please read the
139
* LICENSE file that was distributed with this source code.
14-
*
1510
*/
1611

12+
namespace Codemonkey1988\ImageCompression\Compressor;
13+
1714
use Codemonkey1988\ImageCompression\Service\ConfigurationService;
1815
use TYPO3\CMS\Core\Resource\FileInterface;
1916

20-
/**
21-
* Class CompressionService
22-
*
23-
* @author Tim Schreiner <[email protected]>
24-
*/
2517
class TinifyCompressor implements CompressorInterface
2618
{
2719
/**
@@ -36,16 +28,12 @@ class TinifyCompressor implements CompressorInterface
3628

3729
/**
3830
* @param ConfigurationService $configurationService
39-
* @return void
4031
*/
4132
public function injectConfigurationService(ConfigurationService $configurationService)
4233
{
4334
$this->configurationService = $configurationService;
4435
}
4536

46-
/**
47-
* @return void
48-
*/
4937
public function initializeObject()
5038
{
5139
\Tinify\setKey($this->configurationService->getTinifyApiKey());

Classes/Resource/FileRepository.php

+5-13
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,22 @@
11
<?php
2+
23
declare(strict_types=1);
3-
namespace Codemonkey1988\ImageCompression\Resource;
44

55
/*
6-
* This file is part of the TYPO3 responsive images project.
6+
* This file is part of the "image_compression" Extension for TYPO3 CMS.
77
*
8-
* It is free software; you can redistribute it and/or modify it under
9-
* the terms of the GNU General Public License, either version 2
10-
* of the License, or any later version.
11-
*
12-
* For the full copyright and license information, please read
8+
* For the full copyright and license information, please read the
139
* LICENSE file that was distributed with this source code.
14-
*
1510
*/
1611

12+
namespace Codemonkey1988\ImageCompression\Resource;
13+
1714
use TYPO3\CMS\Core\Database\Connection;
1815
use TYPO3\CMS\Core\Database\ConnectionPool;
1916
use TYPO3\CMS\Core\Database\Query\Restriction\DefaultRestrictionContainer;
2017
use TYPO3\CMS\Core\Resource\FileRepository as BaseFileRepository;
2118
use TYPO3\CMS\Core\Utility\GeneralUtility;
2219

23-
/**
24-
* Class FileRepository
25-
*
26-
* @author Tim Schreiner <[email protected]>
27-
*/
2820
class FileRepository extends BaseFileRepository
2921
{
3022
/**

Classes/Resource/ProcessedFileRepository.php

+5-13
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,21 @@
11
<?php
2+
23
declare(strict_types=1);
3-
namespace Codemonkey1988\ImageCompression\Resource;
44

55
/*
6-
* This file is part of the TYPO3 responsive images project.
6+
* This file is part of the "image_compression" Extension for TYPO3 CMS.
77
*
8-
* It is free software; you can redistribute it and/or modify it under
9-
* the terms of the GNU General Public License, either version 2
10-
* of the License, or any later version.
11-
*
12-
* For the full copyright and license information, please read
8+
* For the full copyright and license information, please read the
139
* LICENSE file that was distributed with this source code.
14-
*
1510
*/
1611

12+
namespace Codemonkey1988\ImageCompression\Resource;
13+
1714
use TYPO3\CMS\Core\Database\Connection;
1815
use TYPO3\CMS\Core\Database\ConnectionPool;
1916
use TYPO3\CMS\Core\Database\Query\Restriction\DefaultRestrictionContainer;
2017
use TYPO3\CMS\Core\Utility\GeneralUtility;
2118

22-
/**
23-
* Class ProcessedFileRepository
24-
*
25-
* @author Tim Schreiner <[email protected]>
26-
*/
2719
class ProcessedFileRepository extends \TYPO3\CMS\Core\Resource\ProcessedFileRepository
2820
{
2921
/**

Classes/Service/CompressionService.php

+5-17
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
<?php
2+
23
declare(strict_types=1);
3-
namespace Codemonkey1988\ImageCompression\Service;
44

55
/*
6-
* This file is part of the TYPO3 responsive images project.
6+
* This file is part of the "image_compression" Extension for TYPO3 CMS.
77
*
8-
* It is free software; you can redistribute it and/or modify it under
9-
* the terms of the GNU General Public License, either version 2
10-
* of the License, or any later version.
11-
*
12-
* For the full copyright and license information, please read
8+
* For the full copyright and license information, please read the
139
* LICENSE file that was distributed with this source code.
14-
*
1510
*/
1611

12+
namespace Codemonkey1988\ImageCompression\Service;
13+
1714
use Codemonkey1988\ImageCompression\Compressor\CompressorInterface;
1815
use Codemonkey1988\ImageCompression\Resource\FileRepository;
1916
use Codemonkey1988\ImageCompression\Resource\ProcessedFileRepository;
@@ -24,11 +21,6 @@
2421
use TYPO3\CMS\Core\Utility\GeneralUtility;
2522
use TYPO3\CMS\Extbase\Object\ObjectManager;
2623

27-
/**
28-
* Class CompressionService
29-
*
30-
* @author Tim Schreiner <[email protected]>
31-
*/
3224
class CompressionService implements SingletonInterface
3325
{
3426
/**
@@ -78,7 +70,6 @@ public function injectProcessedFileRepository(ProcessedFileRepository $processed
7870
* Compress an image file.
7971
*
8072
* @param AbstractFile $file
81-
* @return void
8273
*/
8374
public function compress(AbstractFile $file)
8475
{
@@ -143,7 +134,6 @@ protected function getFirstMatchingCompressor(AbstractFile $file)
143134
* Update the compression status.
144135
*
145136
* @param AbstractFile $file
146-
* @return void
147137
*/
148138
protected function updateCompressionStatus(AbstractFile $file)
149139
{
@@ -168,7 +158,6 @@ protected function updateCompressionStatus(AbstractFile $file)
168158
* Update the checked status.
169159
*
170160
* @param AbstractFile $file
171-
* @return void
172161
*/
173162
protected function updateCheckedStatus(AbstractFile $file)
174163
{
@@ -192,7 +181,6 @@ protected function updateCheckedStatus(AbstractFile $file)
192181
* Updates necessary database fields after successful image compression.
193182
*
194183
* @param AbstractFile $file
195-
* @return void
196184
*/
197185
protected function updatePostProcess(AbstractFile $file)
198186
{

0 commit comments

Comments
 (0)