From 1efbf2683f909ab197cf8d3452f40d613f8b4dad Mon Sep 17 00:00:00 2001 From: djordy Date: Wed, 8 Jan 2025 00:24:20 +0100 Subject: [PATCH] Revert "document generic arrays" This reverts commit 6417521afb8ddbeeaebd9604aa860b8a179f16b1. --- config/services.xml | 4 -- src/TypeDescriber/ArrayDescriber.php | 61 ----------------------- src/TypeDescriber/DictionaryDescriber.php | 1 - src/TypeDescriber/ListDescriber.php | 1 - 4 files changed, 67 deletions(-) delete mode 100644 src/TypeDescriber/ArrayDescriber.php diff --git a/config/services.xml b/config/services.xml index 6232ad049..5dc8457f6 100644 --- a/config/services.xml +++ b/config/services.xml @@ -169,10 +169,6 @@ - - - - diff --git a/src/TypeDescriber/ArrayDescriber.php b/src/TypeDescriber/ArrayDescriber.php deleted file mode 100644 index 1eb6e8245..000000000 --- a/src/TypeDescriber/ArrayDescriber.php +++ /dev/null @@ -1,61 +0,0 @@ - - * - * @experimental - * - * @internal - */ -final class ArrayDescriber implements TypeDescriberInterface, TypeDescriberAwareInterface -{ - use TypeDescriberAwareTrait; - - public function describe(Type $type, Schema $schema, array $context = []): void - { - if (!$type->getCollectionKeyType() instanceof Type\CompositeTypeInterface) { - return; - } - - $collections = array_map( - fn (Type $keyType): CollectionType => TypeFactoryTrait::collection($type->getWrappedType(), $type->getCollectionValueType(), $keyType), - $type->getCollectionKeyType()->getTypes(), - ); - - if ($type->getCollectionKeyType() instanceof Type\UnionType) { - $describeType = Type::union(...$collections); - } - - if ($type->getCollectionKeyType() instanceof Type\IntersectionType) { - $describeType = Type::intersection(...$collections); - } - - if (!isset($describeType)) { - return; - } - - $this->describer->describe($describeType, $schema, $context); - } - - public function supports(Type $type, array $context = []): bool - { - return $type instanceof CollectionType - && $type->getCollectionKeyType() instanceof Type\CompositeTypeInterface; - } -} diff --git a/src/TypeDescriber/DictionaryDescriber.php b/src/TypeDescriber/DictionaryDescriber.php index cc63ed06c..5d6c5de9e 100644 --- a/src/TypeDescriber/DictionaryDescriber.php +++ b/src/TypeDescriber/DictionaryDescriber.php @@ -40,7 +40,6 @@ public function describe(Type $type, Schema $schema, array $context = []): void public function supports(Type $type, array $context = []): bool { return $type instanceof CollectionType - && false === $type->getCollectionKeyType() instanceof Type\UnionType && $type->getCollectionKeyType()->isIdentifiedBy(TypeIdentifier::STRING); } } diff --git a/src/TypeDescriber/ListDescriber.php b/src/TypeDescriber/ListDescriber.php index 74a94fb7e..d697e6982 100644 --- a/src/TypeDescriber/ListDescriber.php +++ b/src/TypeDescriber/ListDescriber.php @@ -40,7 +40,6 @@ public function describe(Type $type, Schema $schema, array $context = []): void public function supports(Type $type, array $context = []): bool { return $type instanceof CollectionType - && false === $type->getCollectionKeyType() instanceof Type\UnionType && $type->getCollectionKeyType()->isIdentifiedBy(TypeIdentifier::INT); } }