#98091[T3DD22] Cleanup: Refactor and simplify array access
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.']
- content based values
- potentially faulty extension configurations
- values from flexform fields
- anything that might not come from a core extension