Parsing a Yaml string to array

Code
<?php

use Symfony\Component\Yaml\Parser;

$file __DIR__ '/foo.yml';

$str file_get_contents($file);
echo 
'<pre>' $str '</pre>' PHP_EOL;

$yml = new Parser();
dump($yml->parse($str));
Result
foo:
    bar: ["value1","value2","value3"]
    baz: "foobarbaz"
^ array:1 [
  "foo" => array:2 [
    "bar" => array:3 [
      0 => "value1"
      1 => "value2"
      2 => "value3"
    ]
    "baz" => "foobarbaz"
  ]
]