Releases: salient-labs/toolkit
v0.21.10
Added
- Add
Str::coalesce() - Add
Arr::sameValues() - Add
RecursiveFilesystemIterator::count() - Add
Builder::unsetB()
Changed
- In
Buildermethods, only return a clone if a value is changed - Rename
ProvidesBuilderinterface toBuildableand consolidate extended interfaces, reverting needlessly complicated split - Add default implementation of
Buildable::getBuilder()toHasBuildertrait and remove boilerplate code from classes that use it - Allow assertions in
Assertto throw a given exception - Clean up and rename
Convert::toBoolOrNull()andtoIntOrNull()totoBool()andtoInt() - Clean up
Envand adoptPcre::*methods - Tolerate whitespace around boolean and integer values in environment variables
- Clean up abstract enumeration and dictionary classes
Cli:
- Add
CliOption::$Name- Primarily for
*_POSITIONALoptions, but others can use it too - Takes the value of
CliOption::$Longif not set explicitly - Positional options are not permitted to apply different values to
CliOption::$NameandCliOption::$Long
- Primarily for
- Add
CliOption::$IsBoundtrueif 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::$KeepDefaultandCliOption::$KeepEnv - Remove unused
Convert::emptyToNull()method - Remove
ResolvesBuilder,ReturnsBuilder,ReturnsBuilderServiceinterfaces
Fixed
Env: fix issue where negative integers are rejectedCli: add explicit checks fornull,''and[]to prevent issues with "falsey" values like"0"- Fix
Introspectorissues:- Detect constructor parameters that have a default value but are not nullable, and throw an exception if
nullis 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
- Detect constructor parameters that have a default value but are not nullable, and throw an exception if
v0.21.9
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 withArr::of())
Fixed
Cli: fix issue where empty default values are displayed in help messagesCli: remove escapes from horizontal whitespace to fix issue where help written as Markdown wraps weirdly when rendered
v0.21.8
Added
- Add
HttpHeadersandIHttpHeaders - Add
IAccessTokenand implement its methods inAccessToken - 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
TKeytoarray-key, removing hypothetical support for arbitrary key types but allowing implementation ofArrayableetc. - Implement
Arrayable,Jsonable,JsonSerializable - In
ICollection::merge(), acceptArrayable|iterableinstead ofstatic|iterable
-
Move parts of
TCollectionto a separateTReadableCollectiontrait -
Move
Lkrms\Support\Http->Lkrms\Http -
Move
Lkrms\Support\Catalog\Http*->Lkrms\Http\Catalog -
Move
Lkrms\Auth->Lkrms\Http\Auth -
Add
HttpHeaderGroupand clean up existingHttpenumerations -
Rename
HttpRequestMethods->HttpRequestMethodGroup -
Rename
Curler::addPrivateHeaderName()->addSensitiveHeaderName() -
Replace
CurlerHeadersand friends withHttpHeadersand friends -
Replace
ICurlerHeaderscalls withIHttpHeadersequivalents:getHeaders()->getLines()getHeaderValue()->getHeaderLine()getHeaderValues()->getHeaderLines()
-
In
File::close(), make$filenameoptional and rename it to$uri -
In
File::writeCsv(), usephp://tempinstead ofphp://memoryfor temporary output -
Rename
Regex::NOT_ESCAPED->Regex::BEFORE_UNESCAPED -
Make
FilesystemErrorException(and most other exceptions) extendRuntimeExceptioninstead ofException
Removed
- Remove superseded
ICurlerHeaders,CurlerHeaders,CurlerHeadersFlag,CurlerHeader - Remove unused
FluentArrayclass - Remove
$privatearguments fromCurler::addHeader()andCurler::setHeader() - Remove support for filtering headers by pattern in
Curler::unsetHeader() - Remove
$valueparameter fromICollection::unset()
Fixed
- Fix issue where
File::getStreamUri()fails for streams with no URI
v0.21.7
Added
- Add
Arr::extend() - Sync: add
SyncProvider::pipelineFrom()andpipelineTo()to simplify creation of entity pipelines that satisfy static analysis
Changed
- In
Cache::get(), returnnullinstead offalsewhen an item has expired or doesn't exist - In
OAuth2Client, extend the scope of the most recently issued token if possible - Make
OAuth2Client::flushTokens()andOAuth2Client::getIdToken()public - Move
OAuth2FlowfromAuth\CatalogtoAuthnamespace
Deprecated
- Deprecate
SyncProvider::pipeline()andcallbackPipeline()
Fixed
- Fix OAuth 2.0 issue where explicitly requested scopes are not propagated
v0.21.6
v0.21.5
Added
- Add initial event class hierarchies
- Add
IStoppableEventinterface - Reinstate parts of removed
StoppableServiceEventclass as newTStoppableEventtrait - Add
Assert::isArray(),Assert::isInt(),Assert::isString() - Add
Cache::getArray(),Cache::getInt(),Cache::getString() - Add
Inspect::getType() - Add ASCII-only
Str::lower()andStr::upper()methods - Add
ExceptionInterfaceandExceptionTraitto simplify inheritance of native exception classes - Add
InvalidArgumentException,UnexpectedValueException,InvalidContainerBindingExceptionand adopt where appropriate - Add a robust
Uriclass ahead of upcomingCurlerimprovements
Changed
- Refactor
OAuth2Clientas anabstractclass - Refactor
*Collectioninterfaces, traits and classes, moving some functionality to new*Listor*ListCollectioncounterparts - Remove type checks from
TypedCollection - In collection classes, return
nullinstead offalsewhen there is no item to return - In
Cache::getInstanceOf(), returnnullinstead offalseif there is no item to return (for consistency with otherget<type>()methods) - In
Curler, derive$cacheResponsefrom$expiryif an explicit expiry is given - Dispatch
GlobalContainerSetEventandSyncStoreLoadedEventinstead of namedServiceEvents - In
IProviderandISyncEntity, extendHasNameinstead ofHasDescriptionto remove requirement for unuseddescription()method - Rename
Assertmethods:patternMatches()->isMatch()sapiIsCli()->runningOnCli()argvIsRegistered()->argvIsDeclared()
Removed
- Remove
OAuth2Provider(unnecessary withOAuth2Client's closure-based workaround for access to protected values) - Remove redundant
<service>::EVENT_*constants - Remove unnecessary
ServiceEventandStoppableServiceEventclasses - Remove unused
Assert::localeIsUtf8()method - Remove legacy
Trashclass - Remove
HasMutatortrait (replaced withImmutable) - Remove
LooselyTypedCollection(useTypedCollectioninstead)
Fixed
- Fix code generator issue where
\selfand\staticreturn types are not resolved correctly
v0.21.4
Added
-
lk-util: add first cut ofgenerate testscommand -
Add
Cache::asOfNow()to mitigate race conditions arising from expiry of items between subsequent calls toCache::has()andCache::get() -
Add
Cache::getInstanceOf(),Cache::getItemCount()andCache::getAllKeys() -
Implement PSR-14
EventDispatcher:- Implement
EventDispatcherInterfaceandListenerProviderInterface - Optionally compose a separate
ListenerProviderInterface - Rework
dispatch()and listener signatures for PSR-14 compliance
- Implement
- Add
Reflect::getFirstCallbackParameterClassNames()(required for event listener autowiring) - Add
ServiceEventandStoppableServiceEvent
-
Add methods:
Arr::listOfArrayKey()Arr::listOfInt()Arr::listOfString()Arr::trimAndImplode()Assert::instanceOf()
Changed
-
In
Arr::trim(), remove empty strings by default -
In
Cache::set()andCache::maybeGet(), acceptDateTimeInterfaceexpiration times -
Rename
InvalidRuntimeConfigurationExceptiontoIncompatibleRuntimeEnvironmentException -
Add
HasNameinterface and moveHasDescription::name()toHasName -
Remove nullability from return types of
HasName::name()andHasDescription::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 toHas*to simplify grammar:ReturnsContainer->HasContainerReturnsDescription->HasDescriptionReturnsEnvironment->HasEnvironmentReturnsIdentifier->HasIdentifierReturnsProvider->HasProviderReturnsProviderContext->HasProviderContextReturnsService->HasService
-
Introspector::getGetNameClosure():- Remove nullability from closure return type
- Do not fall back to
descriptionwhen there are no name properties - Return
"#$id"when falling back toid - 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
Added
- Add
File::relativeToParent() - Add
Assert::fileExists(),Assert::isFile(),Assert::isDir() - Add
AssertionFailedException - Add
Timekeeperclass - Add
Profilefacade forTimekeeper
Changed
-
Rename
Lkrms\Utility\ComposertoLkrms\Utility\Packageand 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\AssertionstoLkrms\Utility\Assert
Removed
- Remove
Composerfacade - Remove
Assertfacade - Remove timer implementation from
System(moved toTimekeeper)