Chore: Test covering edge case of same-name param and resource#237
Chore: Test covering edge case of same-name param and resource#237
Conversation
Greptile SummaryThis PR adds a new test Confidence Score: 5/5Safe to merge — only test code added, no production changes. All findings are P2 style suggestions (class naming and static state cleanup). The new test is logically correct: params and injects are stored in separate arrays and resolved into a positionally-indexed arguments array, so the same-name collision is properly avoided. No production code was changed. No files require special attention. Important Files Changed
Reviews (1): Last reviewed commit: "Add test covering edge case of same-name..." | Re-trigger Greptile |
| class Locale | ||
| { | ||
| public string $name = 'en'; | ||
| } |
There was a problem hiding this comment.
Generic helper class name may collide
Locale is a very common class name. Defining it in the Utopia\Http namespace at file scope means any future addition of a real Locale class to this namespace (or a test file included alongside this one) would cause a fatal "Cannot redeclare class" error. Naming it something test-specific (e.g. TestLocale or LocaleStub) eliminates the risk at no cost.
| class Locale | |
| { | |
| public string $name = 'en'; | |
| } | |
| class TestLocale | |
| { | |
| public string $name = 'en'; | |
| } |
You would also need to update the container registration and the action's type hint accordingly:
$this->container->set('locale', fn () => new TestLocale());
// ...
->action(function (string $localeParam, TestLocale $localeResource) {
No description provided.