Releases: salient-labs/toolkit
Releases · salient-labs/toolkit
v0.99.56
Added
Utility
- Add
File::getIdentifier()
- Add
Get::list()
- Add
Reflect::getPrototype()
- Add
ShouldNotHappenException
Changed
PHPDoc
- Add optional
$includeInterfaces
parameter toPHPDocUtil::getAllClassDocComments()
Polyfill
- In
PhpToken::tokenize()
:- Move trailing newlines from comments to whitespace tokens for consistency with native class
- Replace namespaced names with PHP 8.0 name tokens
Utility
- In
Get::copy()
:- Copy anything, not just objects
- Allow object copying behaviour to be customised via a callback
Fixed
Polyfill
- Fix
PhpToken::tokenize()
issue where tokens in code with multiple end-of-line sequences may have incorrect line numbers
Utility
- Fix
Get::copy()
issue where classes that extend internal classes may trigger an exception whenCOPY_BY_REFERENCE
is enabled
v0.99.55
Added
Contract
- Add
Flushable
- Add
Instantiable
and require facade services to implement it
Sync
- Add
ReflectionSyncEntity
andReflectionSyncProvider
- Add
SyncUtil
methodsgetStore()
,getEntityTypeProvider()
,getProviderEntityTypes()
- Add context methods:
getEntityType()
withEntityType()
recursionDetected()
hasFilter()
getFilters()
(necessary after making$key
required ingetFilter()
)hasOperation()
getOperation()
withOffline()
- Add provider methods
runOperation()
andfilterOperationOutput()
to formalise policy enforcement
Utility
- Add
Arr::combine()
and adopt instead ofarray_combine()
- Add
Arr::search()
- Add
Reflect::getConstantValue()
Changed
Core
- Move exception interfaces to
Exception
namespace - Move entity-related interfaces to
Entity
namespace - Move provider-related interfaces to
Provider
namespace - Move
Cardinality
constants toRelatable
- Rename
ArrayMapperFlag
toArrayMapperInterface
, addmap()
method, and implement inArrayMapper
- Rename
HierarchyInterface
toHierarchical
, andHierarchical::getDescendantCount()
tocountDescendants()
- Rename
Normalisable::normalise()
tonormaliseProperty()
- In
Constructible
:- Rename
constructList()
toconstructMultiple()
- Rearrange parameters in
construct()
andconstructMultiple()
- Rename
- Rename
Providable::provideList()
toprovideMultiple()
- In
Extensible
:- Add
getDynamicPropertiesProperty()
andgetDynamicPropertyNamesProperty()
- Rename
getMetaProperties()
togetDynamicProperties()
- Replace
clearMetaProperties()
withsetDynamicProperties()
- Add
- Add native
int
type to$conformity
parameters
Http
- Add
$orSame
parameter togetOneHeaderLine()
methods
Sync
- Move
SyncIntrospector
methodsisListOperation()
andisWriteOperation()
toSyncUtil
- Rename
SyncNamespaceHelperInterface
methods for consistency (again):getEntityProvider()
->getEntityTypeProvider()
getProviderEntities()
->getProviderEntityTypes()
- Rename context methods:
stack()
->getEntities()
last()
->getLastEntity()
push()
->pushEntity()
withFilter()
->withOperation()
and add$entityType
parameter
- In context method
withOperation()
:- Allow associative array keys to be empty
- Normalise keys with any inner whitespace, not just
" "
- Apply the provider's date formatter to
DateTimeInterface
instances
- Merge received conformity levels when a context is passed to
Providable::provide()
orprovideMultiple()
Utility
- In
Arr::pluck()
, simplify parameter names and returnnull
for any items where the value is not found - In
Str::splitDelimited()
, remove empty strings by default (for consistency with similar methods) - In
Str::unwrap()
:- Don't unwrap leading or trailing newlines
- Trim whitespace between unwrapped lines
- Rename
$trimTrailingWhitespace
to$trimLines
- In
Str::mergeLists()
:- Update parameter names
- Don't add a space to
$headingPrefix
- Make
$itemRegex
nullable, and fall back to its default value whennull
is given - Add
$discardEmpty
,$eol
,$tabSize
parameters
- In string comparison methods:
- Don't normalise strings for comparison by default
- Normalise strings before checking their length
Removed
Core
- Remove enumeration- and dictionary-related interfaces and classes:
EnumerationInterface
ConvertibleEnumerationInterface
DictionaryInterface
AbstractCatalog
AbstractEnumeration
AbstractConvertibleEnumeration
AbstractReflectiveEnumeration
AbstractDictionary
- Remove
Cardinality
- Remove
NormaliserFactory
- Remove
Extensible
methods:setMetaProperty()
,getMetaProperty()
,isMetaPropertySet()
,unsetMetaProperty()
- Remove
$container
parameter fromProviderInterface::getContext()
Sync
- Remove
SyncIntrospector
methodsisReadOperation()
,getEntityProvider()
,getProviderEntities()
- Remove context methods:
pushWithRecursionCheck()
(pushEntity()
now has an optional$detectRecursion
parameter)maybeThrowRecursionException()
(replaced byrecursionDetected()
)getFilter{Int,String,ArrayKey,IntList,StringList,ArrayKeyList}()
claimFilter{Int,String,ArrayKey,IntList,StringList,ArrayKeyList}()
online()
,offline()
,offlineFirst()
(replaced bywithOffline()
)applyFilterPolicy()
,withFilterPolicyCallback()
Fixed
Core
- Fix issue where
ArrayMapper
ignoresREQUIRE_MAPPED
ifADD_MISSING
is also applied - Fix
ExtensibleTrait
issue where dynamic property names are remembered after they are unset
Sync
- Fix hydration issue where entity providers may be resolved before sync namespaces are registered
Utility
- Fix
Str::mergeLists()
issue where tabs are not expanded for comparison when checking for item continuation - Fix
Str::toStream()
issue where long strings may not be fully written to the stream
v0.99.54
Added
Sync
- Add
SyncStoreInterface
/SyncStore
/Sync
methodshasProvider()
,hasEntityType()
andgetEntityType()
for completeness - Add
SyncUtil
withgetEntityTypeUri()
Changed
Container
- In
Application::exportHar()
:- If no
$uuid
is given, use the UUID of the current sync run if available when naming the HAR file - Export HAR files to their own subdirectory
- If no
Http
- Rename
Http
toHttpUtil
for consistency with other component utility classes
Sync
- Rename "class resolvers" to "namespace helpers" to widen their scope for features like URI mapping in the future
- Rename
SyncClassResolverInterface
toSyncNamespaceHelperInterface
, and rename its methods for consistency:entityToProvider()
->getEntityProvider()
providerToEntity()
->getProviderEntities()
- Rename
getClassResolver()
methods togetNamespaceHelper()
- Rename
- Review
SyncStoreInterface
/SyncStore
/Sync
:- Accept provider signatures in
getProviderId()
- Accept provider IDs in
getProvider()
, and if the provider is not registered, throw an exception instead of returningnull
- Rename entity type-related methods for clarity:
registerEntity()
->registerEntityType()
getEntityId()
->getEntityTypeId()
getEntityUri()
->getEntityTypeUri()
(and do not returnnull
)getEntityPrefix()
->getNamespacePrefix()
- Accept provider signatures in
- Rename interfaces:
SyncEntityLinkType
->LinkType
SyncEntitySource
->EntitySource
SyncEntityState
->EntityState
SyncErrorType
->ErrorType
v0.99.53
Added
Cli
- Add
CliApplication
methodgetVersionString()
Utility
- Add
Str::startsWith()
,Str::endsWith()
andStr::isAscii()
- Add
Regex::quoteReplacement()
Changed
Utility
- Rename
Str
methods:toSnakeCase()
->snake()
toKebabCase()
->kebab()
toCamelCase()
->camel()
toPascalCase()
->pascal()
toWords()
->words()
- Allow ref to be suppressed unconditionally in
Package
methodsversion()
andgetPackageVersion()
- Change
TKey
type fromarray-key
tomixed
inArr
methodsunique()
,whereNotNull()
,whereNotEmpty()
,trim()
,lower()
,upper()
,snakeCase()
,toScalars()
andtoStrings()
Removed
Utility
- Remove
Str::title()
- Remove
Test::isAsciiString()
Fixed
Cli
- Fix issue where
CliApplication::reportVersion()
may print the commit reference twice or print empty brackets when there is no reference
PHPDoc
- Fix issue where trait aliases are not followed
- Work around PHP 7.4 bug where
ReflectionMethod
does not honour trait aliases
Utility
- Fix issue where
Str::words()
may return unexpected results when$separator
contains'\'
,'$'
or a preserved character - Fix
Str::expandLeadingTabs()
issue where tabs after a falsey value at the start of the first line may not be preserved
v0.99.52
v0.99.51
Added
Curler
- Add
Curler
methodalwaysPaginates()
PHPStan
- Add
TypesAssignedByHasMutatorRule
to check property changes made byHasMutator
(previouslyHasImmutableProperties
)
Sync
- Add
HttpSyncProvider::getAlwaysPaginate()
method - Add
$alwaysPaginate
parameter toHttpSyncProvider::getCurler()
- Add
HttpSyncDefinition::$AlwaysPaginate
property - Add
$alwaysPaginate
parameter toHttpSyncDefinition::withPager()
for consistency with the equivalentCurler
method
Changed
Console
- In
ConsoleTagFormats
:- Implement
Immutable
- Rename
set()
towithFormat()
and return a copy - Rename
get()
togetFormat()
- Implement
- Extend
Immutable
fromConsoleFormatterInterface
Core
- In
HasImmutableProperties
, require implementation ofImmutable
- Rename
HasImmutableProperties
toHasMutator
- Rename
HasMutator::withPropertyValue()
towith()
- Rename
HasMutator::withoutProperty()
towithout()
- Make
HasMutator
methods private for better safety by default
Curler
- Accept and return request objects in
Curler
methodreplaceQuery()
- Don't extend
CurlerPageRequestInterface
fromCurlerPageInterface
- Reinstate
CurlerPageInterface
methodshasNextRequest()
andgetNextRequest()
- Allow
CurlerPageInterface::getNextRequest()
to returnCurlerPageRequestInterface
for consistency withCurlerPagerInterface::getFirstRequest()
- Add
TPage
template toCurlerPagerInterface::getPage()
- Rename
CurlerPageRequestInterface::getNextRequest()
togetRequest()
- Rename
CurlerPageRequestInterface::getNextQuery()
togetQuery()
- Extend
Immutable
fromCurlerInterface
Http
- Accept and return request objects in
Http::mergeQuery()
andHttp::replaceQuery()
Removed
Core
- Remove
HasMutator::clone()
(previouslyHasImmutableProperties::clone()
)
Curler
- Remove
CurlerPageRequestInterface::hasNextRequest()
Fixed
Sync
- Fix incorrect documentation that indicates
HttpSyncProvider::getCurler()
arguments take precedence overHttpSyncProvider::filterCurler()
v0.99.50
v0.99.49
Added
Contract
- Add
StreamWrapper
, an abstraction of thestreamWrapper
prototype class described in the PHP manual
Curler
- Add
CurlerPageRequest
and allow it to be returned fromCurlerPagerInterface::getFirstRequest()
to minimise query string deserialization between requests - Add
CurlerPage
methodsgetCurrent()
andgetTotal()
, which return$current
and$total
values passed to__construct()
, so progress can be tracked across responses if needed - Add
AbstractRequestException
andAbstractResponseException
to API so middleware can extend them
Testing
(new)
- Add
MockPhpStream
- Add
MockTarget
(fromConsole
)
Changed
Curler
- In
CurlerPagerInterface::getPage()
, add$response
and$query
parameters to simplify pager code and improve consistency - Move
isLastPage()
andgetNextRequest()
fromCurlerPageInterface
toCurlerPageRequestInterface
and extend the latter from the former - Replace
isLastPage()
withhasNextRequest()
Sli
- Review
sli
subcommand names
Sync
- Move
SendHttpRequest
fromSli
toSync
, rename it toSendHttpSyncProviderRequest
, and refactor for consistency - Rename
GetSyncEntities
toGetSyncEntity
for consistency
Removed
Console
- Remove
ConsoleInvalidTargetException
Curler
- Remove redundant
HttpErrorExceptionInterface::getStatusCode()
andisNotFoundError()
methods
Fixed
Curler
- Fix
Curler
issue where initial query is not passed to pagers - Fix
Curler
pagination issue where entities are returned with the same keys for each page of data
Sync
- Fix
SyncEntityProvider
issue where upstream iterator keys are preserved unnecessarily, leading to possible data loss
v0.99.48
Added
Container
- Add application method
getHarFilename()
Changed
Container
- In application method
exportHar()
:- Defer creation of HAR file until first
Curler
request - Allow
$uuid
to be given via callback (e.g. to matchSync::getRunUuid()
)
- Defer creation of HAR file until first
Curler
- Add optional
$event
parameter toCurlerHarRecorder::start()
Fixed
Http
- Fix
OAuth2Client
issue where a stale JWKS may not be refreshed - Fix
HttpHeaders
issue wheregetLines()
returns unsorted headers after the collection is sorted or reversed - Add and implement
HttpHeadersInterface::canonicalize()
to resolve issue whereHttpHeaders::getLines()
may return headers in an order not compliant with [RFC7230]
v0.99.47
Changed
Console
- Adopt "^ " instead of "? " as the default warning message prefix
Curler
- Rename
CurlerHttpArchiveRecorder
toCurlerHarRecorder
- Follow
Location
headers inCurler
instead of enabling cURL'sCURLOPT_FOLLOWLOCATION
option- This allows
CurlerHarRecorder
to be used when following redirects - It will also allow redirect behaviour, including caching, to be customised in a future release
- This allows
- Throw
TooManyRedirectsException
ifMaxRedirects
is exceeded inCurler
- Improve cache stability by serializing header values, not
HttpHeaders
instances, when caching responses inCurler
- Don't silently remove query and fragment from request URI in
Curler::withRequest()
- An exception is now thrown if the given URI has a query or fragment
Fixed
Curler
- Fix issue where
Curler
response cache resolves equivalent requests separately if one has an empty path and the other path is"/"
- Fix
Curler
issue where HTTP error responses are cached if they are not thrown - Fix
Curler
issue where request bodies larger than 2MiB are not rewound when they are retried after "429 Too Many Requests"- An exception is now thrown if a request body cannot be rewound after redirection or "429 Too Many Requests"
- Fix
Curler
issue where multiple response bodies may be returned as one when a request is retried after "429 Too Many Requests"