Skip to content

Releases: salient-labs/toolkit

v0.99.70

23 Jan 12:47
v0.99.70
e3a89c1

Choose a tag to compare

Changed

  • Adopt ReflectionClass<*> instead of ReflectionClass<object> to work around T not being covariant on PHPStan 2.1.2 + PHP 8.4

Polyfill

  • Remove dependency on salient/utils

Fixed

Polyfill

  • Fix issue where PhpToken doesn't tokenize binary strings like b"$foo" correctly
  • Fix issue where PhpToken fails if salient/sli is not installed

Security

Utility

  • Optionally honour umask in File::create() and createDir()

v0.99.69

22 Jan 12:19
v0.99.69
0c4bf67

Choose a tag to compare

Added

Utility

  • Add File::createTemp() for completeness

Changed

Utility

  • Rename File::getCleanDir() to sanitiseDir()
  • In File, remove resource type checks in favour of upstream exceptions

Fixed

Utility

  • Fix issue where File::createTempDir() consumes full CPU indefinitely if given a directory that is not writable (or not a directory)

Security

Utility

  • In File::create() and createDir():
    • Change default permissions from 0777 to 0755
    • Use umask 0077 to prevent access by an attacker before permissions are applied
    • In create(), open files with mode 'x' instead of using touch() to create them

v0.99.68

14 Jan 05:58
v0.99.68
0c211b1

Choose a tag to compare

Added

PHPStan

  • Add HasMutatorReadWritePropertiesExtension to resolve errors like property.unused and property.unusedType in classes that insert HasMutator

Sync

  • Add SyncUtil::getServicedEntityType()

Changed

Sync

  • In SyncEntityProvider, resolve custom entity types to base entities serviced by the provider if necessary

    This change means sync operations performed on a $provider via $provider->with(<entity>::class) are resolved against a parent of <entity> if:

    • $provider doesn't service <entity> but does service one of its non-abstract parents, and
    • the service container resolves that parent to <entity>

v0.99.67

13 Jan 12:02
v0.99.67
886e4fb

Choose a tag to compare

Changed

Sli

  • Generate sync entity providers that return iterable<array-key,TEntity> instead of iterable<TEntity>, as per Sync change in v0.99.63

v0.99.66

13 Jan 06:44
v0.99.66
f44ff66

Choose a tag to compare

Changed

Cli

  • Don't let applications run as root by default

Core

  • Rename Chainable methods for clarity:
    • if() -> applyIf()
    • withEach() -> applyForEach()

Sli

  • Update default builder description to "A builder for <class>"

v0.99.65

09 Dec 14:06
v0.99.65
60c8c02

Choose a tag to compare

Added

Collection

  • Add and implement isEmpty()
  • Add PHPStan assertions that narrow the return types of all(), first() and last() when a collection is non-empty

Changed

Utility

  • Accept ReflectionConstant in Reflect::getNames()

Fixed

Utility

  • Fix issue where Get::code() may not match the longest possible string in $constants, generating output like "Type::PROPERTY . '_HOOK'" instead of "Type::PROPERTY_HOOK"

v0.99.64

29 Nov 06:37
v0.99.64
1c2fa49

Choose a tag to compare

Changed

Collection

  • Move ListInterface methods to CollectionInterface
  • Use PHPStan conditional parameter types to vary forEach(), map(), filter() and find() callback signatures by $mode
  • Return a modified instance from collection methods that previously operated on a single instance:
    • set()
    • unset()
    • add()
    • merge()
    • pop()
    • shift()
  • Adopt iterable as return type for protected getItems() and filterItems() methods
  • In list collections, silently replace invalid keys instead of throwing an exception
  • Replace AbstractTypedCollection and Collection with non-final Collection
  • Replace AbstractTypedList and ListCollection with non-final ListCollection
  • Rename:
    • ListTrait -> ListCollectionTrait
    • ReadableCollectionTrait -> ReadOnlyCollectionTrait
  • Rename ImmutableArrayAccessTrait to ReadOnlyArrayAccessTrait and move it back to the Collection namespace

