| Conditions | 3 |
| Paths | 4 |
| Total Lines | 16 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | function config($path = false, $file_name = "config.yml") { |
||
| 28 | $path = ($path) ? : getcwd(); |
||
| 29 | |||
| 30 | $config = []; |
||
| 31 | |||
| 32 | if(file_exists($path . "/" . $file_name)) { |
||
| 33 | /** |
||
| 34 | * Get file from path command is run in |
||
| 35 | */ |
||
| 36 | $config_yaml = file_get_contents($path . "/" . $file_name); |
||
| 37 | |||
| 38 | $config = \Symfony\Component\Yaml\Yaml::parse($config_yaml); |
||
| 39 | } |
||
| 40 | |||
| 41 | return $config; |
||
| 42 | } |
||
| 43 | } |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.