public function testInstanceOf() { $predicate = Predicates::instanceOf(\DateTime::class); $this->assertInstanceOf(UnaryPredicateInterface::class, $predicate); $this->assertTrue($predicate->test(new \DateTime())); $this->assertFalse($predicate->test(new \ArrayIterator())); }
/** * Creates an instanceof predicate from a given class name. * * @param string $class * The given class name. * @return UnaryPredicateInterface */ function _instanceOf(string $class) : UnaryPredicateInterface { return Predicates::instanceOf($class); }