Skip to content

v0.21.10

Choose a tag to compare

@lkrms lkrms released this 05 Dec 03:46
· 1326 commits to main since this release
v0.21.10
15c93c0

Added

  • Add Str::coalesce()
  • Add Arr::sameValues()
  • Add RecursiveFilesystemIterator::count()
  • Add Builder::unsetB()

Changed

  • In Builder methods, only return a clone if a value is changed
  • Rename ProvidesBuilder interface to Buildable and consolidate extended interfaces, reverting needlessly complicated split
  • Add default implementation of Buildable::getBuilder() to HasBuilder trait and remove boilerplate code from classes that use it
  • Allow assertions in Assert to throw a given exception
  • Clean up and rename Convert::toBoolOrNull() and toIntOrNull() to toBool() and toInt()
  • Clean up Env and adopt Pcre::* methods
  • Tolerate whitespace around boolean and integer values in environment variables
  • Clean up abstract enumeration and dictionary classes

Cli:

  • Add CliOption::$Name
    • Primarily for *_POSITIONAL options, but others can use it too
    • Takes the value of CliOption::$Long if not set explicitly
    • Positional options are not permitted to apply different values to CliOption::$Name and CliOption::$Long
  • Add CliOption::$IsBound
    • true if the option is bound to a variable via constructor parameter $bindTo
    • Prevents propagation of normalised values into the option's scope
  • Add CliOption::$Unique
  • Implement case-insensitive ONE_OF_* value matching

Removed

  • Remove support for extending default and/or environment values via CliOption::$KeepDefault and CliOption::$KeepEnv
  • Remove unused Convert::emptyToNull() method
  • Remove ResolvesBuilder, ReturnsBuilder, ReturnsBuilderService interfaces

Fixed

  • Env: fix issue where negative integers are rejected
  • Cli: add explicit checks for null, '' and [] to prevent issues with "falsey" values like "0"
  • Fix Introspector issues:
    • Detect constructor parameters that have a default value but are not nullable, and throw an exception if null is passed to them, e.g. from a builder
    • Determine minimum number of arguments to pass to a constructor and suppress unnecessary arguments, e.g. so classes can rely on func_num_args() to detect variables passed by reference