| 1 |
<?php |
| 2 |
|
| 3 |
namespace Safe; |
| 4 |
|
| 5 |
use Safe\Exceptions\ClassobjException; |
| 6 |
|
| 7 |
/** |
| 8 |
* Creates an alias named alias |
| 9 |
* based on the user defined class original. |
| 10 |
* The aliased class is exactly the same as the original class. |
| 11 |
* |
| 12 |
* @param string $original The original class. |
| 13 |
* @param string $alias The alias name for the class. |
| 14 |
* @param bool $autoload Whether to autoload if the original class is not found. |
| 15 |
* @throws ClassobjException |
| 16 |
* |
| 17 |
*/ |
| 18 |
function class_alias(string $original, string $alias, bool $autoload = true): void |
| 19 |
{ |
| 20 |
error_clear_last(); |
| 21 |
$result = \class_alias($original, $alias, $autoload); |
| 22 |
if ($result === false) { |
| 23 |
throw ClassobjException::createFromPhpError(); |
| 24 |
} |
| 25 |
} |
| 26 |
|