Http

  • Rename HttpHeadersInterface::add() to append() to resolve conflict with CollectionInterface::add()
  • In HttpHeaders:
    • Implement methods added to CollectionInterface
    • Replace generateItems() with getItems() now that the ReadOnlyCollectionTrait method can return iterable
    • Implement CollectionInterface::map()

Utility

  • Update Debug::getCaller() to work with PHP 8.4's backtrace changes

Removed

Collection

  • Remove ListInterface
  • Remove "immutable" collections and traits:
    • ImmutableCollection
    • ImmutableCollectionTrait
    • ImmutableListCollection
    • ImmutableListTrait
  • Remove redundant collection methods empty() and copy()

Core

  • Remove ImmutableArrayAccessTrait (moved to Collection component as ReadOnlyArrayAccessTrait)

Fixed

Collection

  • Fix issue where numeric keys are reindexed when shift() is called on a collection

Core

  • Remove references to E_STRICT constant (deprecated in PHP 8.4)

v0.99.63

16 Nov 06:28
v0.99.63
8450cac

Choose a tag to compare

Changed

PHPStan

  • Adopt PHPStan 2.0

Sync

  • Require list operations to return iterable<array-key,TEntity>, not just iterable<TEntity>

Utility

  • Accept scalar and Stringable arguments to Str::coalesce()

v0.99.62

14 Nov 04:20
v0.99.62
758238a

Choose a tag to compare

Added

PHPDoc

  • Add PHPDoc::getClassTemplates()

Changed

Container

  • Require Application::startSync() arguments to be strings

Core

  • Require new keys passed to SerializeRulesInterface to be strings
  • In HasBuilder trait:
    • Use self instead of static to derive getBuilder() return value
    • Remove final from method declarations to allow reinsertion by subclasses

Iterator

  • Update return type of FluentIteratorInterface::nextWithValue() to indicate TValue must be an object or array
  • In FluentIteratorTrait::nextWithValue(), remove special handling of ArrayAccess objects
  • In RecursiveFilesystemIterator::nextWithValue(), don't reject keys that resolve to getFileInfo() or getPathInfo()

PHPDoc

  • Rename PHPDoc::getTemplatesForTag() to getTagTemplates()

Sli

  • In generate builder:
    • Include constructor templates in declared methods if they appear in the relevant parameter type
    • Preserve original template names if possible

Utility

  • Improve Arr::wrap() and Arr::wrapList() return type annotations

Fixed

Container

  • Fix issue where fallback arguments passed to the entity store may not be not strings

Utility

  • Fix File::isSeekableStream() and File::isStream() assertions

v0.99.61

02 Nov 12:16
v0.99.61
7b208bf

Choose a tag to compare

Added

PHPDoc

  • Add support for @property tags and their -read/-write variants
  • Add and adopt PHPDoc factory methods: forClass(), forMethod(), forProperty(), forConstant()

Sli

  • Add PHPDoc descriptions and "magic" properties and methods to AnalyseClass output

Changed

Console

  • Simplify ConsoleWriter::exception() output

PHPDoc

  • Add an ErrorTag to the PHPDoc instead of throwing an exception when an invalid tag is encountered
  • Close unterminated code fences instead of throwing an exception
  • Expand aliases (optionally passed to PHPDoc::__construct()) when parsing DocBlocks
  • In PHPDoc::normalise(), if the PHPDoc has one @var tag with the same name as the property the instance is associated with, remove the name from the tag
  • Allow @method, @property* and @mixin tags to be inherited from interfaces and traits by classes
  • Don't return one-line DocBlocks from PHPDoc::__toString()
  • Don't inherit specialised @template tags
  • Rename PHPDocUtil::getParameterPHPDoc() to getParameterTag()
  • Handle @template variance via boolean values instead of a string
  • Improve consistency of tag constructors

PHPStan

  • Add property visibility check to HasMutator rule

Sli

In AnalyseClass:

  • Catch and report PHPDoc errors
  • Suppress inherited summaries and descriptions
  • Improve Markdown output
  • Propagate imports to PHPDoc for type expansion

Fixed

PHPDoc

  • Fix regression where DocBlocks with default values in @method parameters trigger an exception