function Yaml::parseFile
Parses a YAML file into a PHP value.
Usage:
$array = Yaml::parseFile('config.yml'); print_r($array);
Parameters
string $filename The path to the YAML file to be parsed:
int-mask-of<self::PARSE_*> $flags A bit field of PARSE_* constants to customize the YAML parser behavior:
Throws
ParseException If the file could not be read or the YAML is not valid
2 calls to Yaml::parseFile()
- DescriptionSniff::process in vendor/
drupal/ coder/ coder_sniffer/ DrupalPractice/ Sniffs/ InfoFiles/ DescriptionSniff.php - Processes this test, when one of its tokens is encountered.
- DrupalAutoloader::register in vendor/
mglaman/ phpstan-drupal/ src/ Drupal/ DrupalAutoloader.php
File
-
vendor/
symfony/ yaml/ Yaml.php, line 52
Class
- Yaml
- Yaml offers convenience methods to load and dump YAML.
Namespace
Symfony\Component\YamlCode
public static function parseFile(string $filename, int $flags = 0) : mixed {
$yaml = new Parser();
return $yaml->parseFile($filename, $flags);
}