Compare commits
10 Commits
521c4bc51f
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| ee67a82f64 | |||
| 577b2d3eeb | |||
| 9d669625bb | |||
| a558567ba9 | |||
| 59e0f3eb5b | |||
| 42a0e9b97d | |||
| 79909e0877 | |||
| 404d5b71f4 | |||
|
|
8947606d57 | ||
|
|
e560875d9e |
10
.gitignore
vendored
10
.gitignore
vendored
@@ -1,8 +1,4 @@
|
||||
# ---> Composer
|
||||
composer.lock
|
||||
composer.phar
|
||||
/vendor/
|
||||
|
||||
# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
|
||||
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
|
||||
# composer.lock
|
||||
|
||||
/nbproject/
|
||||
/vendor/
|
||||
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 Potter
|
||||
Copyright (c) 2025 Jay Potter
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||
associated documentation files (the "Software"), to deal in the Software without restriction, including
|
||||
|
||||
20
composer.json
Normal file
20
composer.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "potter/cloneable",
|
||||
"type": "library",
|
||||
"require": {
|
||||
"php": "^8.4"
|
||||
},
|
||||
"license": "MIT",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Potter\\Cloneable\\": "src/Potter/Cloneable/"
|
||||
}
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jay Potter",
|
||||
"email": "j@ypotter.ca"
|
||||
}
|
||||
],
|
||||
"minimum-stability": "dev"
|
||||
}
|
||||
10
src/Potter/Cloneable/AbstractCloneable.php
Normal file
10
src/Potter/Cloneable/AbstractCloneable.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Potter\Cloneable;
|
||||
|
||||
abstract class AbstractCloneable implements CloneableInterface
|
||||
{
|
||||
abstract public function clone(): CloneableInterface;
|
||||
}
|
||||
10
src/Potter/Cloneable/Cloneable.php
Normal file
10
src/Potter/Cloneable/Cloneable.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Potter\Cloneable;
|
||||
|
||||
abstract class Cloneable extends AbstractCloneable
|
||||
{
|
||||
use CloneableTrait;
|
||||
}
|
||||
10
src/Potter/Cloneable/CloneableInterface.php
Normal file
10
src/Potter/Cloneable/CloneableInterface.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Potter\Cloneable;
|
||||
|
||||
interface CloneableInterface
|
||||
{
|
||||
public function clone(): self;
|
||||
}
|
||||
13
src/Potter/Cloneable/CloneableTrait.php
Normal file
13
src/Potter/Cloneable/CloneableTrait.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Potter\Cloneable;
|
||||
|
||||
trait CloneableTrait
|
||||
{
|
||||
final public function clone(): CloneableInterface
|
||||
{
|
||||
return clone $this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user