hassankhan / config

Config is a lightweight configuration file loader that supports PHP, INI, XML, JSON, and YAML files
MIT License
971 stars 136 forks source link

Fix ParserInterface implementations #120

Closed equinoxmatt closed 5 years ago

equinoxmatt commented 5 years ago

All the parsers (except ini) were not compliant with the ParserInterface. Most of them returned array|null, rather than array defined in the interface. Rather than fixing the parsers, (array) casts were being used in the consuming code (Config).

This PR:

equinoxmatt commented 5 years ago

It would probably be better to use array casting instead of ternary operators in all parsers. It would be cleaner and only one line instead of two.

So code will be:

return (array) $this->parse($data, $filename);

@filips123 I have addressed your comments now 👍

filips123 commented 5 years ago

Thanks!