reflectClass()->getAttribute(ContextField::class); foreach($reflector->reflectProperties() as $property) { $field = $property->getAttribute(ContextField::class); if ($field && ! $field->object->hidden ) { $types = $property->getTypes(); $fields[] = [ 'name' => $property->name, 'description' => $field->object->description, 'type' => $field->object->type ?? $types, 'allowNulls' => $property->allowsNull(), 'regexPattern' => $field->object->regexFormat ?? null, 'minLength' => $field->object->minLength ?? null, 'maxLength' => $field->object->maxLength ?? null, 'example' => $field->object->example ?? null, 'values' => $this->generateExampleValues($types), ]; } } $list[$formName] = [ 'className' => $reflector->reflectClass()->getClassName(), 'description' => $context->object->description ?? null, 'fields' => $fields, ]; } return $list; } protected function generateExampleValues(array $types) : string|array { $values = []; foreach($types as $type) { if ( enum_exists($type->type) ) { $values = array_merge($values, array_map(fn($e) => $e->value, $type->type::cases())); } } return $values; } }