Skip to content

Commit 7db03e9

Browse files
committed
[TASK] Add return types, parameter types and clean up doc comments
1 parent 30e48d7 commit 7db03e9

48 files changed

Lines changed: 132 additions & 386 deletions

File tree

Some content is hidden

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

Classes/Aggregate/AbstractAggregate.php

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ abstract class AbstractAggregate
4949
*/
5050
protected $typoScriptFilePath = 'Configuration/TypoScript/';
5151

52-
/**
53-
* @param array $maskConfiguration
54-
*/
5552
public function __construct(array $maskConfiguration)
5653
{
5754
$this->maskConfiguration = $maskConfiguration;
@@ -63,12 +60,12 @@ public function __construct(array $maskConfiguration)
6360
/**
6461
* Evaluates the configuration and stores necessary Interface information
6562
*/
66-
abstract protected function process();
63+
abstract protected function process(): void;
6764

6865
/**
6966
* Remove hidden content elements from configuration
7067
*/
71-
protected function removeHiddenContentElements()
68+
protected function removeHiddenContentElements(): void
7269
{
7370
if (empty($this->maskConfiguration['tt_content']['elements'])) {
7471
return;
@@ -85,7 +82,7 @@ static function (array $element) {
8582
/**
8683
* Remove core fields from configuration
8784
*/
88-
protected function removeCoreFields()
85+
protected function removeCoreFields(): void
8986
{
9087
foreach ($this->maskConfiguration as $table => $configuration) {
9188
if (empty($configuration['tca'])) {
@@ -100,11 +97,7 @@ static function ($field) {
10097
}
10198
}
10299

103-
/**
104-
* @param string $string
105-
* @return string
106-
*/
107-
protected function escapeMaskExtensionKey($string)
100+
protected function escapeMaskExtensionKey(string $string): string
108101
{
109102
return preg_replace('/(m)ask/i', '${\\1ask}', $string);
110103
}

Classes/Aggregate/AbstractInlineContentAggregate.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@
1919

2020
abstract class AbstractInlineContentAggregate extends AbstractAggregate
2121
{
22-
/**
23-
* @return array
24-
*/
25-
protected function getAvailableInlineFields()
22+
protected function getAvailableInlineFields(): array
2623
{
2724
$inlineFields = [];
2825
foreach ($this->maskConfiguration as $table => $configuration) {

Classes/Aggregate/AbstractOverridesAggregate.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ abstract class AbstractOverridesAggregate extends AbstractAggregate implements L
3030
*/
3131
protected $tcaOverridesFilePath = 'Configuration/TCA/Overrides/';
3232

33-
/**
34-
* @param array $tableConfiguration
35-
*/
36-
protected function addTableColumns(array $tableConfiguration)
33+
protected function addTableColumns(array $tableConfiguration): void
3734
{
3835
if (empty($tableConfiguration['columns']) || empty($this->maskConfiguration[$this->table]['tca'])) {
3936
return;

Classes/Aggregate/AggregateCollection.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ class AggregateCollection
3636
*/
3737
protected $maskConfiguration;
3838

39-
/**
40-
* @param array $aggregateClassNames
41-
* @param array $maskConfiguration
42-
*/
4339
public function __construct(array $aggregateClassNames, array $maskConfiguration)
4440
{
4541
$this->aggregateClassNames = $aggregateClassNames;
@@ -49,7 +45,7 @@ public function __construct(array $aggregateClassNames, array $maskConfiguration
4945
/**
5046
* @return AbstractAggregate[]
5147
*/
52-
public function getCollection()
48+
public function getCollection(): array
5349
{
5450
if (null === $this->collection) {
5551
$this->initializeCollection();
@@ -61,7 +57,7 @@ public function getCollection()
6157
/**
6258
* Initializes aggregate objects
6359
*/
64-
protected function initializeCollection()
60+
protected function initializeCollection(): void
6561
{
6662
$this->collection = [];
6763
foreach ($this->aggregateClassNames as $className) {

Classes/Aggregate/BackendPreviewAggregate.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ class BackendPreviewAggregate extends AbstractOverridesAggregate implements Plai
4040
*/
4141
protected $templatesFilePath = 'Resources/Private/Backend/Templates/';
4242

43-
/**
44-
* @param array $maskConfiguration
45-
* @param BackendFluidCodeGenerator $fluidCodeGenerator
46-
*/
4743
public function __construct(array $maskConfiguration, BackendFluidCodeGenerator $fluidCodeGenerator = null)
4844
{
4945
$this->fluidCodeGenerator = (null !== $fluidCodeGenerator) ? $fluidCodeGenerator : GeneralUtility::makeInstance(BackendFluidCodeGenerator::class);
@@ -54,7 +50,7 @@ public function __construct(array $maskConfiguration, BackendFluidCodeGenerator
5450
/**
5551
* Adds PHP and Fluid files
5652
*/
57-
protected function process()
53+
protected function process(): void
5854
{
5955
if (empty($this->maskConfiguration[$this->table]['elements'])) {
6056
return;
@@ -66,7 +62,7 @@ protected function process()
6662
$this->addFluidTemplates();
6763
}
6864

69-
protected function addPageTsConfiguration()
65+
protected function addPageTsConfiguration(): void
7066
{
7167
$rootPaths = $this->getFluidRootPaths();
7268

@@ -96,7 +92,7 @@ protected function addPageTsConfiguration()
9692
/**
9793
* This adds the PHP file with the hook to render own element template
9894
*/
99-
protected function addDrawItemHook()
95+
protected function addDrawItemHook(): void
10096
{
10197
$this->appendPhpFile(
10298
'ext_localconf.php',
@@ -266,7 +262,7 @@ protected function getProcessedData(array \$databaseRow, array \$processedTcaCol
266262
/**
267263
* Ensure proper labels in $GLOBALS['TCA'] configuration
268264
*/
269-
protected function replaceTableLabels()
265+
protected function replaceTableLabels(): void
270266
{
271267
foreach ($this->maskConfiguration as $table => $_) {
272268
if (!isset($GLOBALS['TCA'][$table]) || empty($GLOBALS['TCA'][$table]['columns'])) {
@@ -297,7 +293,7 @@ protected function replaceTableLabels()
297293
}
298294
}
299295

300-
protected function addFluidTemplates()
296+
protected function addFluidTemplates(): void
301297
{
302298
foreach ($this->maskConfiguration[$this->table]['elements'] as $key => $element) {
303299
$templateKey = GeneralUtility::underscoredToUpperCamelCase($key);
@@ -325,7 +321,7 @@ protected function addFluidTemplates()
325321
}
326322
}
327323

328-
protected function getFluidRootPaths()
324+
protected function getFluidRootPaths(): array
329325
{
330326
$rootPath = dirname($this->templatesFilePath);
331327

Classes/Aggregate/ContentElementIconAggregate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class ContentElementIconAggregate extends TtContentOverridesAggregate implements
3535
/**
3636
* Adds content elements to the newContentElementWizard
3737
*/
38-
protected function process()
38+
protected function process(): void
3939
{
4040
if (empty($this->maskConfiguration['tt_content']['elements'])) {
4141
return;

Classes/Aggregate/ContentRenderingAggregate.php

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@ class ContentRenderingAggregate extends AbstractOverridesAggregate implements Pl
5555
*/
5656
protected $partialPath = 'Partials/';
5757

58-
/**
59-
* @param array $maskConfiguration
60-
* @param HtmlCodeGenerator $htmlCodeGenerator
61-
*/
6258
public function __construct(array $maskConfiguration, HtmlCodeGenerator $htmlCodeGenerator = null)
6359
{
6460
$this->htmlCodeGenerator = (null !== $htmlCodeGenerator) ? $htmlCodeGenerator : GeneralUtility::makeInstance(HtmlCodeGenerator::class);
@@ -69,7 +65,7 @@ public function __construct(array $maskConfiguration, HtmlCodeGenerator $htmlCod
6965
/**
7066
* Adds TypoScript and Fluid information
7167
*/
72-
protected function process()
68+
protected function process(): void
7369
{
7470
if (empty($this->maskConfiguration[$this->table]['elements'])) {
7571
return;
@@ -113,10 +109,7 @@ protected function process()
113109
}
114110
}
115111

116-
/**
117-
* @param array $element
118-
*/
119-
protected function addTypoScript(array $element)
112+
protected function addTypoScript(array $element): void
120113
{
121114
$resourcesPath = 'EXT:mask/' . $this->resourcePath;
122115
$layoutsPath = $resourcesPath . $this->layoutPath;
@@ -157,12 +150,7 @@ protected function addTypoScript(array $element)
157150
);
158151
}
159152

160-
/**
161-
* @param string $table
162-
* @param array $fields
163-
* @return string
164-
*/
165-
protected function addDataProcessing($table, array $fields)
153+
protected function addDataProcessing(string $table, array $fields): string
166154
{
167155
$dataProcessing = '';
168156
$index = 10;
@@ -206,13 +194,7 @@ protected function addDataProcessing($table, array $fields)
206194
return $dataProcessing;
207195
}
208196

209-
/**
210-
* @param string $table
211-
* @param string $columnName
212-
* @param int $index
213-
* @return string
214-
*/
215-
protected function addFileProcessorForField($table, $columnName, $index)
197+
protected function addFileProcessorForField(string $table, string $columnName, int $index): string
216198
{
217199
return <<<EOS
218200
dataProcessing.{$index} = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
@@ -228,13 +210,7 @@ protected function addFileProcessorForField($table, $columnName, $index)
228210
EOS;
229211
}
230212

231-
/**
232-
* @param string $table
233-
* @param string $columnName
234-
* @param int $index
235-
* @return string
236-
*/
237-
protected function addDatabaseQueryProcessorForField($table, $columnName, $index)
213+
protected function addDatabaseQueryProcessorForField(string $table, string $columnName, int $index): string
238214
{
239215
$where = $GLOBALS['TCA'][$table]['columns'][$columnName]['config']['foreign_field'] . '=###uid### AND deleted=0 AND hidden=0';
240216
$markerArray = [
@@ -307,10 +283,7 @@ static function ($key, $value) {
307283
EOS;
308284
}
309285

310-
/**
311-
* @param array $element
312-
*/
313-
protected function addFluidTemplate(array $element)
286+
protected function addFluidTemplate(array $element): void
314287
{
315288
$key = $element['key'];
316289
$templateSubFolder = 'tt_content' === $this->table ? 'Content' : GeneralUtility::underscoredToUpperCamelCase($this->table);

Classes/Aggregate/ExtensionConfigurationAggregate.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ class ExtensionConfigurationAggregate extends AbstractAggregate implements PhpAw
3131

3232
/**
3333
* Own constructor method to ensure that the mask configuration is not changed before export.
34-
*
35-
* @param array $maskConfiguration
3634
*/
3735
public function __construct(array $maskConfiguration, Typo3Version $typo3Version = null)
3836
{
@@ -44,7 +42,7 @@ public function __construct(array $maskConfiguration, Typo3Version $typo3Version
4442
/**
4543
* Adds typical extension files
4644
*/
47-
protected function process()
45+
protected function process(): void
4846
{
4947
$this->addExtEmconf();
5048
$this->addComposerJson();
@@ -55,7 +53,7 @@ protected function process()
5553
/**
5654
* Adds ext_emconf.php file
5755
*/
58-
protected function addExtEmconf()
56+
protected function addExtEmconf(): void
5957
{
6058
$emConfUtility = GeneralUtility::makeInstance(EmConfUtility::class);
6159
$extensionData = [
@@ -94,7 +92,7 @@ protected function addExtEmconf()
9492
/**
9593
* Adds composer.json file
9694
*/
97-
protected function addComposerJson()
95+
protected function addComposerJson(): void
9896
{
9997
$composerData = [
10098
'name' => 'mask/mask',
@@ -132,7 +130,7 @@ protected function addComposerJson()
132130
/**
133131
* Adds ext_icon.png from mask_export extension
134132
*/
135-
protected function addExtIcon()
133+
protected function addExtIcon(): void
136134
{
137135
$this->addPlainTextFile(
138136
'ext_icon.png',
@@ -147,7 +145,7 @@ protected function addExtIcon()
147145
/**
148146
* Adds mask.json configuration file
149147
*/
150-
protected function addMaskConfiguration()
148+
protected function addMaskConfiguration(): void
151149
{
152150
$content = json_encode($this->maskConfiguration, JSON_PRETTY_PRINT);
153151
$this->addPlainTextFile(

Classes/Aggregate/InlineContentCTypeAggregate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class InlineContentCTypeAggregate extends AbstractInlineContentAggregate impleme
2626
/**
2727
* Adds dataProvider for inline content CType restriction
2828
*/
29-
protected function process()
29+
protected function process(): void
3030
{
3131
$inlineFields = $this->getAvailableInlineFields();
3232
if (empty($inlineFields)) {

Classes/Aggregate/InlineContentColPosAggregate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class InlineContentColPosAggregate extends AbstractInlineContentAggregate implem
3232
/**
3333
* Adds dataProvider for inline content colPos name
3434
*/
35-
protected function process()
35+
protected function process(): void
3636
{
3737
$inlineFields = $this->getAvailableInlineFields();
3838
if (empty($inlineFields)) {

0 commit comments

Comments
 (0)