Skip to content
Snippets Groups Projects
Commit 0551c7ea authored by Stefan Bürk's avatar Stefan Bürk
Browse files

[TASK] Avoid implicitly nullable class method parameter

With PHP 8.4 marking method parameter implicitly nullable
is depreacted and will emit a `E_DEPRECATED` warning. One
recommended way to resolve this, is making it explicitly
nullable using the `?` nullable operator. [1]

In cases, where are implicitly nullable parameter exists
before not-nullable parameters in a method or constructor,
making it explicitly nullable will emit a

  Optional parameter <paramname> declared before required
  parameter <paramname> is implicitly treated as a required
  parameter

since PHP 8.0 [2].

This change adds the `?` nullable operator and removes the
null default value for the first parameter, which mitigates
both issues.

This prepares the way towards PHP 8.4 compatibility.

[1] https://php.watch/versions/8.4/implicitly-marking-parameter-type-nullable-deprecated
[2] https://php.watch/versions/8.0/deprecate-required-param-after-optional

Resolves: #103927
Releases: main, 12.4, 11.5
Change-Id: I0ba574769e5b95852379aa30f03d45715aec2055
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/84363


Tested-by: default avatarStefan Bürk <stefan@buerk.tech>
Reviewed-by: default avatarStefan Bürk <stefan@buerk.tech>
Tested-by: default avatarcore-ci <typo3@b13.com>
parent 9ecadecd
Branches
Tags
No related merge requests found
......@@ -50,11 +50,16 @@ class FileStorageIndexingAdditionalFieldProvider implements AdditionalFieldProvi
/**
* Add a select field of available storages.
*
* @param FileStorageIndexingTask $task When editing, reference to the current task object. NULL when adding.
* @param array $taskInfo
* @return array Array containing all the information pertaining to the additional fields
* @param FileStorageIndexingTask|null $task When editing, reference to the current task object. NULL when adding.
* @param array $taskInfo Reference to the array containing the info used in the add/edit form
* @return array{
* code: string,
* label: string,
* cshKey: string,
* cshLabel: string,
* }
*/
protected function getAllStoragesField(FileStorageIndexingTask $task = null, $taskInfo)
protected function getAllStoragesField(?FileStorageIndexingTask $task, array $taskInfo): array
{
/** @var ResourceStorage[] $storages */
$storages = GeneralUtility::makeInstance(StorageRepository::class)->findAll();
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment