#100168Introduce Map data-structure
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) { ... }
- example of
\WeakMapdraw-backs: https://3v4l.org/TSO37#v8.1.16 - example of
\SplObjectStoragedraw-backs withforeach: https://3v4l.org/gloDO#v8.1.16
Reviews 1
History 611
-
Oliver Hader changed tracker
BugTask 03/14/23, 21:11 -
Gerrit Code Review pushed patch set 1 for main to change 78127 status
NewUnder Review 03/14/23, 21:17 -
Oliver Hader changed description status
Under ReviewNew 03/14/23, 21:18 -
Oliver Hader changed status
NewUnder Review 03/14/23, 21:18 -
Gerrit Code Review pushed patch set 2 for main to change 78127 03/14/23, 21:25
-
Gerrit Code Review pushed patch set 3 for main to change 78127 03/14/23, 21:37
-
Gerrit Code Review pushed patch set 4 for main to change 78127 03/14/23, 21:41
-
Gerrit Code Review pushed patch set 5 for main to change 78127 03/14/23, 22:40
-
Oliver Hader changed description 03/14/23, 22:42
-
Oliver Hader commented and changed status
Under ReviewResolved done0 %100 % 03/15/23, 08:55 -
Benni Mack changed status
ResolvedClosed 01/30/24, 09:01
Applied in changeset commit:008a7af094876a8bb1710d8a7503a486b6c1ce3b.