Skip to content

Commit 7eb2f3e

Browse files
committed
[TASK] Code cleanup
Let php cs fixer run without dry-run for a better code cleanup
1 parent aafe49c commit 7eb2f3e

File tree

212 files changed

+366
-318
lines changed

Some content is hidden

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

212 files changed

+366
-318
lines changed

.project/tests/.php-cs-fixer.php

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<?php
2+
/*
3+
* This file is part of the TYPO3 CMS project.
4+
*
5+
* It is free software; you can redistribute it and/or modify it under
6+
* the terms of the GNU General Public License, either version 2
7+
* of the License, or any later version.
8+
*
9+
* For the full copyright and license information, please read the
10+
* LICENSE.txt file that was distributed with this source code.
11+
*
12+
* The TYPO3 project - inspiring people to share!
13+
*/
14+
/**
15+
* This file represents the configuration for Code Sniffing PSR-2-related
16+
* automatic checks of coding guidelines
17+
* Install @fabpot's great php-cs-fixer tool via
18+
*
19+
* $ composer global require friendsofphp/php-cs-fixer
20+
*
21+
* And then simply run
22+
*
23+
* $ php-cs-fixer fix --config ../Build/.php_cs
24+
*
25+
* inside the TYPO3 directory. Warning: This may take up to 10 minutes.
26+
*
27+
* For more information read:
28+
* https://www.php-fig.org/psr/psr-2/
29+
* https://cs.sensiolabs.org
30+
*/
31+
if (PHP_SAPI !== 'cli') {
32+
die('This script supports command line usage only. Please check your command.');
33+
}
34+
// Define in which folders to search and which folders to exclude
35+
// Exclude some directories that are excluded by Git anyways to speed up the sniffing
36+
$finder = PhpCsFixer\Finder::create()
37+
->in(
38+
[
39+
__DIR__ . '/../../Classes',
40+
__DIR__ . '/../../Tests',
41+
__DIR__ . '/../../Configuration',
42+
]
43+
);
44+
// Return a Code Sniffing configuration using
45+
// all sniffers needed for PSR-2
46+
// and additionally:
47+
// - Remove leading slashes in use clauses.
48+
// - PHP single-line arrays should not have trailing comma.
49+
// - Single-line whitespace before closing semicolon are prohibited.
50+
// - Remove unused use statements in the PHP source code
51+
// - Ensure Concatenation to have at least one whitespace around
52+
// - Remove trailing whitespace at the end of blank lines.
53+
return PhpCsFixer\Config::create()->setRiskyAllowed(true)->setRules([
54+
'@PSR2' => true,
55+
'@DoctrineAnnotation' => true,
56+
'no_leading_import_slash' => true,
57+
'no_trailing_comma_in_singleline_array' => true,
58+
'no_singleline_whitespace_before_semicolons' => true,
59+
'no_unused_imports' => true,
60+
'concat_space' => ['spacing' => 'one'],
61+
'no_whitespace_in_blank_line' => true,
62+
'ordered_imports' => true,
63+
'single_quote' => true,
64+
'no_empty_statement' => true,
65+
'no_extra_consecutive_blank_lines' => true,
66+
'phpdoc_no_package' => true,
67+
'phpdoc_scalar' => true,
68+
'no_blank_lines_after_phpdoc' => true,
69+
'array_syntax' => ['syntax' => 'short'],
70+
'whitespace_after_comma_in_array' => true,
71+
'function_typehint_space' => true,
72+
'hash_to_slash_comment' => true,
73+
'no_alias_functions' => true,
74+
'lowercase_cast' => true,
75+
'no_leading_namespace_whitespace' => true,
76+
'native_function_casing' => true,
77+
'no_short_bool_cast' => true,
78+
'no_unneeded_control_parentheses' => true,
79+
'phpdoc_no_empty_return' => false,
80+
'phpdoc_trim' => true,
81+
'no_superfluous_elseif' => false,
82+
'no_useless_else' => true,
83+
'phpdoc_types' => true,
84+
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
85+
'return_type_declaration' => ['space_before' => 'none'],
86+
'cast_spaces' => ['space' => 'none'],
87+
'declare_equal_normalize' => ['space' => 'single'],
88+
'dir_constant' => true,
89+
])->setFinder($finder);

