Releases: salient-labs/toolkit
Releases · salient-labs/toolkit
v0.99.60
Added
Cli
- Add new
CliOptionvalue types:FLOATDIRECTORY_OR_DASHNEW_PATHNEW_FILENEW_DIRECTORYNEW_PATH_OR_DASHNEW_FILE_OR_DASHNEW_DIRECTORY_OR_DASH
Core
- Add
HasMutator::handlePropertyChanged() - Add
MetricCollector::add()
PHPDoc
- Add support for
@methodtags - Add
PHPDocmethodsfromTags(),getOriginal(),flatten()
Changed
PHPDoc
- In
PHPDoc::inherit():- Inherit descriptions via inline
{@inheritDoc}tags - Sync merged
@param/@return/@vartags with tags returned byPHPDoc::getTags()instead of inheriting every unique tag - Simplify
@templateinheritance
- Inherit descriptions via inline
- Implement
StringableinPHPDoc - In
PHPDocUtil::getAllClassDocComments(), only return interfaces when$classis an interface (to prevent classes inheriting interface DocBlocks)
Sli
- In
AnalyseClass:- Replace
--formatoption with--json,--csvand--markdownoptions - Add
--skip=inheritedand--skip-fromoptions - Sort inherited members by declaring class and line number (if known)
- Sort classes and members consistently across all output types
- Remove namespaces from constant parameter default values
- Improve readability of Markdown output, e.g. by rendering declarations in member headers where possible
- Add
m_needsDocCommentto CSV output - Collect and report statistics
- Replace
Utility
- Rename
Str::toMarkdown()toescapeMarkdown()and escape Markdown tags only where necessary - Add optional
$strictparameter toArr::unique()and others
Fixed
Cli
- Fix issue where
CliOptionvalue uniqueness is not enforced when value type isDATE
Container
- Fix metric reporting regression in
Application
PHPDoc
- Fix
PHPDocUtil::getAllMethodDocComments()issue where internalenummethods fail to resolve
Sli
- Fix
AnalyseClassissue wherem_typeis overwritten in CSV output - Fix inconsistent handling of line endings in
AnalyseClass
Utility
- Fix inconsistent
Str::escapeMarkdown()output with CRLF input
v0.99.59
Added
PHPDoc
- Add
PHPDocUtil::getAllConstantDocComments() - Add
$fromClassparameter toPHPDocUtil::getAllPropertyDocComments()
Sli
- Add traits used, constants and properties to
AnalyseClassoutput - Add
--skipoption toAnalyseClasscommand - Add
TokenExtractor::getProperties()andgetConstants() - Add
NavigableToken::getNextSibling()andgetNextCodeOrCloseTag()
Utility
- Add
Reflect::getTraitProperty()andgetTraitConstant() - Add
Str::toMarkdown()
Changed
Utility
- Allow
Arr::unset()to remove multiple keys per call
Removed
PHPDoc
- Remove
$includeInterfacesparameter fromPHPDocUtil::getAllClassDocComments()(recently added but superfluous)
Fixed
Sli
- Add missing
functionkeyword to Markdown generated byAnalyseClass - Fix inconsistent JSON output from
AnalyseClass - Fix cases where
TokenExtractorfails or returns unexpected tokens
v0.99.58
Added
PHPDoc
- Add
PHPDoc::hasTag(),hasReturn(),getTemplatesForTag()andisEmpty() - Add support for default template values (e.g.
@template T of object = stdClass)
Sli
- Add
AnalyseClasscommand for code analysis via JSON, CSV or Markdown
Utility
- Add
Reflect::getTraitMethod()andgetTraitAliases()
Changed
PHPDoc
- Make
$docBlockparameter ofPHPDoc::__construct()nullable and optional - Allow a
PHPDocinstance to be passed to the$classDocBlockparameter ofPHPDoc::__construct() - Remove
PHPDoc::$Tagsand rename$TagsByNameto$Tags - Replace
PHPDocproperties with getters - Don't move
@vardescriptions to thePHPDocif they have a name - Normalise
@vartags only whenPHPDoc::normalise()is called - Add
GenericTagand return instances viaPHPDoc::getTags() - Make all PHPDoc tag classes
Stringable - For
@templatetags with no type, returnnullinstead of"mixed"fromTemplateTag::getType() - Allow horizontal whitespace before PHPDoc tags
- Detect tags in DocBlocks with no blank line after the summary (for consistency with other tools)
- Ignore
@apitags inPHPDoc::hasDetail() - Rename
PHPDoc::mergeInherited()toPHPDoc::inherit()and return a modified instance - Only inherit known inheritable tags as per PSR-19
- Improve trait method matching in
PHPDocUtil::isMethodInClass() - Add
PHPDocUtil::getAllClassDocComments()parameter$includeAll - Move
PHPDoc::normaliseType()toPHPDocUtil - Move
PHPDoc::unwrap()toStr::collapse() - Match
pure-callable,pure-Closureand unsealed array shapes inPHPDocRegex::PHPDOC_TYPE
Utility
- Update
Arr::split()return type annotation
Removed
PHPDoc
- Remove
InvalidTagValueException(unused after refactoring)
Fixed
PHPDoc
- Fix issue where metadata is incorrectly taken from
@paramand@vardescriptions that start on their own line - Fix issue where leading asterisks are removed from PHPDoc summaries
Utility
- Work around
ReflectionMethod::getPrototype()bugs on PHP < 8.2 inReflect::getPrototype()
v0.99.57
v0.99.56
Added
Utility
- Add
File::getIdentifier() - Add
Get::list() - Add
Reflect::getPrototype() - Add
ShouldNotHappenException
Changed
PHPDoc
- Add optional
$includeInterfacesparameter 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_REFERENCEis enabled
v0.99.55
Added
Contract
- Add
Flushable - Add
Instantiableand require facade services to implement it
Sync
- Add
ReflectionSyncEntityandReflectionSyncProvider - Add
SyncUtilmethodsgetStore(),getEntityTypeProvider(),getProviderEntityTypes() - Add context methods:
getEntityType()withEntityType()recursionDetected()hasFilter()getFilters()(necessary after making$keyrequired 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
Exceptionnamespace - Move entity-related interfaces to
Entitynamespace - Move provider-related interfaces to
Providernamespace - Move
Cardinalityconstants toRelatable - Rename
ArrayMapperFlagtoArrayMapperInterface, addmap()method, and implement inArrayMapper - Rename
HierarchyInterfacetoHierarchical, 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
inttype to$conformityparameters
Http
- Add
$orSameparameter togetOneHeaderLine()methods
Sync
- Move
SyncIntrospectormethodsisListOperation()andisWriteOperation()toSyncUtil - Rename
SyncNamespaceHelperInterfacemethods for consistency (again):getEntityProvider()->getEntityTypeProvider()getProviderEntities()->getProviderEntityTypes()
- Rename context methods:
stack()->getEntities()last()->getLastEntity()push()->pushEntity()withFilter()->withOperation()and add$entityTypeparameter
- 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
DateTimeInterfaceinstances
- Merge received conformity levels when a context is passed to
Providable::provide()orprovideMultiple()
Utility
- In
Arr::pluck(), simplify parameter names and returnnullfor 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
$trimTrailingWhitespaceto$trimLines
- In
Str::mergeLists():- Update parameter names
- Don't add a space to
$headingPrefix - Make
$itemRegexnullable, and fall back to its default value whennullis given - Add
$discardEmpty,$eol,$tabSizeparameters
- 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:
EnumerationInterfaceConvertibleEnumerationInterfaceDictionaryInterfaceAbstractCatalogAbstractEnumerationAbstractConvertibleEnumerationAbstractReflectiveEnumerationAbstractDictionary
- Remove
Cardinality - Remove
NormaliserFactory - Remove
Extensiblemethods:setMetaProperty(),getMetaProperty(),isMetaPropertySet(),unsetMetaProperty() - Remove
$containerparameter fromProviderInterface::getContext()
Sync
- Remove
SyncIntrospectormethodsisReadOperation(),getEntityProvider(),getProviderEntities() - Remove context methods:
pushWithRecursionCheck()(pushEntity()now has an optional$detectRecursionparameter)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
ArrayMapperignoresREQUIRE_MAPPEDifADD_MISSINGis also applied - Fix
ExtensibleTraitissue 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/SyncmethodshasProvider(),hasEntityType()andgetEntityType()for completeness - Add
SyncUtilwithgetEntityTypeUri()
Changed
Container
- In
Application::exportHar():- If no
$uuidis 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
HttptoHttpUtilfor 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
SyncClassResolverInterfacetoSyncNamespaceHelperInterface, 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->LinkTypeSyncEntitySource->EntitySourceSyncEntityState->EntityStateSyncErrorType->ErrorType
v0.99.53
Added
Cli
- Add
CliApplicationmethodgetVersionString()
Utility
- Add
Str::startsWith(),Str::endsWith()andStr::isAscii() - Add
Regex::quoteReplacement()
Changed
Utility
- Rename
Strmethods:toSnakeCase()->snake()toKebabCase()->kebab()toCamelCase()->camel()toPascalCase()->pascal()toWords()->words()
- Allow ref to be suppressed unconditionally in
Packagemethodsversion()andgetPackageVersion() - Change
TKeytype fromarray-keytomixedinArrmethodsunique(),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
ReflectionMethoddoes not honour trait aliases
Utility
- Fix issue where
Str::words()may return unexpected results when$separatorcontains'\','$'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
CurlermethodalwaysPaginates()
PHPStan
- Add
TypesAssignedByHasMutatorRuleto check property changes made byHasMutator(previouslyHasImmutableProperties)
Sync
- Add
HttpSyncProvider::getAlwaysPaginate()method - Add
$alwaysPaginateparameter toHttpSyncProvider::getCurler() - Add
HttpSyncDefinition::$AlwaysPaginateproperty - Add
$alwaysPaginateparameter toHttpSyncDefinition::withPager()for consistency with the equivalentCurlermethod
Changed
Console
- In
ConsoleTagFormats:- Implement
Immutable - Rename
set()towithFormat()and return a copy - Rename
get()togetFormat()
- Implement
- Extend
ImmutablefromConsoleFormatterInterface
Core
- In
HasImmutableProperties, require implementation ofImmutable - Rename
HasImmutablePropertiestoHasMutator - Rename
HasMutator::withPropertyValue()towith() - Rename
HasMutator::withoutProperty()towithout() - Make
HasMutatormethods private for better safety by default
Curler
- Accept and return request objects in
CurlermethodreplaceQuery() - Don't extend
CurlerPageRequestInterfacefromCurlerPageInterface - Reinstate
CurlerPageInterfacemethodshasNextRequest()andgetNextRequest() - Allow
CurlerPageInterface::getNextRequest()to returnCurlerPageRequestInterfacefor consistency withCurlerPagerInterface::getFirstRequest() - Add
TPagetemplate toCurlerPagerInterface::getPage() - Rename
CurlerPageRequestInterface::getNextRequest()togetRequest() - Rename
CurlerPageRequestInterface::getNextQuery()togetQuery() - Extend
ImmutablefromCurlerInterface
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()