All notable changes to this project will be documented in this file.
- Reinstated the
@methodreturn type forAssert\LazyAssertionmethods to show that the return type isLazyAssertion.
- Make
Assert\Assertion::stringify()UTF-8 safe (Thanks to Pedram Azimaei)
- Sigh!
- Richard Quadling
- REALLY Removed dependency of the intl extension.
- Updated the Docblocks for
Assert\Assertion::all()helper to show that the value is expected to be an array.
- It seems I've been slightly lax in verifying the signature changes and expected extensions.
Hopefully, both of these have been fixed in this version.
Truly sorry for breaking the internet!
- Richard Quadling
- Restored
\Assert\Assertion::createException()signature to 3.2.2. - Removed dependency of the intl extension. If the extension is available, then
Assert\Assertion::count(),Assert\Assertion::isCountable(),Assert\Assertion::minCount(), andAssert\Assertion::maxCount()will operate onResourceBundles. - Fixed the
@methodreturn type forAssert\LazyAssertionmethods to show that the return type isstaticfor extensions ofAssert\LazyAssertion.
NOTE : Docblock does not have the ability to differentiate between a non static@methodwhose returns type is of the subclass and a@methodthat is called statically (PSR-5#899). So the use ofstatic staticis a fudge that sort of works for IDEs that need to know about the method that MAY be overridden in a subclass.
- Added type hints and documentation consistency (Thanks to Andru Cherny)
Assertion::eqArraySubset()(Thanks to Anna Filina)
- Updated regex for
Assert\Assertion::url()(Thanks to Christophe Histaesse) - Fixed broken regex for
Assert\Assertion::url()(Thanks to Menno Holtkamp)
- Added PHP 7.3.0, PHP 7.3.1, and PHP 7.3.2 to Travis pipeline as there are differences in PCRE
- Updated docblocks for
Assert\Assertion::NullOrXxxx()to show that the first parameter can be null. - Updated docblocks for
Assert\LazyAssertionto show that the return type is$thisto aid IDE's static analysis.
Assertion::isCountable()(Thanks to Baptiste Clavié)Assertion::maxCount()(Thanks to Baptiste Clavié)Assertion::minCount()(Thanks to Baptiste Clavié)Assertion::nonContains()(Thanks to Baptiste Clavié)
- Added PHP 7.3 to Travis pipeline
- Added support for
\ResourceBundleand\SimpleXMLElementtoAssertion::count().
- Refactor assertion messages for
Assert\Assertion::notEq(),Assert\Assertion::notSame(), andAssert\Assertion::notInArray()(Thanks to Rick Kuipers)
Assertion::notRegex()(Thanks to Thomas Müller)
- Upgraded regex and unit tests for
Assert\Assertion::url()to latest from Symfony/Validator
- Deprecate support for PHP < 7.0
- An
AssertionFailedExceptionmust be aThrowable(Thanks to Marco Pivetta)
- Updated regex for
Assert\Assertion::url()(Thanks to Christophe Histaesse)
- Fixed broken regex for
Assert\Assertion::url()(Thanks to Menno Holtkamp)
- Made constraints in exceptions consistent for all assertions (Thanks to Peter Kruithof)
- Remove DocBlock entry causing exception in third party DocBlock parser (Thanks to Koutsoumpos Valantis)
- Prevent date overflow in Assertion::date() by reset preset date value (Thanks to Nobuhiro Nakamura)
- Expand error for
\Assert\Assertion::count()to include the supplied count (Thanks to Yoann Blot)
- Usage of custom extended Assertion class in LazyAssertion (Thanks to Marek Štípek)
- Support for PHP 5 will be dropped at the end of 2018, in line with PHP's supported versions.
\Assert\Assertion::generateMessage()will now receive the default message for an assertion if one is not supplied (Thanks to Romans Malinovskis)
Assertion::integerish()has had several issues in the last couple of versions.
Hopefully these are now fixed. Thanks to Erik Roelofs and Michał Mleczko
- The functions
\Assert\that(),\Assert\thatAll(),\Assert\thatNullOr(), and\Assert\lazy()are no longer marked as deprecated.
Both the functional and static constructors work together. Whichever you wish to use is a personal preference.
Assertion::integerish(0)andAssertion::integerish('0')now assert correctly.
Assertion::base64()(Thanks to Pablo Kowalczyk)
Assertion::integerish()now correctly asserts integers with leading zeros in strings (Thanks to Albert Casademont)
Assertion::integerish()now throws exception as expected (Thanks to Thomas Flack)
- Basic Auth usernames and passwords can contain '.' (Thanks to Fede Isas)
- Fixed stringification of booleans (Thanks to Philipp Rieber)
Assert\Assertion:isResource()(Thanks to Timothy Younger)
- Corrected doc-block for
Assert\Assertion::propertiesExist().
Assert\Assertion::objectOrClass()(Thanks to Timothy Younger)Assert\Assertion::propertyExists()(Thanks to Timothy Younger)Assert\Assertion::propertiesExist()(Thanks to Timothy Younger)
- Unit tests no longer using deprecated exception methods (Thanks to Richard Quadling)
- All global namespaced functions have been optimised (Thanks to Andreas Möller)
- Fix
Assert\Assertion::integerish()when used with a resource (Thanks to manuxi)
- Backward compatibility fixes for PHP 5.3
Assert\Assertion::extensionVersion()(Thanks to Timothy Younger)Assert\Assertion::phpVersion()(Thanks to Timothy Younger)Assert\Assertion::version()(Thanks to Timothy Younger)
- Exception messages can now be constructed via a callback.
- Documentation now includes types.
Assert\Assertion::defined()(Thanks to Timothy Younger)Assert\Assertion::extensionLoaded()(Thanks to Timothy Younger)
- Added types to generated documentation.
- Added PHPStan analysis for PHP 7+
- All exceptions thrown by this library extend
\Assert\InvalidArgumentException(Thanks to Richard Quadling)
- Update to php-cs-fixer ^2.0 release (Thanks to Raphael Stolt)
- Simplify XDebug disabling for Travis (Thanks to Raphael Stolt)
- Use PSR-4 autoloading (Thanks to Andreas Möller)
- Enable Composer package sorting (Thanks to Raphael Stolt)
- Fix grammar in documentation (Thanks to Adrian Föder)
- Fix the interfaceExists assertion
- Fixed issue in document generator (Thanks to Taco van den Broek)
- Added ability to capture multiple errors on a single value in a chain (Thanks to Alec Carpenter)
- Use static factory methods instead of functions in the Assert namespace (Thanks to Taco van den Broek)
- The functions in the Assert namespace (
\Assert\that(),\Assert\thatAll(),\Assert\thatNullOr()and\Assert\lazy()) are now marked as deprecated. They will be removed in the next major release. They have been replaced with the static methods\Assert\Assert::that(),\Assert\Assert::thatAll(),\Assert\Assert::thatNullOr()and\Assert\Assert::lazy()
Assert\Assertion::between()Assert\Assertion::betweenExclusive()
- Allow
http://localhostas a valid URL - fixes Assertion::url('http://localhost') not a valid url?
- Upgraded regex and unit tests for
Assert\Assertion::url()to latest from Symfony/Validator - Added PHP-CS
- Speed up of builds for Travis
Assert\Assertion::e164()- The international public telecommunication numbering planAssert\Assertion::interfaceExists()Assert\Assertion::ip()/Assert\Assertion::ipv4()/Assert\Assertion::ipv6()Assert\Assertion::keyNotExists()Assert\Assertion::null()Assert\Assertion::satisfy()- Allows for a bespoke assertion, rather than a predefined one
- Improved the reporting of the value for min and max assertions
- Removed
composer.lockfile from library - Improved travis build to detect incorrect documentation changes
Assert\Assertion::notInArray()
- Made
Assert\Assertion::INVALID_GREATER_OR_EQUALunique
- Introduced CONTRIBUTING.md to get contributors to generate the docblocks when a new assertion is added
- Introduced .editorconfig to allow IDEs that support EditorConfig to provide a consistent code style. See EditorConfig for further details
- Additional tests and updated documentation.
- Travis updates.
- Fixed unit test to work with PHP 5.3
- Fixed
Assertion::isCallable()to with with PHP 5.3
Assert\Assertion::isCallable()
- Updated tests
- Updated
generate_method_docs.phpand regenerated all documentation - Added Richard Quadling as collaborator
- Updated missing assertions from documentation
Assert\Assertion::date()
- Added appropriate guards to the additional assert functions to stop them from being defined twice
Assert\Assertion::lessThan()Assert\Assertion::lessOrEqualThan()Assert\Assertion::greaterThan()Assert\Assertion::greaterOrEqualThan()
- Added support for PHP 5.6 and PHP 7.0 to Travis
Assert\Assertion::isTraversable()Assert\Assertion::isArrayAccessible()Assert\Assertion::keyIsset()
- Used parameterised
sprintf()for messages
Assert\Assertion::notEq()Assert\Assertion::notSame()Assert\Assertion::scalar()Assert\Assertion::choicesNotEmpty()Assert\Assertion::methodExists()Assert\Assertion::isObject()
- Pass constraints and values to
Assert\AssertionFailedException
- Introduce AssertionChaining and LazyAssertions
- Introduce
Assert\Assertion::stringify()to make a string version of a value
Assert\Assertion::float()
- Added support for HHVM to Travis
Assert\Assertion::count()
- Added support for PHP 5.5 to Travis
Assert\Assertion::notEmptyKey()Assert\Assertion::all....()
Assert\Assertion::noContent()Assert\Assertion::endsWith()Assert\Assertion::notIsInstanceOf()Assert\Assertion::isJsonString()Assert\Assertion::uuid()
- Added BSD-2 License
Assert\Assertion::length()Assert\Assertion::url()Assert\Assertion::false()Assert\Assertion::implementsInterface()
- Travis now runs PHP Unit tests
- Added
Assert\InvalidArgumentException - Added
$encoding = 'UTF-8'parameter to appropriate assertions
Assert\Assertion::nullOr....()
Assert\Assertion::eq()Assert\Assertion::same()Assert\Assertion::inArray()Assert\Assertion::min()Assert\Assertion::max()Assert\Assertion::true()Assert\Assertion::classExists()
- Added
$propertyPath = nullparameter to assertions
Assert\Assertion::integer()Assert\Assertion::digit()Assert\Assertion::integerish()Assert\Assertion::boolean()Assert\Assertion::notEmpty()Assert\Assertion::string()Assert\Assertion::regex()Assert\Assertion::minLength()Assert\Assertion::maxLength()Assert\Assertion::betweenLength()Assert\Assertion::startsWith()Assert\Assertion::contains()Assert\Assertion::choice()Assert\Assertion::isArray()Assert\Assertion::keyExists()Assert\Assertion::notBlank()Assert\Assertion::isInstanceOf()Assert\Assertion::subclassOf()Assert\Assertion::range()Assert\Assertion::file()Assert\Assertion::readable()Assert\Assertion::writeable()Assert\Assertion::email()Assert\Assertion::alnum()