Skip to content

Releases: salient-labs/toolkit

v0.99.60

30 Oct 11:56
v0.99.60
4b02ecd

Choose a tag to compare

Added

Cli

  • Add new CliOption value types:
    • FLOAT
    • DIRECTORY_OR_DASH
    • NEW_PATH
    • NEW_FILE
    • NEW_DIRECTORY
    • NEW_PATH_OR_DASH
    • NEW_FILE_OR_DASH
    • NEW_DIRECTORY_OR_DASH

Core

  • Add HasMutator::handlePropertyChanged()
  • Add MetricCollector::add()

PHPDoc

  • Add support for @method tags
  • Add PHPDoc methods fromTags(), getOriginal(), flatten()

Changed

PHPDoc

  • In PHPDoc::inherit():
    • Inherit descriptions via inline {@inheritDoc} tags
    • Sync merged @param/@return/@var tags with tags returned by PHPDoc::getTags() instead of inheriting every unique tag
    • Simplify @template inheritance
  • Implement Stringable in PHPDoc
  • In PHPDocUtil::getAllClassDocComments(), only return interfaces when $class is an interface (to prevent classes inheriting interface DocBlocks)

Sli

  • In AnalyseClass:
    • Replace --format option with --json, --csv and --markdown options
    • Add --skip=inherited and --skip-from options
    • 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_needsDocComment to CSV output
    • Collect and report statistics

Utility

  • Rename Str::toMarkdown() to escapeMarkdown() and escape Markdown tags only where necessary
  • Add optional $strict parameter to Arr::unique() and others

Fixed

Cli

  • Fix issue where CliOption value uniqueness is not enforced when value type is DATE

Container

  • Fix metric reporting regression in Application

PHPDoc

  • Fix PHPDocUtil::getAllMethodDocComments() issue where internal enum methods fail to resolve

Sli

  • Fix AnalyseClass issue where m_type is overwritten in CSV output
  • Fix inconsistent handling of line endings in AnalyseClass

Utility

  • Fix inconsistent Str::escapeMarkdown() output with CRLF input

v0.99.59

24 Oct 12:32
v0.99.59
7ad4465

Choose a tag to compare

Added

PHPDoc

  • Add PHPDocUtil::getAllConstantDocComments()
  • Add $fromClass parameter to PHPDocUtil::getAllPropertyDocComments()

Sli

  • Add traits used, constants and properties to AnalyseClass output
  • Add --skip option to AnalyseClass command
  • Add TokenExtractor::getProperties() and getConstants()
  • Add NavigableToken::getNextSibling() and getNextCodeOrCloseTag()

Utility

  • Add Reflect::getTraitProperty() and getTraitConstant()
  • Add Str::toMarkdown()

Changed

Utility

  • Allow Arr::unset() to remove multiple keys per call

Removed

PHPDoc

  • Remove $includeInterfaces parameter from PHPDocUtil::getAllClassDocComments() (recently added but superfluous)

Fixed

Sli

  • Add missing function keyword to Markdown generated by AnalyseClass
  • Fix inconsistent JSON output from AnalyseClass
  • Fix cases where TokenExtractor fails or returns unexpected tokens

v0.99.58

22 Oct 06:24
v0.99.58
55b1273

Choose a tag to compare

Added

PHPDoc

  • Add PHPDoc::hasTag(), hasReturn(), getTemplatesForTag() and isEmpty()
  • Add support for default template values (e.g. @template T of object = stdClass)

Sli

  • Add AnalyseClass command for code analysis via JSON, CSV or Markdown

Utility

  • Add Reflect::getTraitMethod() and getTraitAliases()

Changed

