1<?php
2
3/*
4 * This file is part of the Prophecy.
5 * (c) Konstantin Kudryashov <ever.zet@gmail.com>
6 *     Marcello Duarte <marcello.duarte@gmail.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Prophecy\Comparator;
13
14use SebastianBergmann\Comparator\Comparator;
15use SebastianBergmann\Comparator\ComparisonFailure;
16
17/**
18 * Closure comparator.
19 *
20 * @author Konstantin Kudryashov <ever.zet@gmail.com>
21 */
22final class ClosureComparator extends Comparator
23{
24    public function accepts($expected, $actual)
25    {
26        return is_object($expected) && $expected instanceof \Closure
27            && is_object($actual) && $actual instanceof \Closure;
28    }
29
30    public function assertEquals($expected, $actual, $delta = 0.0, $canonicalize = false, $ignoreCase = false)
31    {
32        throw new ComparisonFailure(
33            $expected,
34            $actual,
35            // we don't need a diff
36            '',
37            '',
38            false,
39            'all closures are born different'
40        );
41    }
42}
43