Releases: salient-labs/toolkit
Releases · salient-labs/toolkit
v0.21.20
Added
- Add
DotNetDateParser
Changed
- Move
DateFormatterand*DateParserclasses and interfaces toLkrms\Support\Date - Rename:
IDateFormatter->DateFormatterInterfaceIDateParser->DateParserInterfaceTextualDateParser->DateParserCreateFromFormatDateParser->DateFormatParser
Removed
- Remove
RegexDateParser
v0.21.19
Added
- Add
Str::upperFirst()and use it in favour ofucfirst() - Add
Test::isDateString() - Add
File::copy() - Add
Console::getTargets() - Add
lk-utilcommandsync entity get
Changed
- Allow filenames to be passed to
File::stat(), not just streams - Rename
File::is()toFile::same() - Clean up
Consoleclasses- Make
Console::getStdoutTarget()andConsole::getStderrTarget()public to surface mockable output streams - Use new
ConsoleTargetTypeFlagenumeration to simplifyConsole::setTargetPrefix()parameters - Rename
IConsoleTargettoConsoleTargetInterfaceand split into additionalConsoleTargetStreamInterface - Rename
IConsoleTargetWithPrefixtoConsoleTargetPrefixInterfaceand addgetPrefix()method - Split abstract
ConsoleTargetclass into additionalConsolePrefixTargetandConsoleStreamTargetclasses - Rename
ConsoleLevelstoConsoleLevelGroup - Rename
ConsoleMessageTypestoConsoleMessageTypeGroup - Rename
IConsoleFormattoConsoleFormatInterface - Rename
Console::registerStableOutputLog()toregisterLogTarget() - Rename
Console::registerDefaultStdioTargets()tomaybeRegisterStdioTargets() - Rename
ConsoleMessageType::DEFAULTtoConsoleMessageType::STANDARD
- Make
- Improve handling of
null, empty and defaultCliOptionvalues- Add
CliOption::$Nullableand resolve the value ofnullableoptions not given on the command line tonull - Allow
requiredoptions to have an optional value - Require options with optional values to have a non-empty
defaultValue - Normalise the value of
multipleAllowedoptions not given on the command line to an empty array if they are notnullable
- Add
- In
lk-util generatecommands:- Remove custom metadata tags and
@usesfrom output - Remove
--no-metaoption - Add
@apito output if--apiis given - Add
@generatedto output
- Remove custom metadata tags and
- Sync: rename
lk-utilcommandheartbeattosync provider check-heartbeat - Sync: add
--shallowoption to genericGetSyncEntitiescommand
Removed
- Remove
HasEnvironmentinterface and its implementations - Remove unused
Convert::pathToBasename()method - Remove deprecated methods
Fixed
- Fix an issue where
File::same()returnstruefor files with the same inode number on different devices - Fix an issue where
Str::setEol()replaces every combination ofCRandLFin a string instead of the string's current EOL sequence
v0.21.18
Added
- Add
File::guessIndentation() - Add
File::isSeekable() - Add
Str::toStream() - Add
Sys::getUserId()
Changed
- Refactor
File::realpath()- Remove file descriptor handling
- Throw an exception if the file doesn't exist
- Resolve Phar URIs when a Phar is not running
- Refactor
File::relativeToParent()- Require
$parentDir - Add
$fallback(nullby default) and return it if$filenamedoes not belong to$parentDir
- Require
- Refactor
File::writeCsv()- Make
$resourcea required parameter - Swap
$dataand$resourceparameters - Change return type to
void - Remove UTF-16LE filters applied to streams provided by the caller
- Apply
Arr::toScalars()to each row of data
- Make
- Refactor
Sys::getProgramBasename()- Only remove the first matched
$suffix
- Only remove the first matched
- Rename
Stream::fromContents()toStream::fromString() - Rename environment variable
CONSOLE_OUTPUTtoCONSOLE_TARGET - Add optional
$nullparameter toArr::toScalars() - Adopt
Str::lower()andStr::upper()for case comparison - Make
File::fputcsv()public
Fixed
- Fix
File::realpath()issue where//../segments in Phar URIs are not resolved correctly - Fix
ErrorHandler::silencePath()issue where files and directories that start with the same name as a silenced file are inadvertently silenced
v0.21.17
Added
- Add
Arr::flatten() - Add
HttpFactory(implements PSR-17 factory interfaces)
Changed
- Return
nullinstead offalsewhenFluentIteratorInterface::nextWithValue()finds no matching value - Pass value AND key to
FluentIteratorInterface::forEach()callback - In
HttpRequest, preserve the original case of the HTTP method - In
HttpHeaders, throw an exception when a header with no values is given - In
Uri, do not resolve dot segments if the URI is a relative reference - In
Arr::toScalars(), preservenullvalues - In
Arr::trim(), remove keys from the array if removing empty values - Optionally preserve keys in
Arr::unique() - Rename
Arr::sameValues()tosame() - Accept
iterablewhere possible inArrmethods - Add
Arr::keyOffset(), deprecatingConvert::arrayKeyToOffset() - Add
Arr::toMap(), deprecatingConvert::listToMap() - Add
Arr::toScalars(), deprecatingConvert::toScalarArray() - Add
Get::array(), deprecatingConvert::iterableToArray()
Deprecated
- Deprecate (see above):
Convert::arrayKeyToOffset()Convert::listToMap()Convert::toScalarArray()Convert::iterableToArray()
Removed
- Remove unused/redundant methods:
Arr::forEach()Convert::columnsToUnique()Convert::iterableToItem()Convert::iterableToIterator()Convert::scalarToString()Convert::stringsToUnique()Convert::stringsToUniqueList()Convert::valueAtKey()Convert::walkRecursive()FluentIteratorInterface::forEachWhile()FluentIteratorTrait::forEachWhile()
Fixed
- Fix bug in
Arr::sortDesc()where keys are not preserved correctly
v0.21.16
v0.21.15
Added
- Add static
Uri::from()method - Add
HttpRequest - Add
TReadableCollection::filterItems()
Changed
- Build out
CliCommand::getJsonSchema()andCliCommand::filterJsonSchema() - Rename
Json::toArrays()toJson::parseObjectAsArray() - Standardise types that can be converted to a
Uri - Rename
HttpRequesttoHttpServerRequestand replace with PSR-7HttpRequestclass (for outgoing requests) - In
HttpHeaders, moveHostheaders to the top of the index for compliance with [RFC7230]
Fixed
- Fix
HttpHeadersissue where header names and values with trailing newlines are not rejected as invalid
v0.21.14
v0.21.13
Added
- Add
Streamclass, related exceptions and tests - Add
HttpMessageclass - Add
HttpProtocolVersionenumeration - Add
InvalidArgumentTypeException - Add
Arr::splice() - Add
File::read(),File::stat(),File::getContents() - Add
IEnumeration::hasValue()and implement inConvertibleEnumeration,ReflectiveEnumeration,Enumeration
Changed
- Refactor, move and deprecate previous:
Convert::arraySpliceAtKey()->Arr::spliceByKey()Convert::renameArrayKey()->Arr::rename()Test::isPharUrl()->File::isPharUri()Test::isAbsolutePath()->File::isAbsolute()
- Make
Uri::removeDotSegments()public, improve documentation - Change
HttpRequestMethodfrom dictionary to enumeration - Rename for PSR-7 consistency:
IHttpHeaders->HttpHeadersInterfaceIAccessToken->AccessTokenInterface
- Move classes in
Http\AuthtoHttp\OAuth2
Deprecated
- Deprecate (see above):
Convert::arraySpliceAtKey()Convert::renameArrayKey()Test::isPharUrl()Test::isAbsolutePath()
Fixed
- Fix issue where
Filemethods do not throwFilesystemErrorExceptionon failure - Fix issue where
Test::isAbsolutePath()does not match URIs or Windows paths with forward slashes, e.g.C:/path/to/file - Fix issue where
Test::isPharUrl()only matches when scheme name is lowercase
v0.21.12
Added
- In
CliApplication, generate a JSON Schema when_json_schemais the first argument after a command - Add
Uri::follow()andUri::resolveReference(), deprecatingConvert::resolveRelativeUrl()and removing support for obsolete [RFC1808] - Add
Uri::parse(), deprecatingConvert::parseUrl() - Add
Uri::unparse(), deprecatingConvert::unparseUrl() - Add
Uri::toParts(),Uri::fromParts(),Uri::normalise(),Uri::isReference() - Add
CliCommand::filterJsonSchema() - Add
CliOption::getSummary()
Changed
- Replace
Sysfacade with renamedSystemclass - Replace
Debugfacade with renamedDebuggingclass after making its methods static - Refactor
Debug::getCaller() - Rename
InspecttoGetand shorten method names, i.e.Inspect::getType()->Get::type()Inspect::getEol()->Get::eol()
- Move
Convert::classToBasename()andConvert::classToNamespace()toGet::basename()andGet::namespace(), deprecating the former - Rewrite
Convert::resolvePath()and move toFile::resolve(), deprecating the former
ArrayMapper:
- Rewrite as a self-contained class instead of a closure factory
- Remove its
Mapperfacade - Refactor
Pipeline::throughKeyMap()
Uri:
- Implement
JsonSerializable - Make distinction between undefined (
null) and empty ('') values when converting to and from URI strings and arrays - Move regular expressions from
RegularExpressiontoUri
MultipleErrorException:
- Add
MultipleErrorExceptionInterfaceand move implementation fromMultipleErrorExceptiontoMultipleErrorExceptionTrait - Add
hasUnreportedErrors()andgetMessageWithoutErrors() - In
Console::exception(), usehasUnreportedErrors()andgetMessageWithoutErrors()to ensure errors are only reported once
Deprecated
- As above, deprecate:
Convert::classToBasename()Convert::classToNamespace()Convert::parseUrl()Convert::resolvePath()Convert::resolveRelativeUrl()Convert::unparseUrl()
Removed
- Remove redundant
FluentIteratorclass (IterableIteratorcan be used or extended instead)
Fixed
- Fix issue where
Convert::classToBasename()removes suffixes from the middle of class names - Fix issue where URI strings with an empty host are considered invalid
- Fix issue where URI objects with an empty host cannot have userinfo or port
- Fix issue where
file://URIs are composed asfile: - Fix issue where errors passed to
MultipleErrorExceptionare not reported ifErrorHandleris not handling exceptions (e.g. when running PHPUnit) by adding errors to the exception message
v0.21.11
Added
- Allow exceptions to be thrown with an exit status
- In
ErrorHandler, check unhandled exceptions for an exit status to return - Add and implement
CliOptionValueType::PATH_OR_DASHandCliOptionValueType::FILE_OR_DASH - Add
CliOptionVisibility::SCHEMAso options can be flagged for inclusion in a JSON Schema - Add
CliOptionVisibility::ALL_EXCEPT_SYNOPSISfor convenience - Add
Jsonclass - Add utility methods:
Date::timezone(),Date::maybeSetTimezone()File::is()Pcre::quoteCharacterClass()Str::wrap()Test::isStringable()
Changed
ErrorHandler: change default exit status from 15 to 16 to improve support for bitmasks as return valuesConsole: indent fenced code blocks for separation from surrounding text- Move and refactor, deprecating the former:
Convert::splitWords()->Str::toWords()Convert::toSnakeCase()->Str::toSnakeCase()Convert::toKebabCase()->Str::toKebabCase()Convert::toCamelCase()->Str::toCamelCase()Convert::toPascalCase()->Str::toPascalCase()
- Review
Formatters- Extend
Utilityand make methodsstatic - Remove
Formatfacade and renameFormatterstoFormat - Add
Format::value() - Refactor
Format::date()andFormat::dateRange()
- Extend
Deprecated
- Deprecate
Convert::toTimezone()(replaced withDate::timezone()) - Deprecate
Test::areSameFile()(replaced withFile::is()) - Deprecate case conversion methods (as above)
Removed
- Remove support for
"t"and"f"as boolean strings - Remove previously deprecated methods
- Remove
Test::classImplements()
Fixed
- Fix
CliCommandissue wheregetOptionValues()andgetDefaultOptionValues()fail with an exception when a positional option's$Longproperty isnull - Fix
Consoleissue where fenced code blocks are formatted as inline spans when indented