Re: [RFC] Typed Properties

From: Date: Fri, 06 Jul 2018 20:57:26 +0000
Subject: Re: [RFC] Typed Properties
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-102629@lists.php.net to get a copy of this message
Le jeu. 21 juin 2018 à 19:37, Nicolas Grekas <nicolas.grekas+php@gmail..com> a écrit : > if ((new ReflectionReference($array[$key]))->getRefcount() > 2) { /* is >> ref */ } else { /* not a ref */ }, for computing the allowed types you’d >> intersect the types of the ReflectionProperties returned by >> getReferencingProperties(). >> > I just realized that this interface would suffer from a significant drawback: it would trigger COW when iterating over immutable arrays, defeating the shared-memory optimization provided by OPcache. An interface like new ReflectionReference($array, $key) would be free from the issue. Combined with get_defined_vars() and the (array) operator for objects, we can inspect any PHP data structure or scope also this way. Nicolas >

« previous php.internals (#102629) next »