Classes/Command/AbstractCleanupCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
declare(strict_types=1);
2+
declare(strict_types = 1);
33
namespace In2code\Powermail\Command;
44

55
use Symfony\Component\Console\Command\Command;

Classes/Command/CleanupExportsCommand.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
<?php
2-
declare(strict_types=1);
2+
declare(strict_types = 1);
33
namespace In2code\Powermail\Command;
44

55
use Symfony\Component\Console\Input\InputArgument;
66
use Symfony\Component\Console\Input\InputInterface;
77
use Symfony\Component\Console\Output\OutputInterface;
8-
use TYPO3\CMS\Extbase\Object\Exception;
98

109
/**
1110
* Class CleanupExportsCommand

Classes/Command/CleanupUnusedUploadsCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
declare(strict_types=1);
2+
declare(strict_types = 1);
33
namespace In2code\Powermail\Command;
44

55
use In2code\Powermail\Domain\Repository\AnswerRepository;

Classes/Command/CleanupUploadsCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
declare(strict_types=1);
2+
declare(strict_types = 1);
33
namespace In2code\Powermail\Command;
44

55
use Symfony\Component\Console\Input\InputArgument;

Classes/Command/ExportCommand.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
11
<?php
2-
declare(strict_types=1);
2+
declare(strict_types = 1);
33
namespace In2code\Powermail\Command;
44

5-
use In2code\Powermail\Domain\Model\Field;
6-
use In2code\Powermail\Domain\Repository\AnswerRepository;
75
use In2code\Powermail\Domain\Repository\MailRepository;
86
use In2code\Powermail\Domain\Service\ExportService;
9-
use In2code\Powermail\Domain\Service\GetNewMarkerNamesForFormService;
10-
use In2code\Powermail\Utility\BasicFileUtility;
11-
use In2code\Powermail\Utility\DatabaseUtility;
127
use In2code\Powermail\Utility\ObjectUtility;
138
use Symfony\Component\Console\Command\Command;
149
use Symfony\Component\Console\Input\InputArgument;
1510
use Symfony\Component\Console\Input\InputInterface;
1611
use Symfony\Component\Console\Output\OutputInterface;
17-
use TYPO3\CMS\Core\Utility\GeneralUtility;
1812
use TYPO3\CMS\Extbase\Configuration\Exception\InvalidConfigurationTypeException;
1913
use TYPO3\CMS\Extbase\Mvc\Exception\InvalidExtensionNameException;
2014
use TYPO3\CMS\Extbase\Object\Exception;
@@ -94,10 +88,9 @@ public function execute(InputInterface $input, OutputInterface $output): int
9488
if ($exportService->send() === true) {
9589
$output->writeln('Export finished');
9690
return 0;
97-
} else {
98-
$output->writeln('Export could not be generated');
99-
return 1;
10091
}
92+
$output->writeln('Export could not be generated');
93+
return 1;
10194
}
10295

10396
/**

Classes/Command/ResetMarkersCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
declare(strict_types=1);
2+
declare(strict_types = 1);
33
namespace In2code\Powermail\Command;
44

55
use In2code\Powermail\Domain\Model\Field;

Classes/Condition/PowermailConditionFunctionsProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
declare(strict_types=1);
2+
declare(strict_types = 1);
33
namespace In2code\Powermail\Condition;
44

55
use In2code\Powermail\Utility\DatabaseUtility;

Classes/Condition/PowermailTypoScriptConditionProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
declare(strict_types=1);
2+
declare(strict_types = 1);
33
namespace In2code\Powermail\Condition;
44

55
use TYPO3\CMS\Core\ExpressionLanguage\AbstractProvider;

Classes/Controller/AbstractController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
declare(strict_types=1);
2+
declare(strict_types = 1);
33
namespace In2code\Powermail\Controller;
44

55
use In2code\Powermail\Domain\Model\Answer;

0 commit comments

Comments
 (0)