![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mautic.corals.io/vendor/doctrine/orm/src/Mapping/ |
<?php declare(strict_types=1); namespace Doctrine\ORM\Mapping; use InvalidArgumentException; use LogicException; use ReflectionProperty; use function assert; use function func_get_args; use function func_num_args; use function is_object; use function sprintf; /** @internal */ final class ReflectionReadonlyProperty extends ReflectionProperty { public function __construct( private ReflectionProperty $wrappedProperty ) { if (! $wrappedProperty->isReadOnly()) { throw new InvalidArgumentException('Given property is not readonly.'); } parent::__construct($wrappedProperty->class, $wrappedProperty->name); } public function getValue(?object $object = null): mixed { return $this->wrappedProperty->getValue(...func_get_args()); } public function setValue(mixed $objectOrValue, mixed $value = null): void { if (func_num_args() < 2 || $objectOrValue === null || ! $this->isInitialized($objectOrValue)) { $this->wrappedProperty->setValue(...func_get_args()); return; } assert(is_object($objectOrValue)); if (parent::getValue($objectOrValue) !== $value) { throw new LogicException(sprintf('Attempting to change readonly property %s::$%s.', $this->class, $this->name)); } } }