refactor(audit): decouple API audit classes from core via interfaces

Core code (lib/) no longer imports any MintyPHP\Module\Audit\* classes directly.
New ApiAuditServiceInterface and ApiSystemAuditReporterInterface follow the
existing pattern (interface + null implementation in core, concrete binding
from module registrar). DoctorRunner and helpers/app.php now resolve through
DI interfaces, ensuring the audit module remains fully optional.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-13 19:19:17 +02:00
parent 4967095bb8
commit a17c2c7cea
11 changed files with 101 additions and 16 deletions

View File

@@ -41,24 +41,16 @@ function setAppContainer(\MintyPHP\App\AppContainer $container): void
);
\MintyPHP\Http\ApiBootstrap::configure(
$container->has(\MintyPHP\Module\Audit\Service\ApiAuditService::class)
? static fn () => $container->get(\MintyPHP\Module\Audit\Service\ApiAuditService::class)
: null,
static fn (): \MintyPHP\Service\Audit\ApiAuditServiceInterface => $container->get(\MintyPHP\Service\Audit\ApiAuditServiceInterface::class),
static fn (): \MintyPHP\Service\Settings\SettingsApiPolicyGateway => $container->get(\MintyPHP\Service\Settings\SettingsApiPolicyGateway::class),
static fn (): \MintyPHP\Service\Security\RateLimiterService => $container->get(\MintyPHP\Service\Security\RateLimiterService::class),
$container->has(\MintyPHP\Module\Audit\Http\ApiSystemAuditReporter::class)
? static fn () => $container->get(\MintyPHP\Module\Audit\Http\ApiSystemAuditReporter::class)
: null
static fn (): \MintyPHP\Service\Audit\ApiSystemAuditReporterInterface => $container->get(\MintyPHP\Service\Audit\ApiSystemAuditReporterInterface::class)
);
\MintyPHP\Http\ApiResponse::configure(
$container->has(\MintyPHP\Module\Audit\Service\ApiAuditService::class)
? static fn () => $container->get(\MintyPHP\Module\Audit\Service\ApiAuditService::class)
: null,
static fn (): \MintyPHP\Service\Audit\ApiAuditServiceInterface => $container->get(\MintyPHP\Service\Audit\ApiAuditServiceInterface::class),
static fn (): \MintyPHP\Service\Access\AuthorizationService => $container->get(\MintyPHP\Service\Access\AuthorizationService::class),
$container->has(\MintyPHP\Module\Audit\Http\ApiSystemAuditReporter::class)
? static fn () => $container->get(\MintyPHP\Module\Audit\Http\ApiSystemAuditReporter::class)
: null
static fn (): \MintyPHP\Service\Audit\ApiSystemAuditReporterInterface => $container->get(\MintyPHP\Service\Audit\ApiSystemAuditReporterInterface::class)
);
\MintyPHP\Support\Guard::configure(