Skip to content

charcoal-config 0.9.0

Compare
Choose a tag to compare
@mcaskill mcaskill released this 24 May 20:55
· 20 commits to master since this release

Key Features

PSR-11

Replaced container-interop/container-interop with psr/container, as per official deprecation.
AbstractConfig now implements Psr\Container\ContainerInterface.

File Loader Mixin

Added FileAwareInterface and FileAwareTrait to decouple configuration file loading from AbstractConfig, and implemented by.

Changed INI/JSON/PHP/YAML loader methods to throw UnexpectedValueException instead of InvalidArgumentException

Unit Tests

The tests were completely rewritten to take advantage of PHPUnit 5.7+ and provide clearer cases, focused assertions, and greater coverage of features.


What's new in 0.9.0?

Added

  • offsetReplace() method to decouple data replacement in AbstractConfig::merge() method:
    AbstractConfig::offsetReplace(string $key, mixed $value) : void
  • FileAwareInterface and FileAwareTrait mixin to decouple file loading from AbstractConfig
  • Documentation directory for extended information and examples on this component's features
  • AbstractTestCase, AssertionsTrait, and FixturesTrait, as the basis for the component's test cases

Changed

  • Breaking: Replace deprecated container-interop/container-interop with psr/container, implemented by AbstractConfig
  • Breaking: ConfigInterface and AbstractConfig now implement FileAwareInterface and FileAwareTrait, respectively
  • Breaking: ::loadIniFile(), ::loadJsonFile(), ::loadPhpFile(), and ::loadYamlFile() methods to throw UnexpectedValueException
  • Breaking: Rewrite all unit tests and file and directory structure of tests
  • ConfigurableTrait::config() method to accept a custom fallback value if specified key does not exist:
    ConfigurableTrait::config(string $key, mixed $default = null) : mixed
  • Rewrite ::loadJsonFile() method to use json_last_error_msg() function
  • Rewrite ::loadPhpFile() method to catch potential exceptions and throwables
  • Rewrite ::loadYamlFile() method to catch potential exceptions from Symfony's YAML parser
  • Rewrite class, method, and property comments
  • Rewrite README and moved details to docs/ directory
  • Cleanup repository; Composer manifest, development dependencies, configs for Travis, PHPUnit, PHPCS, and CircleCI
  • Cleanup codebase; syntax, indentation, error messages, organization of methods

Fixed

  • Issues reported by PHPStan, PHPCS, and PHPUnit
  • Support for CircleCI
  • Support for subsets in AbstractEntity::data() method:
    AbstractEntity::data(array $keys = null) : array
  • Add edge cases for setData() and data() methods of AbstractEntity
  • Improve existing edge cases in ArrayAccess methods
  • Support for assignments to non-nested keys in SeparatorAwareTrait::setWithSeparator() method