Skip to content

Releases

v1.5.2

Choose a tag to compare

@paulbalandan paulbalandan released this 16 Nov 09:05
Immutable release. Only release title and notes can be modified.
v1.5.2
e44f804

What's Changed

Changed

  • The minimum PHPStan version is now 2.3.6. isBetween(), isGreaterThan(), isGreaterThanOrEqual(), isLessThan(), and isLessThanOrEqual() narrow the float arm to a float range, following PHPStan's float range support. isBetween(0, 10) gives float<0.0, 10.0>|int<0, 10> instead of float|int<0, 10>, and a chained isInt() or isFloat() narrows to the int range or the float range alone

Full Changelog: v1.5.1...v1.5.2

v1.5.1

Choose a tag to compare

@paulbalandan paulbalandan released this 08 Oct 18:09
Immutable release. Only release title and notes can be modified.
v1.5.1
41144cd

What's Changed

Changed

  • The minimum PHPStan version is now 2.2.15. The side-effect narrowings of contains(), startsWith(), endsWith(), matchesRegularExpression(), hasMinLength(), hasMaxLength(), and isUrl() are flagged with SpecifiedTypes::setEquality() instead of a synthetic FAUX_FUNCTION_* call, following phpstan/phpstan-src#5769. Narrowing, negation, and duplicate-call reporting are unchanged

Fixed

  • Restored the float arm of keys() / values() number comparisons on PHPStan 2.3.0. values()->isGreaterThan(5) narrows to iterable<float|int<6, max>> again instead of iterable<int<6, max>>, after PHPStan started typing the right side of || in the scope where the left side is false

Full Changelog: v1.5.0...v1.5.1

v1.5.0

Choose a tag to compare

@paulbalandan paulbalandan released this 04 Sep 05:46
Immutable release. Only release title and notes can be modified.
v1.5.0
7a67a5b

What's Changed

Added

  • isNumericString() expectation, narrowing to numeric-string. The runtime check is is_string + is_numeric, so it accepts exactly the values PHPStan counts as numeric-string, and unknown string literals prune to never
  • hasLength(int<1, max> $length) expectation for exact byte lengths, narrowing to non-falsy-string (non-empty-string for a length of 1). The failure context carries {length} and {actual} (the measured length), so a custom message can report a mismatch without exporting a secret-bearing value
  • isNonEmptyMap() expectation, narrowing to non-empty-array<string, mixed>
  • isGreaterThan(), isGreaterThanOrEqual(), isLessThan(), and isLessThanOrEqual() expectations for one-sided numeric bounds, narrowing to the bounded int range OR'd with the float arm (e.g. isGreaterThan(5) gives float|int<6, max>). Chained bounds clamp: isGreaterThanOrEqual(0)->isLessThanOrEqual(10) narrows to float|int<0, 10>
  • hasCount(int<0, max> $count), hasMinCount(int<0, max> $min), and hasMaxCount(int<0, max> $max) expectations for countables, narrowing to array<mixed>|Countable. A minimum of 1 or more and an exact count statically known to be positive narrow the array arm to non-empty-array<mixed>; hasCount(0) narrows it to array{}
  • isArrayAccessible() expectation, narrowing to array<mixed, mixed>|ArrayAccess

Full Changelog: v1.4.0...v1.5.0

v1.4.0

Choose a tag to compare

@paulbalandan paulbalandan released this 08 Aug 09:50
Immutable release. Only release title and notes can be modified.
v1.4.0
bcd1f1d

What's Changed

Added

  • isNonEmptyList() expectation, narrowing to non-empty-list<mixed>
  • isSameOrSubclassOf(class-string<T>|T $class) expectation, the non-strict counterpart of isSubclassOf, narrowing to class-string<T>|T for the given class as well as its subclasses. Unlike isSubclassOf, a literal class argument also narrows under not(), to mixed~(class-string<T>|T)
  • implementsInterface(class-string<T> $interface) expectation, narrowing to class-string<T>
  • isInstanceOfAny(non-empty-list<class-string> $classes) expectation, narrowing to the union of the given classes, or to object when the list is not known statically
  • isClassString() expectation, narrowing to class-string. Accepts interface names as well as class names, matching what PHPStan counts as a class-string

