Skip to content

Releases: salient-labs/toolkit

v0.21.10

05 Dec 03:46
v0.21.10
15c93c0

Choose a tag to compare

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

v0.21.9

30 Nov 02:24
v0.21.9
b9b98e5

Choose a tag to compare

Added

  • Add ICollection::empty()
  • Add Arr::of(), Arr::isListOf()

Changed

  • Rename:
    • Arr::listOfArrayKey() -> Arr::isListOfArrayKey()
    • Arr::listOfInt() -> Arr::isListOfInt()
    • Arr::listOfString() -> Arr::isListOfString()

Deprecated

  • Deprecate Test::isArrayOf() (replaced with Arr::of())

Fixed

  • Cli: fix issue where empty default values are displayed in help messages
  • Cli: remove escapes from horizontal whitespace to fix issue where help written as Markdown wraps weirdly when rendered

v0.21.8

29 Nov 03:10
v0.21.8
c61f3ce

Choose a tag to compare

Added

  • Add HttpHeaders and IHttpHeaders
  • Add IAccessToken and implement its methods in AccessToken
  • Add Jsonable
  • Add Arr::lower(), Arr::upper(), Arr::toIndex()
  • Add File::write(), File::seek(), File::tell()
  • Add Pcre::grep()

Changed

  • ICollection:

    • Allow callbacks to receive item keys, values or both
    • Limit TKey to array-key, removing hypothetical support for arbitrary key types but allowing implementation of Arrayable etc.
    • Implement Arrayable, Jsonable, JsonSerializable
    • In ICollection::merge(), accept Arrayable|iterable instead of static|iterable
  • Move parts of TCollection to a separate TReadableCollection trait

  • Move Lkrms\Support\Http -> Lkrms\Http

  • Move Lkrms\Support\Catalog\Http* -> Lkrms\Http\Catalog

  • Move Lkrms\Auth -> Lkrms\Http\Auth

  • Add HttpHeaderGroup and clean up existing Http enumerations

  • Rename HttpRequestMethods -> HttpRequestMethodGroup

  • Rename Curler::addPrivateHeaderName() -> addSensitiveHeaderName()

  • Replace CurlerHeaders and friends with HttpHeaders and friends

  • Replace ICurlerHeaders calls with IHttpHeaders equivalents:

    • getHeaders() -> getLines()
    • getHeaderValue() -> getHeaderLine()
    • getHeaderValues() -> getHeaderLines()
  • In File::close(), make $filename optional and rename it to $uri

  • In File::writeCsv(), use php://temp instead of php://memory for temporary output

  • Rename Regex::NOT_ESCAPED -> Regex::BEFORE_UNESCAPED

  • Make FilesystemErrorException (and most other exceptions) extend RuntimeException instead of Exception

Removed

  • Remove superseded ICurlerHeaders, CurlerHeaders, CurlerHeadersFlag, CurlerHeader
  • Remove unused FluentArray class
  • Remove $private arguments from Curler::addHeader() and Curler::setHeader()
  • Remove support for filtering headers by pattern in Curler::unsetHeader()
  • Remove $value parameter from ICollection::unset()

Fixed

  • Fix issue where File::getStreamUri() fails for streams with no URI

v0.21.7

23 Nov 13:06
v0.21.7
c3ce2f0

Choose a tag to compare

Added

  • Add Arr::extend()
  • Sync: add SyncProvider::pipelineFrom() and pipelineTo() to simplify creation of entity pipelines that satisfy static analysis

Changed

  • In Cache::get(), return null instead of false when an item has expired or doesn't exist
  • In OAuth2Client, extend the scope of the most recently issued token if possible
  • Make OAuth2Client::flushTokens() and OAuth2Client::getIdToken() public
  • Move OAuth2Flow from Auth\Catalog to Auth namespace

Deprecated

  • Deprecate SyncProvider::pipeline() and callbackPipeline()

Fixed

  • Fix OAuth 2.0 issue where explicitly requested scopes are not propagated

v0.21.6

22 Nov 06:41
v0.21.6
f373a53

Choose a tag to compare

Changed

  • Allow non-immutable collections and lists to be explicitly cloned via a public clone() method

v0.21.5

22 Nov 04:45
v0.21.5
4a66dbe

Choose a tag to compare

Added

  • Add initial event class hierarchies
  • Add IStoppableEvent interface
  • Reinstate parts of removed StoppableServiceEvent class as new TStoppableEvent trait
  • Add Assert::isArray(), Assert::isInt(), Assert::isString()
  • Add Cache::getArray(), Cache::getInt(), Cache::getString()
  • Add Inspect::getType()
  • Add ASCII-only Str::lower() and Str::upper() methods
  • Add ExceptionInterface and ExceptionTrait to simplify inheritance of native exception classes
  • Add InvalidArgumentException, UnexpectedValueException, InvalidContainerBindingException and adopt where appropriate
  • Add a robust Uri class ahead of upcoming Curler improvements

Changed

  • Refactor OAuth2Client as an abstract class
  • Refactor *Collection interfaces, traits and classes, moving some functionality to new *List or *ListCollection counterparts
  • Remove type checks from TypedCollection
  • In collection classes, return null instead of false when there is no item to return
  • In Cache::getInstanceOf(), return null instead of false if there is no item to return (for consistency with other get<type>() methods)
  • In Curler, derive $cacheResponse from $expiry if an explicit expiry is given
  • Dispatch GlobalContainerSetEvent and SyncStoreLoadedEvent instead of named ServiceEvents
  • In IProvider and ISyncEntity, extend HasName instead of HasDescription to remove requirement for unused description() method
  • Rename Assert methods:
    • patternMatches() -> isMatch()
    • sapiIsCli() -> runningOnCli()
    • argvIsRegistered() -> argvIsDeclared()

