File tree Expand file tree Collapse file tree 2 files changed +21
-5
lines changed
src/Packages/PHPJava/Extended
tests/Packages/PHPJava/Extended Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Original file line number Diff line number Diff line change 33
44use PHPJava \Packages \PHPJava \Kernel \Behavior \System ;
55use PHPJava \Packages \java \lang \NoSuchMethodException ;
6+ use PHPJava \Packages \java \lang \CloneNotSupportedException ;
67
78trait _Object
89{
@@ -40,12 +41,9 @@ public function __call($name, $arguments)
4041 throw new NoSuchMethodException ($ name . ' does not exist on ' . get_class ($ this ));
4142 }
4243
43- /**
44- * @return _Object
45- */
46- public function __default_clone (): _Object
44+ public function __default_clone (): void
4745 {
48- return clone $ this ;
46+ throw new CloneNotSupportedException () ;
4947 }
5048
5149 /**
Original file line number Diff line number Diff line change 1+ <?php
2+ namespace PHPJava \Tests \Packages \PHPJava \Extended \_Object ;
3+
4+ use PHPUnit \Framework \TestCase ;
5+ use PHPJava \Packages \java \lang \CloneNotSupportedException ;
6+
7+ class _ObjectTest extends Base
8+ {
9+ public function testClone ()
10+ {
11+ $ this ->expectException (CloneNotSupportedException::class);
12+
13+ clone new class
14+ {
15+ use \PHPJava \Packages \PHPJava \Extended \_Object;
16+ };
17+ }
18+ }
You can’t perform that action at this time.
0 commit comments