Repository navigation
Releases
Releases · NexusPHP/assert
v1.5.2
Immutable
release. Only release title and notes can be modified.
What's Changed
Changed
- The minimum PHPStan version is now 2.3.6.
isBetween(),isGreaterThan(),isGreaterThanOrEqual(),isLessThan(), andisLessThanOrEqual()narrow the float arm to a float range, following PHPStan's float range support.isBetween(0, 10)givesfloat<0.0, 10.0>|int<0, 10>instead offloat|int<0, 10>, and a chainedisInt()orisFloat()narrows to the int range or the float range alone
Full Changelog: v1.5.1...v1.5.2
v1.5.1
Immutable
release. Only release title and notes can be modified.
What's Changed
Changed
- The minimum PHPStan version is now 2.2.15. The side-effect narrowings of
contains(),startsWith(),endsWith(),matchesRegularExpression(),hasMinLength(),hasMaxLength(), andisUrl()are flagged withSpecifiedTypes::setEquality()instead of a syntheticFAUX_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 toiterable<float|int<6, max>>again instead ofiterable<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
Immutable
release. Only release title and notes can be modified.
What's Changed
Added
isNumericString()expectation, narrowing tonumeric-string. The runtime check isis_string+is_numeric, so it accepts exactly the values PHPStan counts asnumeric-string, and unknown string literals prune toneverhasLength(int<1, max> $length)expectation for exact byte lengths, narrowing tonon-falsy-string(non-empty-stringfor 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 valueisNonEmptyMap()expectation, narrowing tonon-empty-array<string, mixed>isGreaterThan(),isGreaterThanOrEqual(),isLessThan(), andisLessThanOrEqual()expectations for one-sided numeric bounds, narrowing to the bounded int range OR'd with the float arm (e.g.isGreaterThan(5)givesfloat|int<6, max>). Chained bounds clamp:isGreaterThanOrEqual(0)->isLessThanOrEqual(10)narrows tofloat|int<0, 10>hasCount(int<0, max> $count),hasMinCount(int<0, max> $min), andhasMaxCount(int<0, max> $max)expectations for countables, narrowing toarray<mixed>|Countable. A minimum of 1 or more and an exact count statically known to be positive narrow the array arm tonon-empty-array<mixed>;hasCount(0)narrows it toarray{}isArrayAccessible()expectation, narrowing toarray<mixed, mixed>|ArrayAccess
Full Changelog: v1.4.0...v1.5.0
v1.4.0
Immutable
release. Only release title and notes can be modified.
What's Changed
Added
isNonEmptyList()expectation, narrowing tonon-empty-list<mixed>isSameOrSubclassOf(class-string<T>|T $class)expectation, the non-strict counterpart ofisSubclassOf, narrowing toclass-string<T>|Tfor the given class as well as its subclasses. UnlikeisSubclassOf, a literal class argument also narrows undernot(), tomixed~(class-string<T>|T)implementsInterface(class-string<T> $interface)expectation, narrowing toclass-string<T>isInstanceOfAny(non-empty-list<class-string> $classes)expectation, narrowing to the union of the given classes, or toobjectwhen the list is not known staticallyisClassString()expectation, narrowing toclass-string. Accepts interface names as well as class names, matching what PHPStan counts as aclass-string
Changed
ExpectationMethodResolver::__construct()now takes aPHPStan\Reflection\ReflectionProvider. The service is autowired throughextension.neon, so registration is unaffected
Full Changelog: v1.3.0...v1.4.0
v1.3.0
Immutable
release. Only release title and notes can be modified.
What's Changed
Added
isSubclassOf(class-string<T>|T $class)expectation, narrowing toclass-string<T>|Tfor 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 to0again instead ofint<0, max>, following the upstream fix for phpstan/phpstan#15039
Full Changelog: v1.2.0...v1.3.0
v1.2.0
Immutable
release. Only release title and notes can be modified.
What's Changed
Added
isIntOrNonEmptyString()expectation, narrowing toint|non-empty-string
Fixed
- Restored type narrowing on PHPStan 2.2.7, which changed how the type specifier composes
&&and||conditions and left chainednot()/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 toint<0, max>rather than0. Tracked upstream at phpstan/phpstan#15039
Full Changelog: v1.1.1...v1.2.0
v1.1.1
Immutable
release. Only release title and notes can be modified.
What's Changed
Fixed
- Preserved
list<>,non-empty-list<>, andnon-empty-array<>shapes when narrowing throughkeys()/values(); previously the rebuilt iterable lost its accessory wrappers (e.g.list<mixed>downgraded toarray<int<0, max>, mixed>)
Full Changelog: v1.1.0...v1.1.1
v1.1.0
Immutable
release. Only release title and notes can be modified.
What's Changed
Added
keys()andvalues()iterating expectations to apply assertions across an iterable's keys or valuesisBetween(float|int $min, float|int $max, bool $inclusive = true)expectation for numeric range checksisOneOf(non-empty-list<mixed> $choices)expectation, with PHPStan narrowing to the union of literal allowed values when the list is constanthasMinLength(int<1, max> $min)andhasMaxLength(int<1, max> $max)expectations for bounded-string checksisUrl()expectation, backed byfilter_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
Immutable
release. Only release title and notes can be modified.
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
- @dependabot[bot] made their first contribution in #4
Full Changelog: https://github.com/NexusPHP/assert/commits/v1.0.0