mailpoet
/
vendor-prefixed
/
doctrine
/
persistence
/
src
/
Persistence
/
Reflection
/
RuntimePublicReflectionProperty.php
mailpoet
/
vendor-prefixed
/
doctrine
/
persistence
/
src
/
Persistence
/
Reflection
Last commit date
EnumReflectionProperty.php
9 months ago
RuntimePublicReflectionProperty.php
9 months ago
RuntimeReflectionProperty.php
9 months ago
TypedNoDefaultReflectionProperty.php
9 months ago
TypedNoDefaultReflectionPropertyBase.php
9 months ago
TypedNoDefaultRuntimePublicReflectionProperty.php
9 months ago
index.php
3 years ago
RuntimePublicReflectionProperty.php
28 lines
| 1 | <?php |
| 2 | declare (strict_types=1); |
| 3 | namespace MailPoetVendor\Doctrine\Persistence\Reflection; |
| 4 | if (!defined('ABSPATH')) exit; |
| 5 | use MailPoetVendor\Doctrine\Common\Proxy\Proxy; |
| 6 | use ReflectionProperty; |
| 7 | use ReturnTypeWillChange; |
| 8 | class RuntimePublicReflectionProperty extends ReflectionProperty |
| 9 | { |
| 10 | #[\ReturnTypeWillChange] |
| 11 | public function getValue($object = null) |
| 12 | { |
| 13 | return $object !== null ? ((array) $object)[$this->getName()] ?? null : parent::getValue(); |
| 14 | } |
| 15 | #[\ReturnTypeWillChange] |
| 16 | public function setValue($object, $value = null) |
| 17 | { |
| 18 | if (!($object instanceof Proxy && !$object->__isInitialized())) { |
| 19 | parent::setValue($object, $value); |
| 20 | return; |
| 21 | } |
| 22 | $originalInitializer = $object->__getInitializer(); |
| 23 | $object->__setInitializer(null); |
| 24 | parent::setValue($object, $value); |
| 25 | $object->__setInitializer($originalInitializer); |
| 26 | } |
| 27 | } |
| 28 |