Version 1
[yaffs-website] / vendor / phpunit / phpunit / src / Framework / Constraint / IsAnything.php
1 <?php
2 /*
3  * This file is part of PHPUnit.
4  *
5  * (c) Sebastian Bergmann <sebastian@phpunit.de>
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10
11 /**
12  * Constraint that accepts any input value.
13  *
14  * @since Class available since Release 3.0.0
15  */
16 class PHPUnit_Framework_Constraint_IsAnything extends PHPUnit_Framework_Constraint
17 {
18     /**
19      * Evaluates the constraint for parameter $other
20      *
21      * If $returnResult is set to false (the default), an exception is thrown
22      * in case of a failure. null is returned otherwise.
23      *
24      * If $returnResult is true, the result of the evaluation is returned as
25      * a boolean value instead: true in case of success, false in case of a
26      * failure.
27      *
28      * @param mixed  $other        Value or object to evaluate.
29      * @param string $description  Additional information about the test
30      * @param bool   $returnResult Whether to return a result or throw an exception
31      *
32      * @return mixed
33      *
34      * @throws PHPUnit_Framework_ExpectationFailedException
35      */
36     public function evaluate($other, $description = '', $returnResult = false)
37     {
38         return $returnResult ? true : null;
39     }
40
41     /**
42      * Returns a string representation of the constraint.
43      *
44      * @return string
45      */
46     public function toString()
47     {
48         return 'is anything';
49     }
50
51     /**
52      * Counts the number of constraint elements.
53      *
54      * @return int
55      *
56      * @since  Method available since Release 3.5.0
57      */
58     public function count()
59     {
60         return 0;
61     }
62 }