Nelmio\Alice\Throwable\Exception\UnclonableException::createForService PHP Method

createForService() public static method

public static createForService ( ) : self
return self
    public static function createForService() : self
    {
        return new self('This class is a service and as such should not be cloned. A service is not necessarily stateless and as ' . 'such cloning it may result in weird side effects. You should either create a new instance or make use ' . 'of a static or non static factory instead.');
    }

Usage Example

Example #1
0
 public function __clone()
 {
     throw UnclonableException::createForService();
 }
UnclonableException