The design of this library is poor and its reason for existing is questionable. Most of the time you are likely better served by creating dedicated interfaces within your project.
DataValues Interfaces is a small PHP library that defines a set of interfaces for parsers, formatters and validators. It is part of the DataValues set of libraries.
On Packagist:
To use this library in your project, simply add a dependency on data-values/interfaces
to your project's composer.json
file. Here is a minimal example of a composer.json
file that just defines a dependency on Interfaces 1.x:
{
"require": {
"data-values/interfaces": "^1.0"
}
}
This library comes with a set up PHPUnit tests that cover all non-trivial code. You can run these tests using the PHPUnit configuration file found in the root directory. The tests can also be run via Github Actions.
- Introduced
ParserOptions::withDefaultOption()
andFormatterOptions::withDefaultOption()
, which return a copy of the options with the default applied; thedefaultOption()
methods, which modify the options in place, are deprecated.
- Updated minimum required PHP version from 5.5.9 to 7.2
- Removed
ValueFormatterBase
- Removed
ValueFormatterTestBase
- Removed
ValueValidator::setOptions
- Removed
ValueValidatorObject
- Removed
DATAVALUES_INTERFACES_VERSION
constant ValueValidators\Result
is now final- The properties of
ValueValidators\Error
are now private instead of protected
- Removed MediaWiki extension credits registration
- Fixed
ValueFormatterTestBase
not being installable via Composer.
- Updated minimal required PHP version from 5.3 to 5.5.9.
- Minor fixes to code documentation.
- Added PHPCS support.
- Fixed
ValueFormatterTestBase
not doing strict string comparisons.
- Fixed an issue when using this component with HHVM 1.11.0 (see #21).
- Dropped deprecated
ErrorObject
, useError
instead - Dropped deprecated
ResultObject
, useResult
instead - Dropped deprecated constant
DataValuesInterfaces_VERSION
, useDATAVALUES_INTERFACES_VERSION
instead - Dropped
ValueFormatterTestBase::getFormatterClass
- Made
ValueFormatterTestBase::getInstance
abstract - The options in
ValueFormatterTestBase::getInstance
are now optional
- The options in the
ValueFormatterBase
constructor are now optional - The MediaWiki extension registration now includes the license
- Added rawValue and expectedFormat arguments to
ValueParsers\ParseException
- Added
ValueFormatters\FormattingException
- Improved autoloading code
- Fixed link in MediaWiki credits
- Renamed entry point from DataValuesInterfaces.php to Interfaces.php
Initial release with these features:
ValueFormatters\ValueFormatter
interfaceValueParsers\ValueParser
interfaceValueValidators\ValueValidator
interface