Task #100168
closedIntroduce Map data-structure
100%
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
\WeakMap
draw-backs: https://3v4l.org/TSO37#v8.1.16 - example of
\SplObjectStorage
draw-backs withforeach
: https://3v4l.org/gloDO#v8.1.16
Updated by Gerrit Code Review over 1 year 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/+/78127
Updated by Oliver Hader over 1 year ago
- Description updated (diff)
- Status changed from Under Review to New
Updated by Gerrit Code Review over 1 year 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/+/78127
Updated by Gerrit Code Review over 1 year 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/+/78127
Updated by Gerrit Code Review over 1 year 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/+/78127
Updated by Gerrit Code Review over 1 year 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/+/78127
Updated by Oliver Hader over 1 year ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 008a7af094876a8bb1710d8a7503a486b6c1ce3b.