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 */ 14class PHPUnit_Framework_Constraint_IsAnything extends PHPUnit_Framework_Constraint 15{ 16 /** 17 * Evaluates the constraint for parameter $other 18 * 19 * If $returnResult is set to false (the default), an exception is thrown 20 * in case of a failure. null is returned otherwise. 21 * 22 * If $returnResult is true, the result of the evaluation is returned as 23 * a boolean value instead: true in case of success, false in case of a 24 * failure. 25 * 26 * @param mixed $other Value or object to evaluate. 27 * @param string $description Additional information about the test 28 * @param bool $returnResult Whether to return a result or throw an exception 29 * 30 * @return mixed 31 * 32 * @throws PHPUnit_Framework_ExpectationFailedException 33 */ 34 public function evaluate($other, $description = '', $returnResult = false) 35 { 36 return $returnResult ? true : null; 37 } 38 39 /** 40 * Returns a string representation of the constraint. 41 * 42 * @return string 43 */ 44 public function toString() 45 { 46 return 'is anything'; 47 } 48 49 /** 50 * Counts the number of constraint elements. 51 * 52 * @return int 53 */ 54 public function count() 55 { 56 return 0; 57 } 58} 59