Project

General

Profile

Task #100168

Updated by Oliver Hader about 1 year ago

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: 

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

 foreach ($map as $key => $value) { ... } 
 </pre> 

 Example of @\WeakMap@ draw-backs: https://3v4l.org/TSO37#v8.1.16

Back