PackageBoundaryValidator
Enforces {@see PackageBoundaryRule} by asking where each referenced class actually lives. Reads the `use` statements of every scanned file, resolves each imported class to the file that defines it, and reads the owning package out of that path. A class under `vendor/milpa/live-web/src/...` belongs to `milpa/live-web` no matter what namespace it declares — which is the whole point, since in this family the namespace is shared and the package is not. **A class that cannot be resolved is reported, never skipped.** Silence there would make the check strongest exactly when it is least able to see: a typo, an uninstalled package or a stale autoloader would empty the evidence and the rule would pass for having found nothing to object to. Unresolved entries surface as their own finding so the reader knows the difference between "no * violations" and "no answers".
PackageBoundaryValidator::__construct()
public function __construct(?callable $locate = null):Parameters
| Name | Type | Description |
|---|---|---|
| $locate | (callable(string): ?string | null) | resolves a class name to the file defining it. Defaults to reflection, which needs the class to be autoloadable — true in any host whose vendor tree is installed, and the seam every test uses instead of building one |
PackageBoundaryValidator::validate()
public function validate(array $rules, string $root): arrayRuns every rule against a tree and reports each one separately. One result per rule rather than a merged verdict: rules protect different boundaries, and a single pass/fail would hide which one broke behind a number.
Parameters
| Name | Type | Description |
|---|---|---|
| $rules | list<PackageBoundaryRule> | |
| $root | string |