Skip to content

Commit

Permalink
[TASK] Raise PHPstan level to 7
Browse files Browse the repository at this point in the history
  • Loading branch information
linawolf committed May 4, 2024
1 parent 77ae600 commit 46f4963
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Build/phpstan/phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ includes:

parameters:
phpVersion: 80200
level: 6
level: 7

bootstrapFiles:
- phpstan-typo3-constants.php
Expand Down
27 changes: 14 additions & 13 deletions Classes/ContextMenu/HelloWorldItemProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,22 @@ public function addItems(array $items): array
// renders an item based on the configuration from $this->itemsConfiguration
$localItems = $this->prepareItems($this->itemsConfiguration);

if (isset($items['info'])) {
//finds a position of the item after which 'hello' item should be added
$position = array_search('info', array_keys($items), true);

//slices array into two parts
$beginning = array_slice($items, 0, $position + 1, true);
$end = array_slice($items, $position, null, true);
if (!isset($items['info'])) {
// pass items to the next provider
return $items + $localItems;
}
//finds a position of the item after which 'hello' item should be added
$position = array_search('info', array_keys($items), true);

// adds custom item in the correct position
$items = $beginning + $localItems + $end;
} else {
$items = $items + $localItems;
if ($position === false) {
return $items + $localItems;
}
//passes array of items to the next item provider
return $items;
//slices array into two parts
$beginning = array_slice($items, 0, $position + 1, true);
$end = array_slice($items, $position, null, true);

// adds custom item in the correct position
return $beginning + $localItems + $end;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Classes/DataProcessing/CustomCategoryProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class CustomCategoryProcessor implements DataProcessorInterface
* @param array<string, mixed> $contentObjectConfiguration The configuration of Content Object
* @param array<string, mixed> $processorConfiguration The configuration of this processor
* @param array<string, mixed> $processedData Key/value store of processed data (e.g. to be passed to a Fluid View)
* @return array<string, mixed> the processed data as key/value store
* @return array<mixed> the processed data as key/value store
*/
public function process(
ContentObjectRenderer $cObj,
Expand Down

0 comments on commit 46f4963

Please sign in to comment.