feat(modules): harden module platform with event constants, validation checks, and CLI improvements

- Add ModuleEvents constants class with all 8 event strings; update dispatch call sites
- ValidateCommand: check AuthorizationPolicy container registration (check 20)
- ValidateCommand: warn on unknown event_listeners keys (check 21)
- make:module --simple flag for minimal manifests
- module:deactivate reverse-dependency warning
- 12 new PHPUnit tests covering all improvements

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-14 08:23:04 +02:00
parent 143d887a5c
commit b1a907b79c
10 changed files with 604 additions and 24 deletions

View File

@@ -0,0 +1,42 @@
<?php
declare(strict_types=1);
namespace MintyPHP\App\Module;
/**
* Central registry of all module event names dispatched by core.
*
* Modules reference these constants in their event_listeners manifest declarations
* and in listener implementations. ValidateCommand warns on unknown event names.
*/
final class ModuleEvents
{
public const USER_LOGIN = 'user.login';
public const USER_LOGOUT = 'user.logout';
public const USER_CREATED = 'user.created';
public const USER_DELETED = 'user.deleted';
public const USER_ACTIVATED = 'user.activated';
public const USER_DEACTIVATED = 'user.deactivated';
public const USER_ASSIGNMENT_CHANGED = 'user.assignment_changed';
public const SCHEDULER_JOB_FAILED = 'scheduler.job_failed';
/** @return list<string> */
public static function all(): array
{
return [
self::USER_LOGIN,
self::USER_LOGOUT,
self::USER_CREATED,
self::USER_DELETED,
self::USER_ACTIVATED,
self::USER_DEACTIVATED,
self::USER_ASSIGNMENT_CHANGED,
self::SCHEDULER_JOB_FAILED,
];
}
private function __construct()
{
}
}