PHPDoc

  • Make $docBlock parameter of PHPDoc::__construct() nullable and optional
  • Allow a PHPDoc instance to be passed to the $classDocBlock parameter of PHPDoc::__construct()
  • Remove PHPDoc::$Tags and rename $TagsByName to $Tags
  • Replace PHPDoc properties with getters
  • Don't move @var descriptions to the PHPDoc if they have a name
  • Normalise @var tags only when PHPDoc::normalise() is called
  • Add GenericTag and return instances via PHPDoc::getTags()
  • Make all PHPDoc tag classes Stringable
  • For @template tags with no type, return null instead of "mixed" from TemplateTag::getType()
  • Allow horizontal whitespace before PHPDoc tags
  • Detect tags in DocBlocks with no blank line after the summary (for consistency with other tools)
  • Ignore @api tags in PHPDoc::hasDetail()
  • Rename PHPDoc::mergeInherited() to PHPDoc::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() to PHPDocUtil
  • Move PHPDoc::unwrap() to Str::collapse()
  • Match pure-callable, pure-Closure and unsealed array shapes in PHPDocRegex::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 @param and @var descriptions 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 in Reflect::getPrototype()

v0.99.57

15 Oct 22:43
v0.99.57
48738d1

Choose a tag to compare

Fixed

Polyfill

  • Fix line calculation regression in PhpToken

v0.99.56

15 Oct 05:44
v0.99.56
3d24403

Choose a tag to compare

Added

Utility

  • Add File::getIdentifier()
  • Add Get::list()
  • Add Reflect::getPrototype()
  • Add ShouldNotHappenException

Changed

PHPDoc

  • Add optional $includeInterfaces parameter to PHPDocUtil::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 when COPY_BY_REFERENCE is enabled

v0.99.55

08 Oct 07:43
v0.99.55
4f9363e

Choose a tag to compare

Added

Contract

  • Add Flushable
  • Add Instantiable and require facade services to implement it

Sync

  • Add ReflectionSyncEntity and ReflectionSyncProvider
  • Add SyncUtil methods getStore(), getEntityTypeProvider(), getProviderEntityTypes()
  • Add context methods:
    • getEntityType()
    • withEntityType()
    • recursionDetected()
    • hasFilter()
    • getFilters() (necessary after making $key required in getFilter())
    • hasOperation()
    • getOperation()
    • withOffline()
  • Add provider methods runOperation() and filterOperationOutput() to formalise policy enforcement

Utility

  • Add Arr::combine() and adopt instead of array_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 to Relatable
  • Rename ArrayMapperFlag to ArrayMapperInterface, add map() method, and implement in ArrayMapper
  • Rename HierarchyInterface to Hierarchical, and Hierarchical::getDescendantCount() to countDescendants()
  • Rename Normalisable::normalise() to normaliseProperty()
  • In Constructible:
    • Rename constructList() to constructMultiple()
    • Rearrange parameters in construct() and constructMultiple()
  • Rename Providable::provideList() to provideMultiple()
  • In Extensible:
    • Add getDynamicPropertiesProperty() and getDynamicPropertyNamesProperty()
    • Rename getMetaProperties() to getDynamicProperties()
    • Replace clearMetaProperties() with setDynamicProperties()
  • Add native int type to $conformity parameters

Http

  • Add $orSame parameter to getOneHeaderLine() methods

Sync

  • Move SyncIntrospector methods isListOperation() and isWriteOperation() to SyncUtil
  • 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() or provideMultiple()

Utility

  • In Arr::pluck(), simplify parameter names and return null 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 when null 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 from ProviderInterface::getContext()

Sync

  • Remove SyncIntrospector methods isReadOperation(), getEntityProvider(), getProviderEntities()
  • Remove context methods:
    • pushWithRecursionCheck() (pushEntity() now has an optional $detectRecursion parameter)
    • maybeThrowRecursionException() (replaced by recursionDetected())
    • getFilter{Int,String,ArrayKey,IntList,StringList,ArrayKeyList}()
    • claimFilter{Int,String,ArrayKey,IntList,StringList,ArrayKeyList}()
    • online(), offline(), offlineFirst() (replaced by withOffline())
    • applyFilterPolicy(), withFilterPolicyCallback()

Fixed

Core

  • Fix issue where ArrayMapper ignores REQUIRE_MAPPED if ADD_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

24 Sep 05:03
v0.99.54
e351289