Removed

  • Remove OAuth2Provider (unnecessary with OAuth2Client's closure-based workaround for access to protected values)
  • Remove redundant <service>::EVENT_* constants
  • Remove unnecessary ServiceEvent and StoppableServiceEvent classes
  • Remove unused Assert::localeIsUtf8() method
  • Remove legacy Trash class
  • Remove HasMutator trait (replaced with Immutable)
  • Remove LooselyTypedCollection (use TypedCollection instead)

Fixed

  • Fix code generator issue where \self and \static return types are not resolved correctly

v0.21.4

17 Nov 04:01
v0.21.4
b0823f6

Choose a tag to compare

Added

  • lk-util: add first cut of generate tests command

  • Add Cache::asOfNow() to mitigate race conditions arising from expiry of items between subsequent calls to Cache::has() and Cache::get()

  • Add Cache::getInstanceOf(), Cache::getItemCount() and Cache::getAllKeys()

  • Implement PSR-14

    • EventDispatcher:
      • Implement EventDispatcherInterface and ListenerProviderInterface
      • Optionally compose a separate ListenerProviderInterface
      • Rework dispatch() and listener signatures for PSR-14 compliance
    • Add Reflect::getFirstCallbackParameterClassNames() (required for event listener autowiring)
    • Add ServiceEvent and StoppableServiceEvent
  • Add methods:

    • Arr::listOfArrayKey()
    • Arr::listOfInt()
    • Arr::listOfString()
    • Arr::trimAndImplode()
    • Assert::instanceOf()

Changed

  • In Arr::trim(), remove empty strings by default

  • In Cache::set() and Cache::maybeGet(), accept DateTimeInterface expiration times

  • Rename InvalidRuntimeConfigurationException to IncompatibleRuntimeEnvironmentException

  • Add HasName interface and move HasDescription::name() to HasName

  • Remove nullability from return types of HasName::name() and HasDescription::description()

  • Move and/or refactor methods, deprecating the original:

    • Convert::sparseToString() -> Arr::implodeNotEmpty()
    • Convert::flatten() -> Arr::unwrap()
    • Convert::toArray() -> Arr::wrap()
    • Convert::toList() -> Arr::listWrap()
    • Convert::toUniqueList() -> Arr::unique()
    • Convert::toDateTimeImmutable() -> Date::immutable()
    • Test::isListArray() -> Arr::isList()
    • Test::isIndexedArray() -> Arr::isIndexed()
    • Test::isArrayOfArrayKey() -> Arr::ofArrayKey()
    • Test::isArrayOfInt() -> Arr::ofInt()
    • Test::isArrayOfString() -> Arr::ofString()
  • Rename methods:

    • Arr::notNull() -> whereNotNull()
    • Arr::notEmpty() -> whereNotEmpty()
    • Arr::implodeNotEmpty() -> implode()
  • Rename Returns* interfaces to Has* to simplify grammar:

    • ReturnsContainer -> HasContainer
    • ReturnsDescription -> HasDescription
    • ReturnsEnvironment -> HasEnvironment
    • ReturnsIdentifier -> HasIdentifier
    • ReturnsProvider -> HasProvider
    • ReturnsProviderContext -> HasProviderContext
    • ReturnsService -> HasService
  • Introspector::getGetNameClosure():

    • Remove nullability from closure return type
    • Do not fall back to description when there are no name properties
    • Return "#$id" when falling back to id
    • Fix issue where closures may return types other than string
    • Fix issue where closures fail to resolve first and last name pairs when normalisers other than snake_case are used

Removed

  • Remove unused methods:
    • Convert::toUnique()
    • Convert::columnsToUniqueList()
    • Test::isAssociativeArray()
    • Test::isArrayOfValue()
    • Reflect::getAllTraits()

Fixed

  • Fix builtin type handling in Reflect::getTypeDeclaration()

v0.21.3

11 Nov 04:41
v0.21.3
9a7e3bd

Choose a tag to compare

Added

  • Add File::relativeToParent()
  • Add Assert::fileExists(), Assert::isFile(), Assert::isDir()
  • Add AssertionFailedException
  • Add Timekeeper class
  • Add Profile facade for Timekeeper

Changed

  • Rename Lkrms\Utility\Composer to Lkrms\Utility\Package and rename methods:

    • hasDevDependencies() -> hasDevPackages()
    • getRootPackageName() -> name()
    • getRootPackageReference() -> reference()
    • getRootPackageVersion() -> version()
    • getRootPackagePath() -> path()
    • getPackageReference() -> packageReference()
    • getPackageVersion() -> packageVersion()
    • getPackagePath() -> packagePath()
    • getClassPath() -> classPath()
    • getNamespacePath() -> namespacePath()
  • Rename Lkrms\Utility\Assertions to Lkrms\Utility\Assert

Removed

  • Remove Composer facade
  • Remove Assert facade
  • Remove timer implementation from System (moved to Timekeeper)

v0.21.2

07 Nov 11:03
v0.21.2
3b5022c

Choose a tag to compare

Fixed

  • Sync: fix issue where empty child relationships do not always resolve
    • If a child relationship resolves to an empty list, assign it directly to the children property because addChild() will not be called

v0.21.1

07 Nov 05:03
v0.21.1
d3c09c3

Choose a tag to compare

Changed

  • Sync: remove superfluous propagation of $offline
  • Sync: Add optional $entityType parameter to Sync::resolveDeferred()