All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[!IMPORTANT] Initially, in the previous
2.1.0release, several functions were deprecated (seeDeprecatedunder2.1.0below). After much thought on the direction I want this library to move in, I am reversing my decision to deprecate the Array and Temperature functions mentioned.
Dates::formatDifferenceOutput() a private function to handle formatting the output for Dates::timeDifference()Dates::INTERVAL_UNITS constant.$includeBcZones to Dates::timezoneInfo() and Dates::validTimezone()
Psalm and RectorPHP as dev-dependencies.Arrays::flatten(), Arrays::mapDeep(), and all the temperature related functions in Conversions are no longer deprecated.Image class. Still a work in progress; working toward no ‘codeCoverageIgnore’.Dates::timeDifference() logic was changed and a new parameter $extendedOutput added.
false (default), it returns the same output as usual.true, it formats the output with available non-zero DateInterval units. For example: 2 days 2 hours 20 minutes old.Dates::timeDifference() output no longer uses ‘(s)’. Will add ‘s’ if greater than one.Arrays class has gone through a bit of a refactor:
Arrays::mapDeep() updated to avoid circular references when dealing with objects.
mapDeep() as well.Arrays class for psalm/phpstan templates/generics.
Conversion::haversineDistance() method.This release focuses on setting up the future of the library. No new features or functionality has been added in this release.
Esi\Clock to dependencies, updated Esi\Utility\Dates accordingly..php-cs-fixer.dist.php, and as a result, implemented those changes throughout the library.tests github workflow to add uploading coverage data to Codecov.ioabstract as they never need instantiation.The next major release, v3, will move to PHP 8.3 as a minimum requirement.
Arrays::flatten()’s current signature and functionality will change in the next major release (v3.0)Arrays::mapDeep()’s current signature and functionality will change in the next major release (v3.0)
Arrays::validJson() will be removed in the next major release (v3.0)Conversions:
Arrays::exists@phpstan-ignore-* opting to instead use a baseline for PHPStan (phpstan-baseline.neon)Utility has undergone a complete restructuring, wherein it is no longer a single super class. The class has been broken down into smaller classes or “components”.
Conversion::EARTH_RADIUSConversion::METERS_TO_KILOMETERSConversion::METERS_TO_MILESDates::VALIDATE_TIMESTAMP_REGEXEnvironment::IP_ADDRESS_HEADERSEnvironment::HOST_HEADERSEnvironment::URL_HEADERSEnvironment::HTTPS_HEADERSEnvironment::REQUEST_HEADERSImage::IMAGE_TYPESNumbers::SUFFIXESNumbers::SIZE_FORMAT_UNITSNumbers::BINARY_STANDARD_BASENumbers::METRIC_STANDARD_BASENumbers::CONVERSION_MODIFIEREnvironment::PORT_SECUREEnvironment::PORT_UNSECUREEnvironment::VALIDATE_HOST_REGEXEnvironment::BOOLEAN_MAPPINGSArrays:valueExistsdocs/ or online here$skipEmpty parameter. It will now always skip empty lines.
file() with SplFileObject and flags SplFileObject::READ_AHEAD | SplFileObject::SKIP_EMPTY | SplFileObject::DROP_NEW_LINE
$this to self:: in tests when calling PHPUnit methodsStrings::ascii(), Strings::slugify().
voku/portable-ascii as a dependency.$language. If a language specific set of characters exists, it will use those within slugify and ascii.Arrays::exists is now Arrays::keyExistscomposer.json for the test script, and moved all the phpunit command line options to the relevant options in the phpunit.xml xml config.Arrays::exists() will be replaced with Arrays::keyExists()voku/portable-ascii as a dependency, Strings::charMap() was removed.currentUrl() no longer has any parameters, and just returns the URL string.
currentUrl(bool $parse = false) is now just currentUrl()parse_url(Utility::currentUrl()) if that functionality is needed.currentUrl and isReallyWritableREADME.md for PHPDoc related guidelines, in an effort
to adhere to PSR-5 and PSR-19.serverHttpVars() deprecated, just use getallheaders() instead.statusHeader()
ralouphie/getallheaders as a polyfill, for situations where the SAPI is not ApacheserverHttpVars() will just return the getallheaders() outputarrayInterlacefahrenheitToCelsius, celsiusToFahrenheit, celsiusToKelvin, kelvinToCelsius, fahrenheitToKelvin, kelvinToFahrenheitfahrenheitToRankine, rankineToFahrenheit, celsiusToRankine, rankineToCelsius, kelvinToRankine, rankineToKelvindoesContain() and doesNotContain() now uses the PHP 8 native str_contains() function.
mbstring for these two functions, as it does not appear to be necessary.$multibyte parameter to use mbstring(string $haystack, string $needle, bool $insensitive = false, bool $multibyte = false)beginsWith() and endsWith() now uses the PHP 8 native str_starts_with() and str_ends_with() functions.
mbstring for these two functions, as it does not appear to be necessary.$multibyte parameter to use mbstring(string $haystack, string $needle, bool $insensitive = false, bool $multibyte = false)arrayFlatten, now has new parameter $prependvalidJson() should now return properly