Skip to content

Add enum metadata to hook params#11

Merged
ChiragAgg5k merged 1 commit into
mainfrom
feat-param-enum-metadata
May 21, 2026
Merged

Add enum metadata to hook params#11
ChiragAgg5k merged 1 commit into
mainfrom
feat-param-enum-metadata

Conversation

@ChiragAgg5k
Copy link
Copy Markdown
Member

Summary

  • add optional enum metadata to Hook::param()
  • store enum metadata with hook params for downstream route/platform usage
  • add unit coverage for enum metadata

Tests

  • vendor/bin/phpunit
  • php -d error_reporting=22527 vendor/bin/pint --test src/Servers/Hook.php tests/Servers/Unit/HookTest.php

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 20, 2026

Greptile Summary

This PR adds an optional ?object $enum = null parameter to Hook::param() to carry enum metadata (e.g., name and value map) for downstream route/platform usage.

  • Hook::param() gains a last, nullable $enum parameter that is stored in the params array alongside existing metadata fields β€” fully backward-compatible since it defaults to null and is appended last.
  • A new unit test verifies that a stdClass-based enum object is stored and returned unchanged via getParams().

Confidence Score: 5/5

A small, additive change with no logic alterations and a matching unit test β€” safe to merge.

The new $enum parameter is appended last with a null default, so all existing callers remain unaffected. The value is stored verbatim in the params array without any processing, keeping the change entirely non-breaking. The unit test confirms round-trip storage and retrieval.

No files require special attention.

Important Files Changed

Filename Overview
src/Servers/Hook.php Adds optional ?object $enum = null as the last parameter of param() and stores it in the params array β€” backward-compatible, no logic changes.
tests/Servers/Unit/HookTest.php Adds testParamEnumCanBeSet using a stdClass object to verify the enum metadata is stored and retrievable via getParams().

Reviews (1): Last reviewed commit: "Add enum metadata to hook params" | Re-trigger Greptile

ChiragAgg5k added a commit to utopia-php/platform that referenced this pull request May 20, 2026
Pulls in utopia-php/servers#11 which adds the enum field on Hook params,
so initHttp can forward the Enum DTO through to Route params.
@ChiragAgg5k ChiragAgg5k merged commit 6e9241f into main May 21, 2026
6 checks passed
@ChiragAgg5k ChiragAgg5k deleted the feat-param-enum-metadata branch May 21, 2026 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants