Plugin: backport PHP 8 syntax to PHP 7.4 (hc-eff)

The central history server work introduced four PHP 8.0+ syntax sites in
the plugin codebase. The main plugin file's "Requires PHP: 7.4" header
was already there; the code had silently drifted past that bound.

- includes/class-att-hc-session.php:244 — str_starts_with($host, 'www.')
  → substr($host, 0, 4) === 'www.'.
- includes/class-att-hc-api.php:52 — self::request(…, requires_auth: false)
  → positional false. Same default semantics, same callee signature.
- includes/admin-page.php:165 and class-att-hc-session.php:126 —
  list_healthchecks(…, include_steps: …, limit: …) → positional. Same
  values, no semantic change.

Verified by linting all 16 plugin files against PHP 7.4.33 — no syntax
errors, no residual PHP 8+ patterns (str_starts_with/contains/ends_with,
nullsafe, enum, readonly, mixed/never, constructor promotion, match).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-30 09:29:22 +01:00
parent 3c6220e64b
commit 3c64dd8125
4 changed files with 5 additions and 4 deletions

View File

@@ -123,7 +123,7 @@ final class ATT_HC_Session {
}
try {
$response = ATT_HC_Api::list_healthchecks($site_key, include_steps: true, limit: 10);
$response = ATT_HC_Api::list_healthchecks($site_key, true, 10);
} catch (ATT_HC_Api_Exception $e) {
return null;
}
@@ -241,7 +241,7 @@ final class ATT_HC_Session {
public static function normalise_site_url(string $url): string {
$host = parse_url($url, PHP_URL_HOST) ?: $url;
$host = strtolower($host);
if (str_starts_with($host, 'www.')) $host = substr($host, 4);
if (substr($host, 0, 4) === 'www.') $host = substr($host, 4);
$path = parse_url($url, PHP_URL_PATH) ?: '';
$path = rtrim($path, '/');
return $host . $path;