Skip to content

Add download-phar script and run require-checker and normalize as PHARs - #46

Merged
hugo-goncalves-kununu merged 1 commit into
mainfrom
download-phar
Nov 3, 2026
Merged

hugo-goncalves-kununu merged 1 commit into
mainfrom
download-phar

Conversation

@hugo-goncalves-kununu

@hugo-goncalves-kununu hugo-goncalves-kununu commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Description

The objective of this PR is to add a download-phar script that keeps a tool's PHAR on its latest GitHub release, and to use it so that Composer Require Checker and Composer Normalize stop being require-dev dependencies.

As dependencies, their own requirements constrain what a project can install. For example, Composer Require Checker 4.18+ needs symfony/console ^7, which blocks a Symfony 6.4 test leg. Composer Require Checker's upstream also recommends the PHAR.

Details

  • bin/download-phar (new, registered in composer.json bin)
    • Usage: download-phar <tool> <owner/repository> <release-asset> [directory]; the directory defaults to tools, relative to the working directory
    • Reads the latest tag from the releases/latest redirect with a HEAD request (no download, no API rate limit), and downloads the asset only when <tool>.version holds a different tag
    • Downloads to <tool>.phar.tmp and renames, so an interrupted download never replaces a working PHAR
    • Offline with an existing PHAR: warns on STDERR and exits 0; every other failure exits 1
  • composer.json
    • Removes maglnet/composer-require-checker and ergebnis/composer-normalize from require-dev, and the allow-plugins entry
    • Adds the tool:composer-require-checker, tool:composer-normalize, require-checker, normalize-check and normalize-fix scripts; ci uses them
    • Raises vimeo/psalm to ^6.20 and phpunit/phpunit to ^13.4
  • phpunit.xml.dist
    • Migrated configuration (executionOrder="defects")
  • tests/PHPCSFixer/Command/CommandTestCase.php
    • Registers the command with addCommands() instead of addCommand(), which only exists from Symfony Console 7.4
    • The lowest PHPUnit leg never caught it because Composer Require Checker forced Console ^7.4.1; with it gone, lowest installs Console 6.4
  • .github/workflows/continuous-integration.yml
    • Installs composer-require-checker and composer-normalize with setup-php, like the shared backend_code_tools.yml, instead of using require-dev copies
  • .gitignore
    • Ignores /tools/
  • Docs
    • New docs/DownloadPhar/README.md, linked from the README table
    • AGENTS.md and CONTRIBUTING.md describe the PHAR approach (CONTRIBUTING wrongly called these global tools installed via setup-php)

@hugo-goncalves-kununu
hugo-goncalves-kununu force-pushed the download-phar branch 2 times, most recently from f23691d to bb6e993 Compare November 3, 2026 16:41
- bin/download-phar keeps tools/<tool>.phar on the latest GitHub release of a tool
- composer-require-checker and composer-normalize are no longer require-dev dependencies;
  the require-checker and normalize-check scripts download and run their PHARs instead
- CommandTestCase registers commands with addCommands(), as addCommand() needs Symfony Console 7.4
- Raise vimeo/psalm to ^6.20 and phpunit/phpunit to ^13.4, and migrate phpunit.xml.dist

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hugo-goncalves-kununu
hugo-goncalves-kununu marked this pull request as ready for review November 3, 2026 17:24
@hugo-goncalves-kununu
hugo-goncalves-kununu requested a review from a team as a code owner November 3, 2026 17:24
@hugo-goncalves-kununu
hugo-goncalves-kununu merged commit e72aed6 into main Nov 3, 2026
5 checks passed
@hugo-goncalves-kununu
hugo-goncalves-kununu deleted the download-phar branch November 3, 2026 17:24
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