Skip to content

fix(php): emit standalone LICENSE file for custom licenses#17102

Open
adidavid014 wants to merge 2 commits into
mainfrom
adidavid/se-82-php-generator-license-file
Open

fix(php): emit standalone LICENSE file for custom licenses#17102
adidavid014 wants to merge 2 commits into
mainfrom
adidavid/se-82-php-generator-license-file

Conversation

@adidavid014

@adidavid014 adidavid014 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Description

Linear ticket: Closes SE-82

The Fern PHP generator's PhpProject never emitted a standalone LICENSE file — it only set the license field in composer.json. GitHub's license detection and most compliance scanners key off the standalone LICENSE file, so any Fern PHP SDK (e.g. Brevo's getbrevo/brevo-php, issue #143) showed no detected license.

This is a parity gap: the Go, TypeScript, Python, and Java generators each copy the license file mounted at /tmp/LICENSE into the output repo root. PHP never got that method — it was an unimplemented feature, not a deliberate decision.

Changes Made

  • Added a writeLicenseFile() method to PhpProject (called at the end of persist()), modeled on GoProject.writeLicenseFile — the closest architectural analog (same AbstractProject base and this.context.config.license / this.absolutePathToOutputDirectory / this.context.logger members).
    • Only acts on custom license configs, matching Go/TS/Java/C# behavior (SPDX basic licenses like MIT still go into composer.json; custom ones get the copied file).
    • Copies /tmp/LICENSE<output>/<filename> (default LICENSE).
    • Gracefully no-ops with a debug log on ENOENT (expected in remote/Fiddle generation) and warns on other errors — preserving backwards compatibility.
  • Added a 2.13.3 fix changelog entry to generators/php/sdk/versions.yml.
  • Updated README.md generator (if applicable) — N/A

This makes it a config-only fix for all customers going forward: add license: { custom: ./LICENSE } to the PHP github: block, exactly like the other generators.

Testing

  • Unit tests added/updated — N/A. The reference generators (go-v2, csharp) have neither a unit test nor a seed fixture that exercises the file copy; seed never mounts /tmp/LICENSE, so even csharp's custom-license fixture output contains no LICENSE file. Adding one would give false coverage.
  • Manual testing completed — pnpm turbo run compile --filter @fern-api/php-base passes (13/13 tasks).

Generated with Claude Code


Open in Devin Review

The PHP generator previously only set the `license` field in
composer.json and never wrote a standalone LICENSE file, so GitHub
license detection and compliance scanners reported no license. Add a
`writeLicenseFile` method to PhpProject that copies the mounted
/tmp/LICENSE into the output repo root when a custom license is
configured, bringing PHP to parity with the TypeScript, Python, Java,
and Go generators.

Co-Authored-By: Claude <noreply@anthropic.com>
@adidavid014
adidavid014 requested a review from Swimburger as a code owner July 16, 2026 14:34
@adidavid014 adidavid014 self-assigned this Jul 16, 2026

@nitpickybot nitpickybot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

AI Review Summary

Adds a standalone LICENSE file emission to the PHP generator, mirroring the Go generator. Logic is sound and the error handling is reasonable. One issue: the changelog date is set to 2026, which is likely a typo.

  • 🟡 1 warning(s)

scanners reported no license. This brings the PHP generator to parity with the
TypeScript, Python, Java, and Go generators.
type: fix
createdAt: "2026-07-16"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 warning

createdAt: "2026-07-16" — unless you've got a time machine, this should probably be 2025.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

lol

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

Copy link
Copy Markdown
Contributor

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 bugs or issues to report.

Open in Devin Review

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

SDK Generation Benchmark Results

Comparing PR branch against median of 5 nightly run(s) on main (latest: 2026-07-16T05:00:50Z).

Full benchmark table (click to expand)
Generator Spec main (generator) main (E2E) PR (generator) Delta
php-sdk square 60s (n=5) 83s (n=5) 51s -9s (-15.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-07-16T05:00:50Z). Trigger benchmark-baseline to refresh.
Last updated: 2026-07-16 16:39 UTC

Co-Authored-By: Claude <noreply@anthropic.com>
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