PHPSA\Definition\RuntimeClassDefinition::hasMethod PHP Method

hasMethod() public method

public hasMethod ( string $name, boolean | false $inherit = false ) : boolean
$name string
$inherit boolean | false
return boolean
    public function hasMethod($name, $inherit = false)
    {
        return $this->reflection->hasMethod($name);
    }

Usage Example

Example #1
0
 public function testHasMethod()
 {
     $reflection = new ReflectionClass(self::TEST_CLASS_NAME);
     $definition = new RuntimeClassDefinition($reflection);
     foreach ($reflection->getMethods() as $method) {
         static::assertTrue($definition->hasMethod($method->getName()));
     }
     static::assertFalse($definition->hasMethod('XXXXXXXXXXXXXX'));
 }