Skip to content

fix(php): fix boolean clientDefault quoting and inline path param type handling#15468

Open
Swimburger wants to merge 2 commits intomainfrom
devin/1777327953-fix-php-client-default-booleans
Open

fix(php): fix boolean clientDefault quoting and inline path param type handling#15468
Swimburger wants to merge 2 commits intomainfrom
devin/1777327953-fix-php-client-default-booleans

Conversation

@Swimburger
Copy link
Copy Markdown
Member

@Swimburger Swimburger commented Apr 27, 2026

Description

Follow-up to #15465. Fixes two edge-case bugs in the PHP SDK generator's clientDefault support identified by code review.

Changes Made

  • RootClientGenerator.ts: Added getClientDefaultPhpLiteral() helper that returns properly formatted PHP literals — single-quoted strings for string values, bare true/false for boolean values. Previously, boolean clientDefault values were incorrectly wrapped in quotes (e.g., $param ??= 'true' instead of $param ??= true), causing a PHP type mismatch when the parameter is typed as ?bool.

  • WrappedEndpointRequestGenerator.ts: Removed the php.Type.optional() wrapping for inline path parameters with clientDefault. The DataClass constructor (line 62-63 of DataClass.ts) uses ?? null for optional-typed fields, which discards the clientDefault initializer. Keeping the non-optional type preserves the initializer via ?? <initializer> (line 64-66).

  • Changelog: Added generators/php/sdk/changes/unreleased/fix-client-default-boolean-quoting.yml

  • Updated README.md generator (if applicable) — N/A

Testing

  • Seed test passes: pnpm seed test --generator php-sdk --fixture x-fern-default --skip-scripts --local
  • TypeScript compilation passes: pnpm turbo run compile --filter @fern-api/php-sdk
  • Biome formatting passes: pnpm check:biome
  • No snapshot changes (the x-fern-default fixture only uses string clientDefaults, so these edge-case fixes don't affect its output)

Link to Devin session: https://app.devin.ai/sessions/302ae462e00f48019f81795e34b6937a
Requested by: @Swimburger


Open in Devin Review

Swimburger and others added 2 commits April 27, 2026 22:18
…e handling

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration
Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@github-actions
Copy link
Copy Markdown
Contributor

SDK Generation Benchmark Results

Comparing PR branch against median of 5 nightly run(s) on main (latest: 2026-04-23T04:59:11Z).

Full benchmark table (click to expand)
Generator Spec main (generator) main (E2E) PR (generator) Delta
php-sdk square 43s (n=5) 66s (n=5) 40s -3s (-7.0%)

main (generator): generator-only time via --skip-scripts (includes Docker image build, container startup, IR parsing, and code generation — this is the same Docker-based flow customers use via fern generate). main (E2E): full customer-observable time including build/test scripts (nightly baseline, informational). Delta is computed against generator-only baseline.
⚠️ = generation exited with a non-zero exit code (timing may not reflect a successful run).
Baseline from nightly runs on main (latest: 2026-04-23T04:59:11Z). Trigger benchmark-baseline to refresh.
Last updated: 2026-04-27 22:24 UTC

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 4 additional findings.

Open in Devin Review

@Swimburger
Copy link
Copy Markdown
Member Author

Is this still necessary?

@devin-ai-integration
Copy link
Copy Markdown
Contributor

Devin is archived and cannot be woken up. Please unarchive Devin if you want to continue using it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant