- Corrected messages and typos in arious assertions
- Added explicit (non-magic)
allNullOr*
methods, with@psalm-assert
annotations, for better Psalm support.
- Trait methods will now check the assertion themselves, instead of using
__callStatic
isList
will now deal correctly with (modified) lists that containNaN
reportInvalidArgument
now has a return type ofnever
.
- Removed
symfony/polyfill-ctype
as a dependency, and requireext-ctype
instead.- You can still require the
symfony/polyfill-ctype
in your project if you need it, as it providesext-ctype
- You can still require the
- On invalid assertion, we throw a
Webmozart\Assert\InvalidArgumentException
- Added
Assert::positiveInteger()
- Using a trait with real implementations of
all*()
andnullOr*()
methods to improve psalm compatibility.
- Support for PHP <7.2
- provisional support for PHP 8.0
- added better Psalm support for
all*
&nullOr*
methods - These methods are now understood by Psalm through a mixin. You may need a newer version of Psalm in order to use this
- added
@psalm-pure
annotation toAssert::notFalse()
- added more
@psalm-assert
annotations where appropriate
- the
all*
&nullOr*
methods are now declared on an interface, instead of@method
annotations. This interface is linked to theAssert
class with a@mixin
annotation. Most IDEs have supported this for a long time, and you should not lose any autocompletion capabilities. PHPStan has supported this since version0.12.20
. This package is marked incompatible (with a composer conflict) with phpstan version prior to that. If you do not use PHPStan than this does not matter.
- added
Assert::notStartsWith()
- added
Assert::notEndsWith()
- added
Assert::inArray()
- added
@psalm-pure
annotations to pure assertions
- Exception messages of comparisons between
DateTime(Immutable)
objects now display their date & time. - Custom Exception messages for
Assert::count()
now use the values to render the exception message.
- added
Assert::notFalse()
- added
Assert::isAOf()
- added
Assert::isAnyOf()
- added
Assert::isNotA()
- added
Assert::validArrayKey()
- added
Assert::isNonEmptyList()
- added
Assert::isNonEmptyMap()
- added
@throws InvalidArgumentException
annotations to all methods that throw. - added
@psalm-assert
for the list type to theisList
assertion.
ResourceBundle
&SimpleXMLElement
now pass theisCountable
assertions. They are countable, without implementing theCountable
interface.- The doc block of
range
now has the proper variables. - An empty array will now pass
isList
andisMap
. As it is a valid form of both. If a non-empty variant is needed, useisNonEmptyList
orisNonEmptyMap
.
- Removed some
@psalm-assert
annotations, that were 'side effect' assertions See: - If you use Psalm, the minimum version needed is
3.6.0
. Which is enforced through a composer conflict. If you don't use Psalm, then this has no impact.
- added
Assert::uniqueValues()
- added
Assert::unicodeLetters()
- added:
Assert::email()
- added support for Psalm, by adding
@psalm-assert
annotations where appropriate.
Assert::endsWith()
would not give the correct result when dealing with a multibyte suffix.Assert::length(), minLength, maxLength, lengthBetween
would not give the correct result when dealing with multibyte characters.
NOTE: These 2 changes may break your assertions if you relied on the fact that multibyte characters didn't behave correctly.
- The names of some variables have been updated to better reflect what they are.
- All function calls are now in their FQN form, slightly increasing performance.
- Tests are now properly ran against HHVM-3.30 and PHP nightly.
- deprecated
Assert::isTraversable()
in favor ofAssert::isIterable()
- This was already done in 1.3.0, but it was only done through a silenced
trigger_error
. It is now annotated as well.
- This was already done in 1.3.0, but it was only done through a silenced
- added
Assert::ip()
- added
Assert::ipv4()
- added
Assert::ipv6()
- added
Assert::notRegex()
- added
Assert::interfaceExists()
- added
Assert::isList()
- added
Assert::isMap()
- added polyfill for ctype
- Special case when comparing objects implementing
__toString()
- added
Assert::minCount()
- added
Assert::maxCount()
- added
Assert::countBetween()
- added
Assert::isCountable()
- added
Assert::notWhitespaceOnly()
- added
Assert::natural()
- added
Assert::notContains()
- added
Assert::isArrayAccessible()
- added
Assert::isInstanceOfAny()
- added
Assert::isIterable()
stringNotEmpty
will no longer report "0" is an empty string
- deprecated
Assert::isTraversable()
in favor ofAssert::isIterable()
- added
Assert::throws()
- added
Assert::count()
- added extension point
Assert::reportInvalidArgument()
for custom subclasses
- added
Assert::object()
- added
Assert::propertyExists()
- added
Assert::propertyNotExists()
- added
Assert::methodExists()
- added
Assert::methodNotExists()
- added
Assert::uuid()
- integrated Style CI
- add tests for minimum package dependencies on Travis CI
- added support for PHP 5.3.3
- first stable release
- first beta release