BetterReflection\Reflection\ReflectionClass::isCloneable PHP Method

isCloneable() public method

Checks whether this is a reflection of a class that supports the clone operator
public isCloneable ( ) : boolean
return boolean
    public function isCloneable()
    {
        if (!$this->isInstantiable()) {
            return false;
        }
        if (!$this->hasMethod('__clone')) {
            return true;
        }
        return $this->getMethod('__clone')->isPublic();
    }

Usage Example

 function it_might_be_cloneable(ReflectionClass $reflectionClass)
 {
     $reflectionClass->isCloneable()->willReturn(true);
     $this->isCloneable()->shouldBe(true);
     $reflectionClass->isCloneable()->willReturn(false);
     $this->isCloneable()->shouldBe(false);
 }
All Usage Examples Of BetterReflection\Reflection\ReflectionClass::isCloneable