Project

General

Profile

Actions

Task #100168

closed

Introduce Map data-structure

Added by Oliver Hader over 1 year ago. Updated 10 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2023-03-14
Due date:
% Done:

100%

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

Description

Unfortunately PHP emphasizes "weak" over "map" in their new PHP 8
data-structure \WeakMap. As a result it cannot be passed to other
functions that would enrich an existing \WeakMap - since objects
created in that function scope would not exist outside and thus
directly trigger garbage collection of \WeakMap.

As a substitute, \TYPO3\CMS\Core\Type\Map is introduce with has a
similar behavior and got an additional Map::fromEntries() factory.

Example:

$map = new \TYPO3\CMS\Core\Type\Map();
$key = new \stdClass();
$value = new \stdClass();
$map[$key] = $value;

foreach ($map as $key => $value) { ... }
Actions

Also available in: Atom PDF