From 05e38eadbeb3de19e5b26003c2b401e00bb71df4 Mon Sep 17 00:00:00 2001 From: polo Date: Sun, 18 Oct 2026 00:08:23 +0200 Subject: =?UTF-8?q?sortie=20de=20vendor=20du=20d=C3=A9p=C3=B4t,=20oubli=20?= =?UTF-8?q?dans=20config-template.ini?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../orm/src/Mapping/Driver/AttributeReader.php | 146 --------------------- 1 file changed, 146 deletions(-) delete mode 100644 vendor/doctrine/orm/src/Mapping/Driver/AttributeReader.php (limited to 'vendor/doctrine/orm/src/Mapping/Driver/AttributeReader.php') diff --git a/vendor/doctrine/orm/src/Mapping/Driver/AttributeReader.php b/vendor/doctrine/orm/src/Mapping/Driver/AttributeReader.php deleted file mode 100644 index 2de622a..0000000 --- a/vendor/doctrine/orm/src/Mapping/Driver/AttributeReader.php +++ /dev/null @@ -1,146 +0,0 @@ -, bool> */ - private array $isRepeatableAttribute = []; - - /** - * @psalm-return class-string-map> - * - * @template T of MappingAttribute - */ - public function getClassAttributes(ReflectionClass $class): array - { - return $this->convertToAttributeInstances($class->getAttributes()); - } - - /** - * @return class-string-map> - * - * @template T of MappingAttribute - */ - public function getMethodAttributes(ReflectionMethod $method): array - { - return $this->convertToAttributeInstances($method->getAttributes()); - } - - /** - * @return class-string-map> - * - * @template T of MappingAttribute - */ - public function getPropertyAttributes(ReflectionProperty $property): array - { - return $this->convertToAttributeInstances($property->getAttributes()); - } - - /** - * @param class-string $attributeName The name of the annotation. - * - * @return T|null - * - * @template T of MappingAttribute - */ - public function getPropertyAttribute(ReflectionProperty $property, string $attributeName) - { - if ($this->isRepeatable($attributeName)) { - throw new LogicException(sprintf( - 'The attribute "%s" is repeatable. Call getPropertyAttributeCollection() instead.', - $attributeName, - )); - } - - return $this->getPropertyAttributes($property)[$attributeName] ?? null; - } - - /** - * @param class-string $attributeName The name of the annotation. - * - * @return RepeatableAttributeCollection - * - * @template T of MappingAttribute - */ - public function getPropertyAttributeCollection( - ReflectionProperty $property, - string $attributeName, - ): RepeatableAttributeCollection { - if (! $this->isRepeatable($attributeName)) { - throw new LogicException(sprintf( - 'The attribute "%s" is not repeatable. Call getPropertyAttribute() instead.', - $attributeName, - )); - } - - return $this->getPropertyAttributes($property)[$attributeName] ?? new RepeatableAttributeCollection(); - } - - /** - * @param array $attributes - * - * @return class-string-map> - * - * @template T of MappingAttribute - */ - private function convertToAttributeInstances(array $attributes): array - { - $instances = []; - - foreach ($attributes as $attribute) { - $attributeName = $attribute->getName(); - assert(is_string($attributeName)); - // Make sure we only get Doctrine Attributes - if (! is_subclass_of($attributeName, MappingAttribute::class)) { - continue; - } - - $instance = $attribute->newInstance(); - assert($instance instanceof MappingAttribute); - - if ($this->isRepeatable($attributeName)) { - if (! isset($instances[$attributeName])) { - $instances[$attributeName] = new RepeatableAttributeCollection(); - } - - $collection = $instances[$attributeName]; - assert($collection instanceof RepeatableAttributeCollection); - $collection[] = $instance; - } else { - $instances[$attributeName] = $instance; - } - } - - return $instances; - } - - /** @param class-string $attributeClassName */ - private function isRepeatable(string $attributeClassName): bool - { - if (isset($this->isRepeatableAttribute[$attributeClassName])) { - return $this->isRepeatableAttribute[$attributeClassName]; - } - - $reflectionClass = new ReflectionClass($attributeClassName); - $attribute = $reflectionClass->getAttributes()[0]->newInstance(); - - return $this->isRepeatableAttribute[$attributeClassName] = ($attribute->flags & Attribute::IS_REPEATABLE) > 0; - } -} -- cgit v1.2.3