Files
wpdev 76c01e44df refactor: 全部 128 個生產檔加入 declare(strict_types=1)(PR-H)
對齊 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
2026-07-31 06:13:33 +08:00

56 lines
1.2 KiB
PHP

<?php
/**
* Migration phase: terminal phase marking the job as successfully completed.
*
* @package TMDO
* @since 3.0.1
*/
declare(strict_types=1);
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Terminal phase — marks the job as successfully completed.
*
* Returns 'done' (instead of 'ok') so tick() knows to release the lock and
* flush the attention cache without scheduling another tick.
*/
class TMDO_Phase_Completed extends TMDO_Migration_Phase_Base {
/**
* Returns the phase slug.
*
* @return string
*/
public function name(): string {
return 'completed';
}
/**
* Executes the phase.
*
* @param array $job Job array (by reference).
* @return array{status: 'done'}
*/
public function execute( array &$job ): array {
$job['state'] = 'completed';
$job['completed_at'] = time();
$job['overall_progress'] = 100;
$this->log(
$job,
sprintf(
'✅ Migration complete — ratio %s → %s (-%.0f%%)',
$job['metrics']['ratio_start'],
$job['metrics']['ratio_now'],
( $job['metrics']['ratio_start'] - $job['metrics']['ratio_now'] ) / max( $job['metrics']['ratio_start'], 0.01 ) * 100
)
);
return array( 'status' => 'done' );
}
}