Problem
The wiki, reports, and tests workflows currently assume PHP 8.3 as a fixed baseline. Wiki and reports install PHP 8.3 explicitly before running Composer and dev-tools commands, while the tests workflow always includes 8.3 in its matrix.
Consumer repositories can require PHP 8.4+ or newer in composer.json or composer.lock, which can make composer install fail or make the test matrix run impossible jobs below the package's declared minimum platform.
Current Behavior
.github/workflows/wiki.yml and .github/workflows/reports.yml use a hard-coded PHP version:
.github/workflows/tests.yml uses a hard-coded matrix:
php-version: [ '8.3', '8.4', '8.5' ]
The packaged workflow stubs call these reusable workflows, so downstream repositories inherit the same behavior.
Expected Behavior
Wiki and reports workflows should infer the PHP version required by the consumer repository before running shivammathur/setup-php, Composer install, and dev-tools commands.
The tests workflow should infer the package's minimum supported PHP minor version and build its matrix from that minimum upward. For example, a package requiring php: ^8.4 should test 8.4 and newer supported minors, but not 8.3.
When the PHP version cannot be inferred safely, workflows should fall back to 8.3 to preserve current behavior.
Failure Surface
.github/workflows/wiki.yml
.github/workflows/reports.yml
.github/workflows/tests.yml
resources/github-actions/wiki.yml
resources/github-actions/reports.yml
resources/github-actions/tests.yml
- Consumer repositories with
composer.json or composer.lock declaring PHP 8.4+ or newer
Proposal
Add a reusable PHP version resolution step or script for GitHub Actions workflows. The resolver should inspect the checked-out repository and expose outputs consumed by shivammathur/setup-php and the test matrix.
The resolver should consider, in priority order:
composer.lock platform PHP version when present and versioned.
composer.json config.platform.php when present.
composer.json require.php constraints when they imply a minimum supported PHP minor version.
- Fallback to
8.3 when no reliable version can be inferred.
For test matrices, the resolver should produce a JSON matrix that starts at the inferred minimum and includes known supported PHP minors for this repository's CI policy.
Requirements
- The inferred version must be logged in workflow output.
- Wiki and reports must use the inferred version for Composer installation and command execution.
- Tests must not include PHP versions lower than the inferred minimum supported version.
- The implementation must support at least constraints that imply PHP
8.3, 8.4, or 8.5.
- Invalid or unsupported constraints must fall back to
8.3 with a clear warning.
- Consumer workflow stubs should not need to duplicate the inference logic.
Non-goals
- Building a complete Composer constraint solver in shell.
- Changing package PHP constraints.
- Replacing
shivammathur/setup-php.
- Expanding the maximum PHP version beyond the repository's supported CI policy in this issue.
Acceptance Criteria
Functional Criteria
Regression Criteria
Architectural / Isolation Criteria
Problem
The wiki, reports, and tests workflows currently assume PHP
8.3as a fixed baseline. Wiki and reports install PHP8.3explicitly before running Composer and dev-tools commands, while the tests workflow always includes8.3in its matrix.Consumer repositories can require PHP
8.4+or newer incomposer.jsonorcomposer.lock, which can makecomposer installfail or make the test matrix run impossible jobs below the package's declared minimum platform.Current Behavior
.github/workflows/wiki.ymland.github/workflows/reports.ymluse a hard-coded PHP version:.github/workflows/tests.ymluses a hard-coded matrix:The packaged workflow stubs call these reusable workflows, so downstream repositories inherit the same behavior.
Expected Behavior
Wiki and reports workflows should infer the PHP version required by the consumer repository before running
shivammathur/setup-php, Composer install, and dev-tools commands.The tests workflow should infer the package's minimum supported PHP minor version and build its matrix from that minimum upward. For example, a package requiring
php: ^8.4should test8.4and newer supported minors, but not8.3.When the PHP version cannot be inferred safely, workflows should fall back to
8.3to preserve current behavior.Failure Surface
.github/workflows/wiki.yml.github/workflows/reports.yml.github/workflows/tests.ymlresources/github-actions/wiki.ymlresources/github-actions/reports.ymlresources/github-actions/tests.ymlcomposer.jsonorcomposer.lockdeclaring PHP8.4+or newerProposal
Add a reusable PHP version resolution step or script for GitHub Actions workflows. The resolver should inspect the checked-out repository and expose outputs consumed by
shivammathur/setup-phpand the test matrix.The resolver should consider, in priority order:
composer.lockplatform PHP version when present and versioned.composer.jsonconfig.platform.phpwhen present.composer.jsonrequire.phpconstraints when they imply a minimum supported PHP minor version.8.3when no reliable version can be inferred.For test matrices, the resolver should produce a JSON matrix that starts at the inferred minimum and includes known supported PHP minors for this repository's CI policy.
Requirements
8.3,8.4, or8.5.8.3with a clear warning.Non-goals
shivammathur/setup-php.Acceptance Criteria
Functional Criteria
8.3.8.3.composer.jsonrequiringphp: ^8.4runs reports/wiki setup with PHP8.4or newer-compatible configured version.composer.jsonrequiringphp: ^8.4does not include PHP8.3in the test matrix.composer.jsonrequiringphp: >=8.5runs reports/wiki setup with PHP8.5or newer-compatible configured version.composer.jsonrequiringphp: >=8.5does not include PHP8.3or8.4in the test matrix.config.platform.phpuses that platform PHP version when no lock platform value overrides it.8.3and the current default test matrix behavior.Regression Criteria
8.4+requirements continue to run with PHP8.3by default.Architectural / Isolation Criteria