Skip to content

Commit d7c2024

Browse files
committed
Update
1 parent e312833 commit d7c2024

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

phpcs.xml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,21 @@
88
</rule>
99

1010
<rule ref="Squiz.Classes.ValidClassName.NotCamelCaps">
11-
<exclude-pattern>./src/kernel/types</exclude-pattern>
12-
<exclude-pattern>./src/kernel/mnemonics</exclude-pattern>
13-
<exclude-pattern>./src/kernel/structures</exclude-pattern>
14-
<exclude-pattern>./src/imitation/java/lang/_Object.php</exclude-pattern>
15-
<exclude-pattern>./src/imitation/java/lang/_String.php</exclude-pattern>
16-
<exclude-pattern>./src/imitation/phpjava/extended/_Object</exclude-pattern>
11+
<exclude-pattern>./src/Kernel/Types</exclude-pattern>
12+
<exclude-pattern>./src/Kernel/Mnemonics</exclude-pattern>
13+
<exclude-pattern>./src/Kernel/Structures</exclude-pattern>
14+
<exclude-pattern>./src/Imitation/PHPJava/Extended/_Object.php</exclude-pattern>
1715
</rule>
1816

1917
<rule ref="Generic.NamingConventions.UpperCaseConstantName.ClassConstantNotUpperCase">
2018
<exclude-pattern>./src/kernel/maps</exclude-pattern>
2119
</rule>
2220

21+
22+
<rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps">
23+
<exclude-pattern>./src/Imitation/PHPJava/Extended/_Object.php</exclude-pattern>
24+
</rule>
25+
2326
<arg name="colors"/>
2427
<arg value="p"/>
2528

src/Imitation/PHPJava/Extended/_Object.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,43 +19,47 @@ public function __destruct()
1919

2020
public function __call($name, $arguments)
2121
{
22+
$defaultName = '__default_' . $name;
23+
if (method_exists($this, $defaultName)) {
24+
return $this->{$defaultName}(...$arguments);
25+
}
2226
throw new NoSuchMethodException($name . ' does not exist on ' . get_class($this));
2327
}
2428

25-
public function clone(): _Object
29+
public function __default_clone(): _Object
2630
{
2731
return clone $this;
2832
}
2933

30-
public function equals($a = null)
34+
public function __default_equals($a = null)
3135
{
3236
return $this === $a;
3337
}
3438

35-
public function getClass(): self
39+
public function __default_getClass(): self
3640
{
3741
return $this;
3842
}
3943

40-
public function hashCode()
44+
public function __default_hashCode()
4145
{
4246
if (version_compare(PHP_VERSION, '7.2', '<')) {
4347
return crc32(spl_object_hash($this));
4448
}
4549
return spl_object_id($this);
4650
}
4751

48-
public function notify(): void
52+
public function __default_notify(): void
4953
{
5054
// not implemented.
5155
}
5256

53-
public function notifyAll(): void
57+
public function __default_notifyAll(): void
5458
{
5559
// not implemented.
5660
}
5761

58-
public function toString($a = null)
62+
public function __default_toString()
5963
{
6064
return 'java.lang.Object@PHPJava' . spl_object_hash($this);
6165
}
@@ -65,12 +69,12 @@ public function __toString(): string
6569
return $this->toString();
6670
}
6771

68-
public function wait(int $timeout = null, int $nanos = null): void
72+
public function __default_wait(int $timeout = null, int $nanos = null): void
6973
{
7074
// not implemented.
7175
}
7276

73-
public function finalize(): void
77+
public function __default_finalize(): void
7478
{
7579
}
7680
}

0 commit comments

Comments
 (0)