summaryrefslogtreecommitdiff
path: root/vendor/doctrine/orm/src/Mapping/ReflectionReadonlyProperty.php
diff options
context:
space:
mode:
authorpolo <ordipolo@gmx.fr>2026-10-18 00:08:23 +0200
committerpolo <ordipolo@gmx.fr>2026-10-18 00:10:03 +0200
commit05e38eadbeb3de19e5b26003c2b401e00bb71df4 (patch)
treecf48350b69cfce92de6f3a0e03eb0876931c7077 /vendor/doctrine/orm/src/Mapping/ReflectionReadonlyProperty.php
parent32843e50aa981f190bdb4fbc9adbeacc06fdf775 (diff)
downloadAppliGestionPHP-05e38eadbeb3de19e5b26003c2b401e00bb71df4.tar.gz
AppliGestionPHP-05e38eadbeb3de19e5b26003c2b401e00bb71df4.tar.bz2
AppliGestionPHP-05e38eadbeb3de19e5b26003c2b401e00bb71df4.zip
sortie de vendor du dépôt, oubli dans config-template.ini
Diffstat (limited to 'vendor/doctrine/orm/src/Mapping/ReflectionReadonlyProperty.php')
-rw-r--r--vendor/doctrine/orm/src/Mapping/ReflectionReadonlyProperty.php49
1 files changed, 0 insertions, 49 deletions
diff --git a/vendor/doctrine/orm/src/Mapping/ReflectionReadonlyProperty.php b/vendor/doctrine/orm/src/Mapping/ReflectionReadonlyProperty.php
deleted file mode 100644
index 13e9f6d..0000000
--- a/vendor/doctrine/orm/src/Mapping/ReflectionReadonlyProperty.php
+++ /dev/null
@@ -1,49 +0,0 @@
1<?php
2
3declare(strict_types=1);
4
5namespace Doctrine\ORM\Mapping;
6
7use InvalidArgumentException;
8use LogicException;
9use ReflectionProperty;
10
11use function assert;
12use function func_get_args;
13use function func_num_args;
14use function is_object;
15use function sprintf;
16
17/** @internal */
18final class ReflectionReadonlyProperty extends ReflectionProperty
19{
20 public function __construct(
21 private readonly ReflectionProperty $wrappedProperty,
22 ) {
23 if (! $wrappedProperty->isReadOnly()) {
24 throw new InvalidArgumentException('Given property is not readonly.');
25 }
26
27 parent::__construct($wrappedProperty->class, $wrappedProperty->name);
28 }
29
30 public function getValue(object|null $object = null): mixed
31 {
32 return $this->wrappedProperty->getValue(...func_get_args());
33 }
34
35 public function setValue(mixed $objectOrValue, mixed $value = null): void
36 {
37 if (func_num_args() < 2 || $objectOrValue === null || ! $this->isInitialized($objectOrValue)) {
38 $this->wrappedProperty->setValue(...func_get_args());
39
40 return;
41 }
42
43 assert(is_object($objectOrValue));
44
45 if (parent::getValue($objectOrValue) !== $value) {
46 throw new LogicException(sprintf('Attempting to change readonly property %s::$%s.', $this->class, $this->name));
47 }
48 }
49}