Project

General

Profile

Actions

Task #98091

open

[T3DD22] Cleanup: Refactor and simplify array access

Added by Tizian Schmidlin almost 2 years ago. Updated 4 months ago.

Status:
Under Review
Priority:
Should have
Assignee:
-
Category:
Code Cleanup
Target version:
-
Start date:
2022-08-05
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
12
PHP Version:
8.1
Tags:
Complexity:
Sprint Focus:

Description

The core is littered with "useless" statements, checking if a variable that maybe is not initialized is an array, like this:

if (is_array($var['key']) && is_array($var['key']['subKey']) {
    foreach ($var['key']['subKey'] as $v) {
        // ...
    }
}

This can, if the source of the variable is trustworthy, be simpified:

foreach ($var['key']['subKey'] ?? [] as $v) {
    // ...
}
Trustworthy sources might be:
  • signed functions or methods
  • methods that are not properly signed, but internally enforce the advocated return type
  • typoscript arrays with a dot-index (e.g. $conf['includeCss.']
Untrustworthy sources might be:
  • content based values
  • potentially faulty extension configurations
  • values from flexform fields
  • anything that might not come from a core extension
Actions #1

Updated by Gerrit Code Review almost 2 years ago

  • Status changed from New to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75381

Actions #2

Updated by Gerrit Code Review almost 2 years ago

Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75381

Actions #3

Updated by Gerrit Code Review almost 2 years ago

Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75381

Actions #4

Updated by Gerrit Code Review almost 2 years ago

Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75381

Actions #5

Updated by Gerrit Code Review almost 2 years ago

Patch set 5 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75381

Actions #6

Updated by Gerrit Code Review almost 2 years ago

Patch set 6 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75381

Actions #7

Updated by Gerrit Code Review over 1 year ago

Patch set 7 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75381

Actions #8

Updated by Gerrit Code Review over 1 year ago

Patch set 8 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75381

Actions #9

Updated by Gerrit Code Review over 1 year ago

Patch set 9 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75381

Actions #10

Updated by Gerrit Code Review 4 months ago

Patch set 10 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75381

Actions #11

Updated by Gerrit Code Review 4 months ago

Patch set 11 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75381

Actions #12

Updated by Gerrit Code Review 4 months ago

Patch set 12 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75381

Actions

Also available in: Atom PDF