Choose a tag to compare

Added

Sync

  • Add SyncStoreInterface/SyncStore/Sync methods hasProvider(), hasEntityType() and getEntityType() for completeness
  • Add SyncUtil with getEntityTypeUri()

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

Http

  • Rename Http to HttpUtil 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 to SyncNamespaceHelperInterface, and rename its methods for consistency:
      • entityToProvider() -> getEntityProvider()
      • providerToEntity() -> getProviderEntities()
    • Rename getClassResolver() methods to getNamespaceHelper()
  • 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 returning null
    • Rename entity type-related methods for clarity:
      • registerEntity() -> registerEntityType()
      • getEntityId() -> getEntityTypeId()
      • getEntityUri() -> getEntityTypeUri() (and do not return null)
      • getEntityPrefix() -> getNamespacePrefix()
  • Rename interfaces:
    • SyncEntityLinkType -> LinkType
    • SyncEntitySource -> EntitySource
    • SyncEntityState -> EntityState
    • SyncErrorType -> ErrorType

v0.99.53

20 Sep 05:05
v0.99.53
1b88769

Choose a tag to compare

Added

Cli

  • Add CliApplication method getVersionString()

Utility

  • Add Str::startsWith(), Str::endsWith() and Str::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 methods version() and getPackageVersion()
  • Change TKey type from array-key to mixed in Arr methods unique(), whereNotNull(), whereNotEmpty(), trim(), lower(), upper(), snakeCase(), toScalars() and toStrings()

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

17 Sep 06:51
v0.99.52
e757f1d

Choose a tag to compare

Added

Cli

  • Add CliApplicationInterface::reportVersion()

Sync

  • Add --har option to CLI commands

Changed

Cli

  • Change --version output to <app> <version> (<ref>) PHP <php-version>

v0.99.51

17 Sep 02:16
v0.99.51
6bd3d6f

Choose a tag to compare

Added

Curler

  • Add Curler method alwaysPaginates()

PHPStan

  • Add TypesAssignedByHasMutatorRule to check property changes made by HasMutator (previously HasImmutableProperties)

Sync

  • Add HttpSyncProvider::getAlwaysPaginate() method
  • Add $alwaysPaginate parameter to HttpSyncProvider::getCurler()
  • Add HttpSyncDefinition::$AlwaysPaginate property
  • Add $alwaysPaginate parameter to HttpSyncDefinition::withPager() for consistency with the equivalent Curler method

Changed

Console

  • In ConsoleTagFormats:
    • Implement Immutable
    • Rename set() to withFormat() and return a copy
    • Rename get() to getFormat()
  • Extend Immutable from ConsoleFormatterInterface

Core

  • In HasImmutableProperties, require implementation of Immutable
  • Rename HasImmutableProperties to HasMutator
  • Rename HasMutator::withPropertyValue() to with()
  • Rename HasMutator::withoutProperty() to without()
  • Make HasMutator methods private for better safety by default

Curler

  • Accept and return request objects in Curler method replaceQuery()
  • Don't extend CurlerPageRequestInterface from CurlerPageInterface
  • Reinstate CurlerPageInterface methods hasNextRequest() and getNextRequest()
  • Allow CurlerPageInterface::getNextRequest() to return CurlerPageRequestInterface for consistency with CurlerPagerInterface::getFirstRequest()
  • Add TPage template to CurlerPagerInterface::getPage()
  • Rename CurlerPageRequestInterface::getNextRequest() to getRequest()
  • Rename CurlerPageRequestInterface::getNextQuery() to getQuery()
  • Extend Immutable from CurlerInterface

Http

  • Accept and return request objects in Http::mergeQuery() and Http::replaceQuery()

Removed

Core

  • Remove HasMutator::clone() (previously HasImmutableProperties::clone())

Curler

  • Remove CurlerPageRequestInterface::hasNextRequest()

Fixed

Sync

  • Fix incorrect documentation that indicates HttpSyncProvider::getCurler() arguments take precedence over HttpSyncProvider::filterCurler()