Changed

  • ExpectationMethodResolver::__construct() now takes a PHPStan\Reflection\ReflectionProvider. The service is autowired through extension.neon, so registration is unaffected

Full Changelog: v1.3.0...v1.4.0

v1.3.0

Choose a tag to compare

@paulbalandan paulbalandan released this 05 Aug 05:04
Immutable release. Only release title and notes can be modified.
v1.3.0
3bbcd0e

What's Changed

Added

  • isSubclassOf(class-string<T>|T $class) expectation, narrowing to class-string<T>|T for objects and class strings that are a strict subclass of the given class

Fixed

  • Restored the chained double-negation narrowing reported in v1.2.0's known issues. On PHPStan 2.2.8 and later, isInt()->not()->isNegativeInt()->isPositiveInt() narrows to 0 again instead of int<0, max>, following the upstream fix for phpstan/phpstan#15039

Full Changelog: v1.2.0...v1.3.0

v1.2.0

Choose a tag to compare

@paulbalandan paulbalandan released this 02 Aug 18:27
Immutable release. Only release title and notes can be modified.
v1.2.0
b21a4fe

What's Changed

Added

  • isIntOrNonEmptyString() expectation, narrowing to int|non-empty-string

Fixed

  • Restored type narrowing on PHPStan 2.2.7, which changed how the type specifier composes && and || conditions and left chained not() / nullOr() assertions widening back to their unnarrowed type

Changed

  • Bump shivammathur/setup-php from 2.37.0 to 2.37.1 in the actions group by @dependabot[bot] in #8
  • Bump the actions group across 1 directory with 2 updates by @dependabot[bot] in #10
  • Bump the actions group across 1 directory with 2 updates by @dependabot[bot] in #12
  • Bump actions/cache from 6.0.0 to 6.1.0 in the actions group by @dependabot[bot] in #13
  • Bump actions/checkout from 7.0.0 to 7.0.1 in the actions group by @dependabot[bot] in #14
  • Bump coverallsapp/github-action from 2.3.7 to 2.3.8 in the actions group by @dependabot[bot] in #15

Known issues

  • On PHPStan 2.2.7, a chain that negates two overlapping ranges (e.g. isInt()->not()->isNegativeInt()->isPositiveInt()) keeps only the first negation, narrowing to int<0, max> rather than 0. Tracked upstream at phpstan/phpstan#15039

Full Changelog: v1.1.1...v1.2.0

v1.1.1

Choose a tag to compare

@paulbalandan paulbalandan released this 11 May 09:33
Immutable release. Only release title and notes can be modified.
v1.1.1
c7066cf

What's Changed

Fixed

  • Preserved list<>, non-empty-list<>, and non-empty-array<> shapes when narrowing through keys() / values(); previously the rebuilt iterable lost its accessory wrappers (e.g. list<mixed> downgraded to array<int<0, max>, mixed>)

Full Changelog: v1.1.0...v1.1.1

v1.1.0

Choose a tag to compare

@paulbalandan paulbalandan released this 11 May 08:57
Immutable release. Only release title and notes can be modified.
v1.1.0
362d881

What's Changed

Added

  • keys() and values() iterating expectations to apply assertions across an iterable's keys or values
  • isBetween(float|int $min, float|int $max, bool $inclusive = true) expectation for numeric range checks
  • isOneOf(non-empty-list<mixed> $choices) expectation, with PHPStan narrowing to the union of literal allowed values when the list is constant
  • hasMinLength(int<1, max> $min) and hasMaxLength(int<1, max> $max) expectations for bounded-string checks
  • isUrl() expectation, backed by filter_var($value, FILTER_VALIDATE_URL)

Fixed

  • Improved failure-message wording for iterating expectations (keys(), values()) to clearly indicate which key or value triggered the failure

Full Changelog: v1.0.0...v1.1.0

v1.0.0

Choose a tag to compare

@paulbalandan paulbalandan released this 14 Mar 17:15
Immutable release. Only release title and notes can be modified.
v1.0.0
8961085

What's Changed

Added

  • Initial release of Nexus Assert library
  • Chainable type-safety assertions API
  • Dynamic method return type extensions for PHPStan support
  • Type inference for fluent assertions
  • Support for PHP 8.2+

New Contributors

Full Changelog: https://github.com/NexusPHP/assert/commits/v1.0.0