Releases: salient-labs/toolkit
Releases · salient-labs/toolkit
v0.99.30
Added
Utility
- Add
Str::title()
Changed
Utility
- Rename
Packagemethods:reference()->ref()packageReference()->getPackageRef()packageVersion()->getPackageVersion()packagePath()->getPackagePath()classPath()->getClassPath()namespacePath()->getNamespacePath()
- Rename
Strmethods:- Rename
wrap()toenclose() - Rename
wordwrap()towrap()
- Rename
- Don't accept or return
nullinStr::trimNativeEol(),Str::eolToNative(),Str::eolFromNative() - In
Str::normalise(), only replace"&"with" and "when it is the only ampersand between two alphanumeric characters
Removed
Utility
- Remove
Get::notNull()
v0.99.29
v0.99.28
Added
Core
- In
AbstractStore:- Add support for temporary databases created on the filesystem
- Add
isTemporary()to check if the store is backed by a temporary or in-memory database - Add and adopt protected
SQLite3::prepare()andSQLite3Stmt::execute()wrapper methodsprepare()andexecute() - Improve support for cloning (e.g. by
CacheStore::asOfNow()) by tracking state in an object shared between instances - Add
detach()anddetachDb()methods so stores can be closed without their clones also closing - Add
hasTransaction()
Changed
Core
- Don't allow
AbstractStoresubclasses to be cloned unless they override__clone()
Cache
- Improve concurrency in
CacheStoreby starting a SQLite transaction whenCacheStore::asOfNow()returns a copy of the store, and committing it when the copy goes out of scope or is explicitly closed
v0.99.27
v0.99.26
Added
Console
- Add
Console::escape()
Core
- Add
ErrorHandler::handleExitSignal()so signal handlers can report the exit status of the running script before it terminates onSIGTERM,SIGINTorSIGHUP
Changed
Console
- Preserve output from
Console::logProgress()when exiting on error
Core
- In
ErrorHandler::handleException(), set shutdown flags and resolve exit status before callingConsole::exception()so console output targets can respond appropriately during shutdown
Utility
- In
Sys::handleExitSignals(), report exit onSIGTERM,SIGINTorSIGHUPtoErr::handleExitSignal()
Fixed
Console
- Fix
ConsoleFormatter::formatDiff()issue where an exception is thrown when a unified diff contains a line that starts with-++
v0.99.25
Added
Console
- Add
ConsoleWriterInterfaceand adopt where appropriate - Add a spinner to
Console::logProgress()output - Add
ConsoleLoggerto finalise PSR-3 support - Add
Console::getLogger()
Changed
Console
- Update message decorations and formatting
- Optionally suppress error count and associated formatting in
Console::summary() - Update
Console::group()API - Rename
CONSOLE_TARGETenvironment variable toconsole_target - Rename
Consolemethods for consistency:getErrors()->getErrorCount()getWarnings()->getWarningCount()maybeClearLine()->clearProgress()out()->printOut()tty()->printTty()stdout()->printStdout()stderr()->printStderr()
- Optionally filter targets by level and type in
Console::getTargets() - Always replace existing
STDOUT/STDERRtargets
Core
- Move
Salient\Core\Utilitynamespace toSalient\Utility - Move
Regexvalues toPcreand renamePcretoRegex - Move
CopyFlagvalues toGetand rename for clarity as needed - Move
EnvFlagvalues toEnvand rename for clarity as needed - Rename
Envmethods:load()->loadFiles()environment()->getEnvironment()home()->getHomeDir()dryRun()->getDryRun()andsetDryRun()debug()->getDebug()andsetDebug()flag()->getFlag()andsetFlag()
- Do not print console messages from
Env - Move
AbstractUtilityandPackageDataReceivedEventtoUtilitynamespace - Move exceptions to
Utilitynamespace and refactor as needed
Removed
Console
- Remove unused/internal
Consolemethods:deregisterAllTargets()maybeRegisterStdioTargets()registerLogTarget()
- Remove
$replaceparameters fromConsolemethods
Core
- Remove
Env::getClass() - Remove
Env::isLocaleUtf8() - Remove
JsonEncodeFlagandJsonDecodeFlagafter replacing references to them with equivalentJSON_*values - Remove exceptions with the same name as their native parent:
BadMethodCallExceptionInvalidArgumentExceptionLogicExceptionOutOfRangeExceptionRuntimeExceptionUnexpectedValueException
Fixed
Core
- Fix
DateParser::parse()issue where empty strings are interpreted as'now' - Fix
DateParser::parse()issue where$timezoneis not applied after parsing - Fix incorrect example in
Envdocumentation - In
Format::value(), fall back toGet::type()if encoding fails
sli
- In
generatecommands, detect (some) constants to fix issue whereJSON_*constants in PHPDoc types are treated as class names
v0.99.24
Added
Collection
- Add collection methods
has()andget()for accessing items by key (existing methods with the same name have been renamed as below) - Add collection method
map()(analogous toarray_map()) - Add
handleItemsReplaced()method toCollectionTrait
Core
- Add
Reflect::normaliseType()to allow inspection of declared types without flattening intersection types
Sync
- Add
AbstractSyncEntity::getParentSerializeRules()to simplify serialization rule inheritance
Changed
Collection
- Rename collection methods
has()andget()to more consistenthasValue()andfirstOf() - In
ReadableCollectionTrait, applyfilterItems()even when merging collections of the same class
Core
- In
Reflect:- Normalise nullable types (
?int) to equivalent unions (int|null) - Rename
getFirstCallbackParameterClassNames()togetCallableParamClassNames()and allow$paramto be given, return intersection types as nested arrays - Rename
getMethodPrototypeClass()togetPrototypeClass()
- Normalise nullable types (
- Ignore intersection types in
EventDispatcher::listen()
Sync
- In
SyncErrorCollection:- Rename
toSummary()togetSummary() - Rename
toString()togetSummaryText()and simplify - Add
reportErrors()fromSyncStore::reportErrors() - Use
CollectionTrait::handleItemsReplaced()to maintain error and warning counts
- Rename
- Do not call closures provided via serialization rules to replace
null - When rule recursion is enabled in
SyncSerializeRules:- Apply inherited rules to inherited entity classes recursively
- Only apply rules for entities seen at each path (i.e. don't apply path-based rules for
UserSubClassto nested instances ofUser)
PHPStan
- Improve
GetCoalesceRulerecommendations
Removed
- Remove
SyncStoreInterface::reportErrors()(moved toSyncErrorCollection)
Fixed
- Fix
SyncSerializeRulesregression where rules are not applied recursively at the point of recursion (i.e. to instances of the entity class being serialized)
v0.99.23
Added
Core
- Add
ErrorHandlermethodsisShuttingDown(),isShuttingDownOnError()andgetExitStatus()- Destructors can use these via the
Errfacade to determine the script's exit status during shutdown and respond accordingly
- Destructors can use these via the
- Add
Arr::setIf() - Add
getContainer()to builders
Curler
- Add
CurlerInterface::withRequest()so middleware can useCurlerto inspect arbitrary requests
Sync
- Add
SyncStore::getBinaryRunUuid()and remove$binaryparameter fromgetRunUuid() - Add
SyncStore::getEntityId() - Add
SyncStoreInterfaceand adopt where appropriate
PHPStan
- Add PHPStan extensions:
GetCoalesceRuleto report unnecessary use ofGet::coalesce()ArrWhereNotEmptyMethodReturnTypeExtensionto resolve return type ofArr::whereNotEmpty(), including for constant arraysArrWhereNotNullMethodReturnTypeExtensionto similarly resolve return type ofArr::whereNotNull()
sli
- Add
--no-declareoption tosli generate builder
Changed
Cache
- Automatically remove expired items from
CacheStore - Adopt
CacheStoreInterfaceinstead ofCacheStorewhere appropriate
Container
- Resolve internal interfaces to internal implementations by default, e.g. resolve
CacheStoreInterfacetoCacheStoreif it hasn't been bound to something else - Move
RequiresContainertoContainernamespace - In
RequiresContainer::requireContainer(), fall back to the global container if it exists, otherwise create a standalone container (unless$createGlobalContainer = true)
Core
- Rename builder methods for consistency and clarity:
build()->create()go()->build()
- Move
Httputility class toHttpnamespace - Move
Getmethods to newFormDataclass inHttpnamespace:query()->getQuery()formData()->getValues()data()->getData()
- Rename
QueryFlagtoFormDataFlagand move toHttpnamespace - Rename
Arr::same()toArr::sameValues()and addArr::same(), which also checks keys (as one would expect) - Simplify
Sys::handleExitSignals() - Move
Charconstants toStr - Move
SortFlagconstants toArr - Rename
AbstractStore::requireUpsert()toassertCanUpsert()and returnvoid
Curler
- Surface middleware messages via
Curler::getLastRequest()andCurler::getLastResponse() - Pass
$curlertoCurlercache key callbacks - Add signature to
$nextclosure inCurlermiddleware annotations - Allow
Curler's user agent header to be suppressed - Rename
CurlerInterface::withQueryFlags()toCurlerInterface::withFormDataFlags() - Rename
CurlerBuilder::queryFlags()toCurlerBuilder::formDataFlags()
Sync
- Revert serialization changes in @9344acb3, where containers are propagated via serialization rules, in favour of passing an optional entity store to serialize operations
- This allows serialization of possibly-detached entities--that may belong to a namespace registered with a store they can't locate--without making serialization rules container-dependent
- In
SyncEntityInterface:- Rename
defaultProvider()->getDefaultProvider() - Make
$containera required parameter forgetDefaultProvider()andwithDefaultProvider() - Remove
$containerparameter fromgetSerializeRules() - Rename
plural()->getPlural()and make return type nullable - Add
$storeparameter totoArray()andtoArrayWith() - In
toArrayWith(), don't allow$rulesto be an unresolved builder - Pass
$storeinstead of$containertotoLink()anduri()
- Rename
- Remove
staticmodifier fromSyncClassResolverInterfacemethods - Rename
SyncStoremethods:hasRunId()->runHasStarted()provider()->registerProvider()getProviderHash()->getProviderSignature()entityType()->registerEntity()namespace()->registerNamespace()and require$resolverto be aSyncClassResolverInterfaceinstancegetEntityTypeUri()->getEntityUri()getEntityTypeNamespace()->getEntityPrefix()getNamespaceResolver()->getClassResolver()and returnSyncClassResolverInterface|nullentity()->setEntity()deferredEntity()->deferEntity()deferredRelationship()->deferRelationship()resolveDeferred()->resolveDeferrals()and add$providerId, remove$return, always return resolved entitiescheckHeartbeats()->checkProviderHeartbeats()error()->recordError()
- Add
$forEntityPropertyparameter toSyncStore::resolveDeferredRelationships() - Automatically detect exit status during
SyncStoreshutdown - In
SyncSerializeRules:- Don't flatten rules until they are compiled, in case rules for entities with different normalisers are merged
- Normalise new key names during compilation
- Add/rename/replace in
SyncSerializeRulesand related interfaces:getEntity()apply()->merge()getRemoveFrom()->getRemovableKeys()getReplaceIn()->getReplaceableKeys()withDateFormatter()withDetectRecursion()getRecurseRules()withRecurseRules()getForSyncStore()and removegetFlags()withForSyncStore()getRemoveCanonicalId()->getIncludeCanonicalId()withRemoveCanonicalId()->withIncludeCanonicalId()
- In
SyncProviderInterface::with(), do not acceptContainerInterfaceas a$context
Removed
- Remove
getApp()methods in favour ofgetContainer() - Remove container method
instanceIf()to address unexpected outcome when existing bindings are not shared instances - Remove
Arr::upperFirst() - Remove
HasProvider::requireProvider() - Remove
AbstractStore::isTransactionOpen() - Remove
AbstractSyncEntity::store() - Remove
AbstractSyncProvider::buildSerializeRules() - Remove
SyncEntityLinkType::INTERNAL
Fixed
- Fix
Arr::rename()bug when renaming a key with anullvalue - Remove
of objectfrom container method templates to fix static analysis errors when binding or resolving interfaces - Fix issue where serialization rules applied to date and time values trigger an exception
- Fix issue where nested value paths may be incorrect during serialization, preventing rules from applying correctly
Security
- Add "unstable" HTTP header group and use it to filter headers for inclusion in
Curler's default cache key instead of "sensitive" headers, which had non-obvious security implications by default
v0.99.22
Added
- Implement PSR-16 caching interface in
CacheStore- In
set(), rename$expiresparameter to$ttl - Remove values from the cache when
$ttlis an integer less than or equal to0 - Add
$defaultparameter toget(),getInstanceOf(), etc. - Rename
deleteAll()->clear() - Rename
flush()->clearExpired()for consistency - Adopt PSR-16 return types (
boolinstead of$this) - Add
setMultiple(),getMultiple(),deleteMultiple() - Add
CacheStoreInterface
- In
- Add
PHPDoc::getTemplates()
Changed
- Improve
PHPDoctag inheritance - Remove leading
$fromPHPDoc@varnames
Removed
- Remove unused
CacheStore::maybeGet()method
v0.99.21
Added
- Add
Str::PRESERVE_QUOTED
Changed
- Allow
nullto be passed to allFormatmethods - Allow the current year to be passed to
Format::date()andFormat::dateRange() - In
Format::dateRange():- Do not report time when the time of both dates is
00:00:00, even if they are in different timezones - Report time with both timezones when daylight saving time is active in one date but not the other
- Do not report time when the time of both dates is
- In
Format::bytes():- Add option to use decimal units
- Change default precision from
0to3 - Improve output for values near binary unit boundaries
- Suppress redundant decimal output when unit is 'B'
- Move DocBlock-related regular expressions from
RegextoPHPDocRegex - Move
normaliseType()fromPHPDocTagtoPHPDoc - Move
PHPDocTagand related classes toPHPDoc\Tag, then rename and make them immutable - Allow PHPDoc
@paramtags to indicate they are passed by reference - Improve parsing, e.g. when invalid whitespace is added between tokens
- Fail with an exception when a DocBlock cannot be parsed
Removed
- Remove
$legacyNullablesupport fromPHPDocclasses
Fixed
- Fix rounding bugs in
Format::bytes() - Fix issue where
Test::isNumericKey()ignores trailing newlines - Fix issue where
PHPDoc::$Summarymay not benullwhen a DocBlock has no summary - Fix issue where
/***/is not recognised as an invalid DocBlock