Summary
Add a Compiler::validate() public method that runs the full analysis pipeline without generating code or writing files, returning an AnalysisResult directly.
Context
Currently, the analysis pipeline only runs as part of compile(). Users cannot ask "is my container valid?" without writing a compilation artefact. The --dry-run flag on the CLI comes close but still runs the full compilation; isStale() runs a subset.
A standalone validate() method would allow CI-level assurance without side effects, and could power a --validate CLI flag.
Implementation notes
Compiler::validate(Container|string $container): AnalysisResult - accepts a Container instance or bootstrap file path
- Reuses the existing
DefinitionAnalyser::analyse() path
AnalysisResult already has hasErrors(), errors, and warnings properties
- Consider adding
hasWarnings() to AnalysisResult for parity with hasErrors()
- The distinction between warnings (non-fatal) and errors (fatal at compile-time) should be clearly documented
Target
6.1+ minor release
Summary
Add a
Compiler::validate()public method that runs the full analysis pipeline without generating code or writing files, returning anAnalysisResultdirectly.Context
Currently, the analysis pipeline only runs as part of
compile(). Users cannot ask "is my container valid?" without writing a compilation artefact. The--dry-runflag on the CLI comes close but still runs the full compilation;isStale()runs a subset.A standalone
validate()method would allow CI-level assurance without side effects, and could power a--validateCLI flag.Implementation notes
Compiler::validate(Container|string $container): AnalysisResult- accepts a Container instance or bootstrap file pathDefinitionAnalyser::analyse()pathAnalysisResultalready hashasErrors(),errors, andwarningspropertieshasWarnings()toAnalysisResultfor parity withhasErrors()Target
6.1+ minor release