Skip to content

fix: deduplicate PHP version and profiler lists#1026

Merged
Soner (shyim) merged 1 commit into
nextfrom
fix/deduplicate-php-profiler-lists
May 18, 2026
Merged

fix: deduplicate PHP version and profiler lists#1026
Soner (shyim) merged 1 commit into
nextfrom
fix/deduplicate-php-profiler-lists

Conversation

@shyim

Copy link
Copy Markdown
Member

Problem

PHP version and profiler lists were duplicated across 3 files:

  • internal/packagist/php_constraint.go: SupportedPHPVersions (canonical)
  • internal/devtui/tab_config.go: hardcoded phpVersions and profilers lists
  • internal/devtui/setup_guide.go: hardcoded profilerChoices list

Adding a new PHP version or profiler required updating multiple places with inconsistent sentinel values (empty string vs none).

Changes

New canonical source: internal/docker/

  • Added profiler constants (ProfilerBlackfire, ProfilerTideways, ProfilerXdebug, ProfilerPcov, ProfilerSpx)
  • Added Profilers list (canonical, empty string = no profiler)
  • Added ProfilerNeedsCredentials() helper

Updated consumers

  • tab_config.go: Now references packagist.SupportedPHPVersions and dockerpkg.Profilers instead of hardcoded lists. Aliases profilerBlackfire/profilerTideways now point to dockerpkg constants.
  • setup_guide.go: profilerChoices now built from dockerpkg.Profiler* constants. profilerNeedsCreds() delegates to dockerpkg.ProfilerNeedsCredentials().

Single source of truth

Data Location
PHP versions packagist.SupportedPHPVersions
Profiler names docker.Profilers
Profiler constants docker.ProfilerBlackfire, etc.
Profiler credential check docker.ProfilerNeedsCredentials()

Related: Issues #5 and #6 in CODE_IMPROVEMENTS.md

@shyim Soner (shyim) force-pushed the fix/deduplicate-php-profiler-lists branch from 74c9356 to 1c7f69c Compare May 18, 2026 04:05
@shyim Soner (shyim) marked this pull request as ready for review May 18, 2026 04:05
@shyim Soner (shyim) force-pushed the fix/deduplicate-php-profiler-lists branch 2 times, most recently from ca13554 to 40da87f Compare May 18, 2026 04:09
- Move profiler constants (ProfilerBlackfire, ProfilerTideways, etc.)
  and Profilers list to internal/docker where they belong (Docker dev env concern)
- Add docker.ProfilerNeedsCredentials() replacing duplicate logic in setup_guide.go
- Remove wrapper profilerNeedsCreds() from setup_guide.go, callers now
  use dockerpkg.ProfilerNeedsCredentials() directly
- Replace hardcoded phpVersions list in tab_config.go with
  packagist.SupportedPHPVersions (single source of truth)
- Replace hardcoded profilers list in tab_config.go with dockerpkg.Profilers
- Replace hardcoded profilerChoices in setup_guide.go with constants from
  dockerpkg ("none" kept as UI display label, maps to "" in config)
- Move TestProfilerNeedsCredentials from devtui to docker/compose_test.go
  where it belongs (testing docker package's own function)
@shyim Soner (shyim) force-pushed the fix/deduplicate-php-profiler-lists branch from 40da87f to e743041 Compare May 18, 2026 04:10
@shyim Soner (shyim) merged commit 2b297f4 into next May 18, 2026
2 checks passed
@shyim Soner (shyim) deleted the fix/deduplicate-php-profiler-lists branch May 18, 2026 04:15
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.

1 participant