composer update
This commit is contained in:
+42
-2
@@ -2,6 +2,37 @@
|
||||
|
||||
All notable changes are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
|
||||
|
||||
## [5.0.5] - 2026-01-24
|
||||
|
||||
### Changed
|
||||
|
||||
* [#134](https://github.com/sebastianbergmann/comparator/issues/134): Suppress warning introduced in PHP 8.5
|
||||
|
||||
## [5.0.4] - 2025-09-07
|
||||
|
||||
### Changed
|
||||
|
||||
* Do not use `SplObjectStorage` methods that will be deprecated in PHP 8.5
|
||||
|
||||
## [5.0.3] - 2024-10-18
|
||||
|
||||
### Fixed
|
||||
|
||||
* Reverted [#113](https://github.com/sebastianbergmann/comparator/pull/113) as it broke backward compatibility
|
||||
|
||||
## [5.0.2] - 2024-08-12
|
||||
|
||||
### Fixed
|
||||
|
||||
* [#112](https://github.com/sebastianbergmann/comparator/issues/112): Arrays with different keys and the same values are considered equal in canonicalize mode
|
||||
|
||||
## [5.0.1] - 2023-08-14
|
||||
|
||||
### Fixed
|
||||
|
||||
* `MockObjectComparator` only works on instances of `PHPUnit\Framework\MockObject\MockObject`, but not on instances of `PHPUnit\Framework\MockObject\Stub`
|
||||
* `MockObjectComparator` only ignores the `$__phpunit_invocationMocker` property, but not other properties with names prefixed with `__phpunit_`
|
||||
|
||||
## [5.0.0] - 2023-02-03
|
||||
|
||||
### Changed
|
||||
@@ -137,7 +168,14 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
|
||||
* Added `SebastianBergmann\Comparator\Factory::reset()` to unregister all non-default comparators
|
||||
* Added support for `phpunit/phpunit-mock-objects` version `^5.0`
|
||||
|
||||
[5.0.0]: https://github.com/sebastianbergmann/comparator/compare/4.0.8...5.0.0
|
||||
[5.0.5]: https://github.com/sebastianbergmann/comparator/compare/5.0.4...5.0.5
|
||||
[5.0.4]: https://github.com/sebastianbergmann/comparator/compare/5.0.3...5.0.4
|
||||
[5.0.3]: https://github.com/sebastianbergmann/comparator/compare/5.0.2...5.0.3
|
||||
[5.0.2]: https://github.com/sebastianbergmann/comparator/compare/5.0.1...5.0.2
|
||||
[5.0.1]: https://github.com/sebastianbergmann/comparator/compare/5.0.0...5.0.1
|
||||
[5.0.0]: https://github.com/sebastianbergmann/comparator/compare/4.0...5.0.0
|
||||
[4.0.10]: https://github.com/sebastianbergmann/comparator/compare/4.0.9...4.0.10
|
||||
[4.0.9]: https://github.com/sebastianbergmann/comparator/compare/4.0.8...4.0.9
|
||||
[4.0.8]: https://github.com/sebastianbergmann/comparator/compare/4.0.7...4.0.8
|
||||
[4.0.7]: https://github.com/sebastianbergmann/comparator/compare/4.0.6...4.0.7
|
||||
[4.0.6]: https://github.com/sebastianbergmann/comparator/compare/4.0.5...4.0.6
|
||||
@@ -146,7 +184,9 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
|
||||
[4.0.3]: https://github.com/sebastianbergmann/comparator/compare/4.0.2...4.0.3
|
||||
[4.0.2]: https://github.com/sebastianbergmann/comparator/compare/4.0.1...4.0.2
|
||||
[4.0.1]: https://github.com/sebastianbergmann/comparator/compare/4.0.0...4.0.1
|
||||
[4.0.0]: https://github.com/sebastianbergmann/comparator/compare/3.0.5...4.0.0
|
||||
[4.0.0]: https://github.com/sebastianbergmann/comparator/compare/3.0...4.0.0
|
||||
[3.0.7]: https://github.com/sebastianbergmann/comparator/compare/3.0.6...3.0.7
|
||||
[3.0.6]: https://github.com/sebastianbergmann/comparator/compare/3.0.5...3.0.6
|
||||
[3.0.5]: https://github.com/sebastianbergmann/comparator/compare/3.0.4...3.0.5
|
||||
[3.0.4]: https://github.com/sebastianbergmann/comparator/compare/3.0.3...3.0.4
|
||||
[3.0.3]: https://github.com/sebastianbergmann/comparator/compare/3.0.2...3.0.3
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2002-2023, Sebastian Bergmann
|
||||
Copyright (c) 2002-2025, Sebastian Bergmann
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
+25
-4
@@ -1,9 +1,30 @@
|
||||
# Security Policy
|
||||
|
||||
This library is intended to be used in development environments only. For instance, it is used by the testing framework PHPUnit. There is no reason why this library should be installed on a webserver.
|
||||
If you believe you have found a security vulnerability in the library that is developed in this repository, please report it to us through coordinated disclosure.
|
||||
|
||||
**If you upload this library to a webserver then your deployment process is broken. On a more general note, if your `vendor` directory is publicly accessible on your webserver then your deployment process is also broken.**
|
||||
**Please do not report security vulnerabilities through public GitHub issues, discussions, or pull requests.**
|
||||
|
||||
## Security Contact Information
|
||||
Instead, please email `sebastian@phpunit.de`.
|
||||
|
||||
Please include as much of the information listed below as you can to help us better understand and resolve the issue:
|
||||
|
||||
* The type of issue
|
||||
* Full paths of source file(s) related to the manifestation of the issue
|
||||
* The location of the affected source code (tag/branch/commit or direct URL)
|
||||
* Any special configuration required to reproduce the issue
|
||||
* Step-by-step instructions to reproduce the issue
|
||||
* Proof-of-concept or exploit code (if possible)
|
||||
* Impact of the issue, including how an attacker might exploit the issue
|
||||
|
||||
This information will help us triage your report more quickly.
|
||||
|
||||
## Web Context
|
||||
|
||||
The library that is developed in this repository was either extracted from [PHPUnit](https://github.com/sebastianbergmann/phpunit) or developed specifically as a dependency for PHPUnit.
|
||||
|
||||
The library is developed with a focus on development environments and the command-line. No specific testing or hardening with regard to using the library in an HTTP or web context or with untrusted input data is performed. The library might also contain functionality that intentionally exposes internal application data for debugging purposes.
|
||||
|
||||
If the library is used in a web application, the application developer is responsible for filtering inputs or escaping outputs as necessary and for verifying that the used functionality is safe for use within the intended context.
|
||||
|
||||
Vulnerabilities specific to the use outside a development context will be fixed as applicable, provided that the fix does not have an averse effect on the primary use case for development purposes.
|
||||
|
||||
After the above, if you still would like to report a security vulnerability, please email `sebastian@phpunit.de`.
|
||||
|
||||
+5
-1
@@ -22,6 +22,10 @@
|
||||
"email": "bschussek@2bepublished.at"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/comparator/issues",
|
||||
"security": "https://github.com/sebastianbergmann/comparator/security/policy"
|
||||
},
|
||||
"prefer-stable": true,
|
||||
"require": {
|
||||
"php": ">=8.1",
|
||||
@@ -31,7 +35,7 @@
|
||||
"ext-mbstring": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^10.0"
|
||||
"phpunit/phpunit": "^10.5"
|
||||
},
|
||||
"config": {
|
||||
"platform": {
|
||||
|
||||
+7
-7
@@ -56,7 +56,7 @@ class ArrayComparator extends Comparator
|
||||
$expectedAsString .= sprintf(
|
||||
" %s => %s\n",
|
||||
$exporter->export($key),
|
||||
$exporter->shortenedExport($value)
|
||||
$exporter->shortenedExport($value),
|
||||
);
|
||||
|
||||
$equal = false;
|
||||
@@ -71,25 +71,25 @@ class ArrayComparator extends Comparator
|
||||
$expectedAsString .= sprintf(
|
||||
" %s => %s\n",
|
||||
$exporter->export($key),
|
||||
$exporter->shortenedExport($value)
|
||||
$exporter->shortenedExport($value),
|
||||
);
|
||||
|
||||
$actualAsString .= sprintf(
|
||||
" %s => %s\n",
|
||||
$exporter->export($key),
|
||||
$exporter->shortenedExport($actual[$key])
|
||||
$exporter->shortenedExport($actual[$key]),
|
||||
);
|
||||
} catch (ComparisonFailure $e) {
|
||||
$expectedAsString .= sprintf(
|
||||
" %s => %s\n",
|
||||
$exporter->export($key),
|
||||
$e->getExpectedAsString() ? $this->indent($e->getExpectedAsString()) : $exporter->shortenedExport($e->getExpected())
|
||||
$e->getExpectedAsString() ? $this->indent($e->getExpectedAsString()) : $exporter->shortenedExport($e->getExpected()),
|
||||
);
|
||||
|
||||
$actualAsString .= sprintf(
|
||||
" %s => %s\n",
|
||||
$exporter->export($key),
|
||||
$e->getActualAsString() ? $this->indent($e->getActualAsString()) : $exporter->shortenedExport($e->getActual())
|
||||
$e->getActualAsString() ? $this->indent($e->getActualAsString()) : $exporter->shortenedExport($e->getActual()),
|
||||
);
|
||||
|
||||
$equal = false;
|
||||
@@ -100,7 +100,7 @@ class ArrayComparator extends Comparator
|
||||
$actualAsString .= sprintf(
|
||||
" %s => %s\n",
|
||||
$exporter->export($key),
|
||||
$exporter->shortenedExport($value)
|
||||
$exporter->shortenedExport($value),
|
||||
);
|
||||
|
||||
$equal = false;
|
||||
@@ -115,7 +115,7 @@ class ArrayComparator extends Comparator
|
||||
$actual,
|
||||
$expectedAsString,
|
||||
$actualAsString,
|
||||
'Failed asserting that two arrays are equal.'
|
||||
'Failed asserting that two arrays are equal.',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ final class DOMNodeComparator extends ObjectComparator
|
||||
$actual,
|
||||
$expectedAsString,
|
||||
$actualAsString,
|
||||
sprintf("Failed asserting that two DOM %s are equal.\n", $type)
|
||||
sprintf("Failed asserting that two DOM %s are equal.\n", $type),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ final class DateTimeComparator extends ObjectComparator
|
||||
$actual,
|
||||
$this->dateTimeToString($expected),
|
||||
$this->dateTimeToString($actual),
|
||||
'Failed asserting that two DateTime objects are equal.'
|
||||
'Failed asserting that two DateTime objects are equal.',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-7
@@ -17,12 +17,6 @@ use Exception;
|
||||
*/
|
||||
final class ExceptionComparator extends ObjectComparator
|
||||
{
|
||||
/**
|
||||
* Returns whether the comparator can compare two values.
|
||||
*
|
||||
* @param mixed $expected The first value to compare
|
||||
* @param mixed $actual The second value to compare
|
||||
*/
|
||||
public function accepts(mixed $expected, mixed $actual): bool
|
||||
{
|
||||
return $expected instanceof Exception && $actual instanceof Exception;
|
||||
@@ -39,7 +33,7 @@ final class ExceptionComparator extends ObjectComparator
|
||||
$array['line'],
|
||||
$array['trace'],
|
||||
$array['string'],
|
||||
$array['xdebug_message']
|
||||
$array['xdebug_message'],
|
||||
);
|
||||
|
||||
return $array;
|
||||
|
||||
+12
-10
@@ -9,32 +9,34 @@
|
||||
*/
|
||||
namespace SebastianBergmann\Comparator;
|
||||
|
||||
use function array_keys;
|
||||
use function assert;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use function str_starts_with;
|
||||
use PHPUnit\Framework\MockObject\Stub;
|
||||
|
||||
/**
|
||||
* Compares PHPUnit\Framework\MockObject\MockObject instances for equality.
|
||||
*/
|
||||
final class MockObjectComparator extends ObjectComparator
|
||||
{
|
||||
/**
|
||||
* Returns whether the comparator can compare two values.
|
||||
*
|
||||
* @param mixed $expected The first value to compare
|
||||
* @param mixed $actual The second value to compare
|
||||
*/
|
||||
public function accepts(mixed $expected, mixed $actual): bool
|
||||
{
|
||||
return $expected instanceof MockObject && $actual instanceof MockObject;
|
||||
return $expected instanceof Stub && $actual instanceof Stub;
|
||||
}
|
||||
|
||||
protected function toArray(object $object): array
|
||||
{
|
||||
assert($object instanceof MockObject);
|
||||
assert($object instanceof Stub);
|
||||
|
||||
$array = parent::toArray($object);
|
||||
|
||||
unset($array['__phpunit_invocationMocker']);
|
||||
foreach (array_keys($array) as $key) {
|
||||
if (!str_starts_with($key, '__phpunit_')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
unset($array[$key]);
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
+2
-2
@@ -49,8 +49,8 @@ final class NumericComparator extends ScalarComparator
|
||||
sprintf(
|
||||
'Failed asserting that %s matches expected %s.',
|
||||
$exporter->export($actual),
|
||||
$exporter->export($expected)
|
||||
)
|
||||
$exporter->export($expected),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -42,8 +42,8 @@ class ObjectComparator extends ArrayComparator
|
||||
sprintf(
|
||||
'%s is not instance of expected class "%s".',
|
||||
$exporter->export($actual),
|
||||
$expected::class
|
||||
)
|
||||
$expected::class,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ class ObjectComparator extends ArrayComparator
|
||||
$delta,
|
||||
$canonicalize,
|
||||
$ignoreCase,
|
||||
$processed
|
||||
$processed,
|
||||
);
|
||||
} catch (ComparisonFailure $e) {
|
||||
throw new ComparisonFailure(
|
||||
@@ -75,7 +75,7 @@ class ObjectComparator extends ArrayComparator
|
||||
// replace "Array" with "MyClass object"
|
||||
substr_replace($e->getExpectedAsString(), $expected::class . ' Object', 0, 5),
|
||||
substr_replace($e->getActualAsString(), $actual::class . ' Object', 0, 5),
|
||||
'Failed asserting that two objects are equal.'
|
||||
'Failed asserting that two objects are equal.',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ final class ResourceComparator extends Comparator
|
||||
$expected,
|
||||
$actual,
|
||||
$exporter->export($expected),
|
||||
$exporter->export($actual)
|
||||
$exporter->export($actual),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -44,8 +44,8 @@ class ScalarComparator extends Comparator
|
||||
// always compare as strings to avoid strange behaviour
|
||||
// otherwise 0 == 'Foobar'
|
||||
if ((is_string($expected) && !is_bool($actual)) || (is_string($actual) && !is_bool($expected))) {
|
||||
$expectedToCompare = (string) $expectedToCompare;
|
||||
$actualToCompare = (string) $actualToCompare;
|
||||
$expectedToCompare = @(string) $expectedToCompare;
|
||||
$actualToCompare = @(string) $actualToCompare;
|
||||
|
||||
if ($ignoreCase) {
|
||||
$expectedToCompare = mb_strtolower($expectedToCompare, 'UTF-8');
|
||||
@@ -59,7 +59,7 @@ class ScalarComparator extends Comparator
|
||||
$actual,
|
||||
$exporter->export($expected),
|
||||
$exporter->export($actual),
|
||||
'Failed asserting that two strings are equal.'
|
||||
'Failed asserting that two strings are equal.',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -73,8 +73,8 @@ class ScalarComparator extends Comparator
|
||||
sprintf(
|
||||
'Failed asserting that %s matches expected %s.',
|
||||
$exporter->export($actual),
|
||||
$exporter->export($expected)
|
||||
)
|
||||
$exporter->export($expected),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,25 +31,25 @@ final class SplObjectStorageComparator extends Comparator
|
||||
$exporter = new Exporter;
|
||||
|
||||
foreach ($actual as $object) {
|
||||
if (!$expected->contains($object)) {
|
||||
if (!$expected->offsetExists($object)) {
|
||||
throw new ComparisonFailure(
|
||||
$expected,
|
||||
$actual,
|
||||
$exporter->export($expected),
|
||||
$exporter->export($actual),
|
||||
'Failed asserting that two objects are equal.'
|
||||
'Failed asserting that two objects are equal.',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($expected as $object) {
|
||||
if (!$actual->contains($object)) {
|
||||
if (!$actual->offsetExists($object)) {
|
||||
throw new ComparisonFailure(
|
||||
$expected,
|
||||
$actual,
|
||||
$exporter->export($expected),
|
||||
$exporter->export($actual),
|
||||
'Failed asserting that two objects are equal.'
|
||||
'Failed asserting that two objects are equal.',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -35,8 +35,8 @@ final class TypeComparator extends Comparator
|
||||
sprintf(
|
||||
'%s does not match expected type "%s".',
|
||||
(new Exporter)->shortenedExport($actual),
|
||||
gettype($expected)
|
||||
)
|
||||
gettype($expected),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user