public function test($compare) { if (is_object($compare)) { return is_a($compare, $this->type); } else { $function = 'is_' . $this->canonicalType($this->type); if (is_callable($function)) { return $function($compare); } return false; } }
function testInt() { $expectation = new IsAExpectation('int'); $this->assertTrue($expectation->test(5)); $this->assertFalse($expectation->test(5.0)); }