-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmago.toml
More file actions
95 lines (84 loc) · 3.78 KB
/
Copy pathmago.toml
File metadata and controls
95 lines (84 loc) · 3.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
extends = "vendor/webware/webware-tools/mago.toml"
php-version = "8.4.1"
[linter]
baseline = "lint-baseline.toml"
[analyzer]
baseline = "analysis-baseline.toml"
unchecked-exceptions = ['Psl\Type\Exception\ExceptionInterface']
# ---------------------------------------------------------------------------
# Guard rules — Http boundary (Phase 2) and MessageBus classes.
#
# Structural rules describe the POST-move layout (naming + interfaces) so that
# a class landing in the wrong namespace or with the wrong name is flagged
# during the move. The perimeter restriction enforces that PSR HTTP server
# contracts (MiddlewareInterface / RequestHandlerInterface) are usable ONLY
# from the Http\ namespace (plus tests) — so `mago guard` is RED until Phase 2
# relocates the current Middleware\ / RequestHandler\ / Admin\RequestHandler\
# classes under Http\, then GREEN once they land.
#
# Commands and their handlers stay in the domain they act on (Command\,
# CommandHandler\) — they are NOT centralized under MessageBus\ and are not
# moved.
#
# Phase 3 (TASK-004 c/d): `Repository\*` will be restricted to handlers, their
# factories, the root Webware\UserManager namespace (ConfigProvider DI wiring),
# Admin\Dashboard (widget aggregation), and tests — enforced via a `perimeter`
# restriction once the read boundary is migrated.
# ---------------------------------------------------------------------------
[guard]
mode = "default"
# Http\Middleware\ — PSR middleware (non-admin)
[[guard.structural.rules]]
on = "Webware\\UserManager\\Http\\Middleware\\*"
target = "class"
must-be-named = "*Middleware"
must-implement = "Psr\\Http\\Server\\MiddlewareInterface"
reason = "HTTP middleware must live in Http\\Middleware and be named *Middleware."
# Http\Admin\Middleware\ — admin PSR middleware
[[guard.structural.rules]]
on = "Webware\\UserManager\\Http\\Admin\\Middleware\\*"
target = "class"
must-be-named = "*Middleware"
must-implement = "Psr\\Http\\Server\\MiddlewareInterface"
reason = "Admin HTTP middleware must live in Http\\Admin\\Middleware and be named *Middleware."
# Http\RequestHandler\ — PSR request handlers (non-admin)
[[guard.structural.rules]]
on = "Webware\\UserManager\\Http\\RequestHandler\\*"
target = "class"
must-be-named = "*Handler"
must-implement = "Psr\\Http\\Server\\RequestHandlerInterface"
reason = "Request handlers must live in Http\\RequestHandler and be named *Handler."
# Http\Admin\RequestHandler\ — admin PSR request handlers
[[guard.structural.rules]]
on = "Webware\\UserManager\\Http\\Admin\\RequestHandler\\*"
target = "class"
must-be-named = "*Handler"
must-implement = "Psr\\Http\\Server\\RequestHandlerInterface"
reason = "Admin request handlers must live in Http\\Admin\\RequestHandler and be named *Handler."
# Command\ — domain commands
[[guard.structural.rules]]
on = "Webware\\UserManager\\Command\\*"
target = "class"
must-be-named = "*Command"
must-implement = "Webware\\MessageBus\\Command\\NamedCommandInterface"
reason = "Commands live in Command\\ and must implement NamedCommandInterface."
# CommandHandler\ — domain command handlers
[[guard.structural.rules]]
on = "Webware\\UserManager\\CommandHandler\\*"
target = "class"
must-be-named = "*Handler"
must-implement = "Webware\\MessageBus\\CommandHandlerInterface"
reason = "Command handlers live in CommandHandler\\ and must implement CommandHandlerInterface."
# Psr\Http\Server\** — PSR middleware/request-handler contracts are usable only
# from the Http\ namespace (plus tests). Flags the pre-move classes in
# Middleware\ / RequestHandler\ / Admin\RequestHandler\ until Phase 2 relocates
# them under Http\.
[[guard.perimeter.restrictions]]
dependency = "Psr\\Http\\Server\\**"
allow-from = [
"Webware\\UserManager\\Http\\**",
"WebwareTest\\UserManager\\**",
]
[source]
paths = ["src", "test"]
includes = ["vendor"]