Skip to content

Commit 6e4178f

Browse files
authored
Fix type error in default PHP migration by narrowing version to native-supported set (#3561)
1 parent e538a41 commit 6e4178f

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

apps/cli/migrations/06-install-bundled-default-php.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import fs from 'node:fs';
22
import path from 'node:path';
33
import { DEFAULT_PHP_VERSION } from '@studio/common/constants';
4-
import { getConfiguredPhpBinaryVersion } from '@studio/common/lib/php-binary-metadata';
4+
import {
5+
getConfiguredPhpBinaryVersion,
6+
resolveNativePhpVersion,
7+
} from '@studio/common/lib/php-binary-metadata';
58
import { getPhpBinaryPath } from 'cli/lib/dependency-management/paths';
69
import type { Migration } from '@studio/common/lib/migration';
710

@@ -14,7 +17,8 @@ function getBundledPhpBinaryRoot(): string {
1417
}
1518

1619
function getDefaultPhpPatchVersion(): string {
17-
return getConfiguredPhpBinaryVersion( DEFAULT_PHP_VERSION ) ?? DEFAULT_PHP_VERSION;
20+
const nativeVersion = resolveNativePhpVersion( DEFAULT_PHP_VERSION );
21+
return getConfiguredPhpBinaryVersion( nativeVersion ) ?? nativeVersion;
1822
}
1923

2024
function getBundledDefaultPhpDir(): string {

apps/cli/migrations/tests/06-install-bundled-default-php.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ import fs from 'fs';
22
import os from 'os';
33
import path from 'path';
44
import { DEFAULT_PHP_VERSION } from '@studio/common/constants';
5-
import { getConfiguredPhpBinaryVersion } from '@studio/common/lib/php-binary-metadata';
5+
import {
6+
getConfiguredPhpBinaryVersion,
7+
resolveNativePhpVersion,
8+
} from '@studio/common/lib/php-binary-metadata';
69
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
710
import { installBundledDefaultPhp } from 'cli/migrations/06-install-bundled-default-php';
811

@@ -14,7 +17,7 @@ function getBinaryName(): string {
1417
}
1518

1619
function getDefaultPhpPatchVersion(): string {
17-
return getConfiguredPhpBinaryVersion( DEFAULT_PHP_VERSION )!;
20+
return getConfiguredPhpBinaryVersion( resolveNativePhpVersion( DEFAULT_PHP_VERSION ) )!;
1821
}
1922

2023
function getBundledDefaultPhpDir(): string {

0 commit comments

Comments
 (0)