SimpleReflection::hasFinal PHP Method

hasFinal() public method

Scans for final methods, as they screw up inherited mocks by not allowing you to override them.
public hasFinal ( )
    public function hasFinal()
    {
        $reflection = new ReflectionClass($this->interface);
        foreach ($reflection->getMethods() as $method) {
            if ($method->isFinal()) {
                return true;
            }
        }
        return false;
    }

Usage Example

Ejemplo n.º 1
0
 function testDetectionOfFinalMethods()
 {
     $reflection = new SimpleReflection('AnyOldClass');
     $this->assertFalse($reflection->hasFinal());
     $reflection = new SimpleReflection('AnyOldLeafClassWithAFinal');
     $this->assertTrue($reflection->hasFinal());
 }