Yaml indentation is a part of its structure. That's actually bad

Code
<?php

use Symfony\Component\Yaml\Yaml;

$file1 = 'foo.yml';
$file2 = 'foobroken.yml';

$yml1 = file_get_contents($file1);
$yml2 = file_get_contents($file2);
echo '<h3>Yaml content</h3>';
echo '<h4>with correct indentation</h4>';
echo '<pre>' . $yml1 . '</pre>';
echo '<h4>with missing indentation</h4>';
echo '<pre>' . $yml2 . '</pre>';

echo '<h3>Resulting arrays</h3>';
dump(Yaml::parse($yml1), Yaml::parse($yml2));
Result

Yaml content

with correct indentation

foo:
    bar: value1
    foo: value2

with missing indentation

foo:
bar: value1
foo: value2

Resulting arrays

^ array:1 [
  "foo" => array:2 [
    "bar" => "value1"
    "foo" => "value2"
  ]
]
^ array:2 [
  "foo" => "value2"
  "bar" => "value1"
]
Used Versions
PHP 8.3, Laminas MVC 3.2, Symfony 5.2, Laravel 8.28, PHPUnit 9.5, Doctrine ORM 2.8