Skip to content

feat: Fix PHP client to avoid API mode values to silently fallback to…#250

Merged
Benjamin-Freoua-Alma merged 1 commit into
feature/3.0from
feature/ecom-4030-fix-php-client-to-avoid-api-mode-values-to-silently-fallback
May 15, 2026
Merged

feat: Fix PHP client to avoid API mode values to silently fallback to…#250
Benjamin-Freoua-Alma merged 1 commit into
feature/3.0from
feature/ecom-4030-fix-php-client-to-avoid-api-mode-values-to-silently-fallback

Conversation

@Benjamin-Freoua-Alma
Copy link
Copy Markdown
Member

Reason for change

Linear task

Especially in a case sensitive context where :
mode = 'live' => Prod
mode = 'Live' => Sandbox
=> We should not have silent fallback.
Either a fallback with a warning : "Unknown value, falling back to sandbox"
or no fallback with an exception thrown.

Code changes

  1. Exception thrown instead of silent fallback — the behavior is explicit.

  2. True as the third parameter of in_array — strict comparison (type + case), which strengthens the detection of cases like 'Live' or 'TEST'.

  3. The testInvalidMode test: the old assertion checked for a silent fallback to LIVE_MODE. It now tests that new Environment('INVALID_MODE') correctly throws an InvalidArgumentException with the correct message.

How to test

As a reviewer, you are encouraged to test the PR locally.

Checklist for authors and reviewers

  • The title of the PR uses business wording, not technical jargon, for the changelog readers to understand it
  • The PR implements the changes asked in the referenced task / issue
  • The automated tests are compliant with the testing strategy
  • The tests are relevant, and cover the corner/error cases, not only the happy path
  • You understand the impact of this PR on existing code/features
  • The changes include adequate logging and Datadog traces
  • Documentation is updated (API, developer documentation, ADR, Notion...)

Non applicable

@Benjamin-Freoua-Alma Benjamin-Freoua-Alma merged commit 6c9b34f into feature/3.0 May 15, 2026
7 checks passed
@Benjamin-Freoua-Alma Benjamin-Freoua-Alma deleted the feature/ecom-4030-fix-php-client-to-avoid-api-mode-values-to-silently-fallback branch May 15, 2026 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants