diff options
Diffstat (limited to 'vendor/doctrine/orm/src/Mapping/ArrayAccessImplementation.php')
-rw-r--r-- | vendor/doctrine/orm/src/Mapping/ArrayAccessImplementation.php | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/vendor/doctrine/orm/src/Mapping/ArrayAccessImplementation.php b/vendor/doctrine/orm/src/Mapping/ArrayAccessImplementation.php new file mode 100644 index 0000000..3fd0988 --- /dev/null +++ b/vendor/doctrine/orm/src/Mapping/ArrayAccessImplementation.php | |||
@@ -0,0 +1,70 @@ | |||
1 | <?php | ||
2 | |||
3 | declare(strict_types=1); | ||
4 | |||
5 | namespace Doctrine\ORM\Mapping; | ||
6 | |||
7 | use Doctrine\Deprecations\Deprecation; | ||
8 | use InvalidArgumentException; | ||
9 | |||
10 | use function property_exists; | ||
11 | |||
12 | /** @internal */ | ||
13 | trait ArrayAccessImplementation | ||
14 | { | ||
15 | /** @param string $offset */ | ||
16 | public function offsetExists(mixed $offset): bool | ||
17 | { | ||
18 | Deprecation::trigger( | ||
19 | 'doctrine/orm', | ||
20 | 'https://github.com/doctrine/orm/pull/11211', | ||
21 | 'Using ArrayAccess on %s is deprecated and will not be possible in Doctrine ORM 4.0. Use the corresponding property instead.', | ||
22 | static::class, | ||
23 | ); | ||
24 | |||
25 | return isset($this->$offset); | ||
26 | } | ||
27 | |||
28 | /** @param string $offset */ | ||
29 | public function offsetGet(mixed $offset): mixed | ||
30 | { | ||
31 | Deprecation::trigger( | ||
32 | 'doctrine/orm', | ||
33 | 'https://github.com/doctrine/orm/pull/11211', | ||
34 | 'Using ArrayAccess on %s is deprecated and will not be possible in Doctrine ORM 4.0. Use the corresponding property instead.', | ||
35 | static::class, | ||
36 | ); | ||
37 | |||
38 | if (! property_exists($this, $offset)) { | ||
39 | throw new InvalidArgumentException('Undefined property: ' . $offset); | ||
40 | } | ||
41 | |||
42 | return $this->$offset; | ||
43 | } | ||
44 | |||
45 | /** @param string $offset */ | ||
46 | public function offsetSet(mixed $offset, mixed $value): void | ||
47 | { | ||
48 | Deprecation::trigger( | ||
49 | 'doctrine/orm', | ||
50 | 'https://github.com/doctrine/orm/pull/11211', | ||
51 | 'Using ArrayAccess on %s is deprecated and will not be possible in Doctrine ORM 4.0. Use the corresponding property instead.', | ||
52 | static::class, | ||
53 | ); | ||
54 | |||
55 | $this->$offset = $value; | ||
56 | } | ||
57 | |||
58 | /** @param string $offset */ | ||
59 | public function offsetUnset(mixed $offset): void | ||
60 | { | ||
61 | Deprecation::trigger( | ||
62 | 'doctrine/orm', | ||
63 | 'https://github.com/doctrine/orm/pull/11211', | ||
64 | 'Using ArrayAccess on %s is deprecated and will not be possible in Doctrine ORM 4.0. Use the corresponding property instead.', | ||
65 | static::class, | ||
66 | ); | ||
67 | |||
68 | $this->$offset = null; | ||
69 | } | ||
70 | } | ||