fix(ticket): flatten TicketRepository traits to PSR-4-visible paths
TicketRepository fatalled on /user/tickets/ with "Trait AKSRT\Ticket\TicketQuery not found". src/ classes load only via Composer PSR-4 (AKSRT\ => src/) — there is no bootstrap require list for them — so the autoloader resolved the traits by namespace to src/Ticket/TicketQuery.php and src/Ticket/TicketStatus.php. Both files actually sat in src/Ticket/TicketRepository-traits/, one level deeper, and were therefore invisible: PHP hit the `use` statement with no trait declared and died the moment the repository compiled. The nested directory name imitated the old inc/classes/**/*-traits/ layout, which only worked because inc/bootstrap.php carried an explicit require_once for every one of those files. No such mechanism exists under src/. Move both traits up to sit flat as siblings of the class that uses them — the same shape as GlobalControllerPart1, ModerationPart1 and the rest of src/. No code changes inside the traits; their namespace was already correct. Add tools/audit-psr4-paths.php, which checks every symbol under src/ against the path Composer maps it to and exits 1 on mismatch. It flags this exact layout, so the nesting cannot come back unnoticed. Document it in CLAUDE.md next to the existing admin-contract audit. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
dbb7de41e9
commit
ffd8d7d1b7
4 files changed
+78
No files matched your search
File renamed without changes.
@@ -133,6 +133,8 @@ final class TicketRepository {
|
||||
|
||||
/* ------------------------------------------------------------------ *
|
||||
* 状态机(对外入口,内部规则在 TicketStatus trait)
|
||||
*
|
||||
* Trait 必须与宿主类同级平铺:PSR-4 按命名空间寻址,不解析子目录。
|
||||
* ------------------------------------------------------------------ */
|
||||
|
||||
/**
|
||||
|
||||
File renamed without changes.
Reference in new issue
Block a user