Skip to content

v1.5.0

Latest

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

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