-
Notifications
You must be signed in to change notification settings - Fork 0
/
CloneNotSupportedTrait.php
39 lines (37 loc) · 1.12 KB
/
CloneNotSupportedTrait.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/**
* FlorianWolters\Component\Core\CloneNotSupportedTrait
*
* PHP Version 5.4
*
* @author Florian Wolters <[email protected]>
* @copyright 2011-2014 Florian Wolters (http://blog.florianwolters.de)
* @license http://gnu.org/licenses/lgpl.txt LGPL-3.0+
* @link http://github.com/FlorianWolters/PHP-Component-Core-Cloneable
*/
namespace FlorianWolters\Component\Core;
/**
* A class uses the {@see CloneNotSupportedTrait} to indicate to the magic
* `__clone` method of a class that it is **illegal** for that method to make a
* field-for-field copy of instances of that class.
*
* Invoking the magic `__clone` method on an instance that uses the {@see
* CloneNotSupportedTrait} results in the exception {@see
* CloneNotSupportedException} being thrown.
*
* @see CloneNotSupportedException
* @since Trait available since Release 0.1.0
*/
trait CloneNotSupportedTrait
{
/**
* Throws a {@see CloneNotSupportedException}.
*
* @return void
* @throws CloneNotSupportedException Always.
*/
final public function __clone()
{
throw new CloneNotSupportedException;
}
}