How symfony/yaml works
Symfony’s Yaml component is a PHP library for loading YAML into PHP values and dumping PHP values as YAML. Its main workflow is parse input through the public Yaml API, with Parser handling block structure and Inline handling inline values; the reverse path uses Dumper. The lint command adds file discovery, parsing, and optional JSON Schema validation. The graph includes parser state, escaping, tagged values, schema support, and exceptions. Some internal calls are inferred only from the SOURCE INDEX references; unsampled details are not expanded.
Main entry points: Parser.php Block parser · Inline.php Inline parser · SchemaValidator.php Schema validator · LintCommand.php YAML lint command
Components 17
Parsing
- Yaml API
Yaml.php - Block parser
Parser.php - Inline parser
Inline.php - Parser state
ParserState.php - Unescaper
Unescaper.php
Validation and linting
- YAML lint command
Command/LintCommand.php - File schema resolver
Schema/FileHeaderSchemaResolver.php - Resolver contract
Schema/SchemaResolverInterface.php - Schema validator
Schema/SchemaValidator.php - Validator contract
Schema/SchemaValidatorInterface.php
Shared types
- Tagged value
Tag/TaggedValue.php - Parse exception
Exception/ParseException.php - Runtime exception
Exception/RuntimeException.php - Logic exception
Exception/LogicException.php - Exception contract
Exception/ExceptionInterface.php
Connections 22
- Yaml API → Block parser: delegates parsing
Yaml.php - Yaml API → Dumper: delegates dumping
Yaml.php - Block parser → Inline parser: parses inline values
Parser.php - Block parser → Parser state: tracks parse state
Parser.php - Block parser → Tagged value: creates tagged values
Parser.php - Block parser → Parse exception: throws parse errors
Parser.php - Inline parser → Parser state: tracks parse state
Inline.php - Inline parser → Tagged value: creates tagged values
Inline.php - Inline parser → Parse exception: throws parse errors
Inline.php - Inline parser → Unescaper: uses unescaping
Inline.php - Dumper → Inline parser: formats inline values
Dumper.php - Dumper → Tagged value: handles tagged values
Dumper.php - YAML lint command → Block parser: parses YAML files
Command/LintCommand.php - YAML lint command → File schema resolver: resolves schemas
Command/LintCommand.php - YAML lint command → Schema validator: validates parsed data
Command/LintCommand.php - File schema resolver → Resolver contract: implements
Schema/FileHeaderSchemaResolver.php - Schema validator → Validator contract: implements
Schema/SchemaValidator.php - Schema validator → Runtime exception: raises validation errors
Schema/SchemaValidator.php - Schema validator → Logic exception: raises support errors
Schema/SchemaValidator.php - Parse exception → Runtime exception: extends
Exception/ParseException.php - Runtime exception → Exception contract: implements
Exception/RuntimeException.php - Logic exception → Exception contract: implements
Exception/LogicException.php