3 * This file is part of the Comparator package.
5 * (c) Sebastian Bergmann <sebastian@phpunit.de>
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
11 namespace SebastianBergmann\Comparator;
14 * Compares values for type equality.
16 class TypeComparator extends Comparator
19 * Returns whether the comparator can compare two values.
21 * @param mixed $expected The first value to compare
22 * @param mixed $actual The second value to compare
25 public function accepts($expected, $actual)
31 * Asserts that two values are equal.
33 * @param mixed $expected First value to compare
34 * @param mixed $actual Second value to compare
35 * @param float $delta Allowed numerical distance between two values to consider them equal
36 * @param bool $canonicalize Arrays are sorted before comparison when set to true
37 * @param bool $ignoreCase Case is ignored when set to true
39 * @throws ComparisonFailure
41 public function assertEquals($expected, $actual, $delta = 0.0, $canonicalize = false, $ignoreCase = false)
43 if (gettype($expected) != gettype($actual)) {
44 throw new ComparisonFailure(
47 // we don't need a diff
52 '%s does not match expected type "%s".',
53 $this->exporter->shortenedExport($actual),