#!/usr/bin/env bash
set -euo pipefail

ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
PHP_BINS=(
  "${PHP74_BIN:-php7.4}"
  "${PHP80_BIN:-php8.0}"
  "${PHP81_BIN:-php8.1}"
  "${PHP82_BIN:-php8.2}"
  "${PHP83_BIN:-php8.3}"
  "${PHP85_BIN:-php}"
)

for php_bin in "${PHP_BINS[@]}"; do
  if command -v "$php_bin" >/dev/null 2>&1; then
    echo "Running release check with $php_bin"
    PHP_BIN="$php_bin" "$ROOT_DIR/tools/check-release.sh"
  else
    echo "Skipping missing PHP binary: $php_bin"
  fi
done
