76c01e44df
對齊 A v3.2.0。型別強制會把隱式轉換變成 TypeError,所以一次全檔加入 並跑完整測試(unit 451 / integration 398 全綠,無迴歸)。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TbG1keQQ7XBa7qMQY16KCY
40 lines
1.2 KiB
PHP
40 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* Contract for a single migration phase (Strategy pattern).
|
|
*
|
|
* @package TMDO
|
|
* @since 3.0.1
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit;
|
|
}
|
|
|
|
/**
|
|
* Contract for a single migration phase (Strategy pattern).
|
|
*
|
|
* Each phase is idempotent — re-entering returns ok if the desired state is
|
|
* already achieved. The orchestrator never calls execute() on a phase that
|
|
* has already returned 'ok'; it only re-enters on 'in_progress'.
|
|
*/
|
|
interface TMDO_Migration_Phase_Interface {
|
|
|
|
/** Short slug matching the PHASES constant entry (e.g. 'backfill_bulk'). */
|
|
public function name(): string;
|
|
|
|
/**
|
|
* Run the phase.
|
|
*
|
|
* @param array $job Job array passed by reference — phase may append log
|
|
* lines and update metrics fields.
|
|
* @return array{status: 'ok'|'in_progress'|'done', message?: string}
|
|
* 'ok' — phase finished, advance to next.
|
|
* 'in_progress' — phase needs another tick (e.g. 24h window).
|
|
* 'done' — terminal phase completed (completed phase only).
|
|
* @throws \RuntimeException On unrecoverable failure; orchestrator catches.
|
|
*/
|
|
public function execute( array &$job ): array;
|
|
}
|