feat(wpmc S2): make Plugin::boot() idempotent
Add private \$booted flag; guard skips all re-registration on subsequent calls. TDD: RED (3x boot -> expectAdded->once() fails) then GREEN. Drop deprecated setAccessible() call (no-op since PHP 8.1). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@ namespace WPMultiCity;
|
||||
final class Plugin
|
||||
{
|
||||
private static ?Plugin $instance = null;
|
||||
private bool $booted = false;
|
||||
|
||||
public static function instance(): Plugin
|
||||
{
|
||||
@@ -36,6 +37,11 @@ final class Plugin
|
||||
|
||||
public function boot(): void
|
||||
{
|
||||
if ($this->booted) {
|
||||
return;
|
||||
}
|
||||
$this->booted = true;
|
||||
|
||||
if (!$this->dependencies_satisfied()) {
|
||||
add_action('admin_notices', [$this, 'render_dependency_notice']);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user