Issues (13)

src/Parser/YamlParser.php (1 issue)

1
<?php
2
3
namespace SimpleDIC\Parser;
4
5
use Symfony\Component\Yaml\Yaml;
6
7
class YamlParser implements ParserInterface
8
{
9
    /**
10
     * @param string $filename
11
     *
12
     * @return array
13
     * @throws \Exception
14
     */
15
    public function parse($filename)
16
    {
17
        if (false === class_exists(Yaml::class)) {
18
            throw new \Exception('YAML class was not found, you must install it. Run "composer require symfony/yaml"');
19
        }
20
21
        return Yaml::parseFile($filename);
0 ignored issues
show
Bug Best Practice introduced by
The expression return Symfony\Component...l::parseFile($filename) also could return the type Symfony\Component\Yaml\Tag\TaggedValue|string which is incompatible with the documented return type array.
Loading history...
22
    }
23
}
24