3 * This file is part of PHPUnit.
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.
12 * Constraint that asserts that the class it is evaluated for has a given
15 * The attribute name is passed in the constructor.
17 * @since Class available since Release 3.1.0
19 class PHPUnit_Framework_Constraint_ClassHasStaticAttribute extends PHPUnit_Framework_Constraint_ClassHasAttribute
22 * Evaluates the constraint for parameter $other. Returns true if the
23 * constraint is met, false otherwise.
25 * @param mixed $other Value or object to evaluate.
29 protected function matches($other)
31 $class = new ReflectionClass($other);
33 if ($class->hasProperty($this->attributeName)) {
34 $attribute = $class->getProperty($this->attributeName);
36 return $attribute->isStatic();
43 * Returns a string representation of the constraint.
47 * @since Method available since Release 3.3.0
49 public function toString()
52 'has static attribute "%s"',