Skip to content

Commit 8b814a2

Browse files
committed
Merge remote-tracking branch 'origin/master' into string/intern
2 parents be65f0d + 7e83068 commit 8b814a2

656 files changed

Lines changed: 7263 additions & 11373 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.php_cs.dist

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,37 @@
11
<?php
22
$finder = PhpCsFixer\Finder::create()
33
->in(__DIR__ . '/src')
4-
->in(__DIR__ . '/tests')
5-
;
4+
->in(__DIR__ . '/tests');
65

76
return PhpCsFixer\Config::create()
87
->setRules([
98
'@PSR2' => true,
10-
'array_syntax' => ['syntax' => 'short'],
9+
'@PhpCsFixer' => true,
10+
'array_syntax' => [
11+
'syntax' => 'short',
12+
],
13+
'blank_line_after_opening_tag' => false,
14+
'blank_line_before_statement' => [
15+
'statements' => [],
16+
],
17+
'concat_space' => [
18+
'spacing' => 'one',
19+
],
20+
'increment_style' => [
21+
'style' => 'post',
22+
],
23+
'no_multiline_whitespace_before_semicolons' => true,
24+
'no_superfluous_phpdoc_tags' => true,
25+
'ordered_class_elements' => false,
26+
'php_unit_internal_class' => false,
27+
'php_unit_test_class_requires_covers' => false,
28+
'phpdoc_align' => [
29+
'align' => 'left',
30+
],
31+
'phpdoc_separation' => false,
32+
'phpdoc_to_comment' => false,
33+
'phpdoc_var_without_name' => false,
34+
'single_blank_line_before_namespace' => false,
35+
'yoda_style' => false,
1136
])
12-
->setFinder($finder)
13-
;
37+
->setFinder($finder);

README.md

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# PHPJava - JVM Emulator by PHP
22
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/dwyl/esta/issues)
33
![Compatibility](https://img.shields.io/badge/Compatibility-7.2%20and%20greater-green.svg)
4-
[![Build Status](https://travis-ci.org/php-java/php-java.png?branch=master)](https://travis-ci.org/memory-agape/php-java)
5-
[![Total Downloads](https://poser.pugx.org/php-java/php-java/downloads)](https://packagist.org/packages/memory-agape/php-java)
4+
[![Build Status](https://travis-ci.org/php-java/php-java.svg?branch=master)](https://travis-ci.org/php-java/php-java)
5+
[![Total Downloads](https://poser.pugx.org/php-java/php-java/downloads)](https://packagist.org/packages/php-java/php-java)
66
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
77
<p align="center"><img src="./docs/img/logo.png" height="300"></p>
88

@@ -292,9 +292,9 @@ $javaClass = new JavaClass(
292292
### Runtime options
293293
- Available options on `JavaClass` or `JavaArchive`:
294294

295-
|Options | Value | Default | Description |Targeted |
296-
|:-------------:|:-------------:|:-------------:|:-------------:|:-------------:|
297-
| entrypoint | string or null | null | The entrypoint in JAR. | JavaArchive |
295+
| Options | Value | Default | Description | Targeted |
296+
|:--------|:------|:--------|:------------|:---------|
297+
| entrypoint | string or null | null | The entrypoint in JAR. | JavaArchive |
298298
| max_stack_exceeded | integer | 9999 | Execute more than the specified number of times be stopped the operation. | JavaClass |
299299
| max_execution_time | integer | 30 | Maximum execution time. | JavaClass |
300300
| strict | boolean | true | When `true`, PHPJava calls a method, variables, and so on strictly; otherwise, it calls them ambiguously. | Both |
@@ -309,7 +309,6 @@ $javaClass = new JavaClass(
309309
| dry_run (Not Implemented) | boolean | false | Checking JavaClass/JavaArchive structure only. When `true`, PHPJava runs in dry-run mode. | Both |
310310
| env (Not Implemented) | enum | Environment::EXPERIMENTAL | Your environment. | Both |
311311

312-
313312
- Example of JavaClass:
314313
```php
315314
<?php
@@ -420,20 +419,20 @@ public static void main(java.lang.String[])
420419

421420
- **Problem 2:** PHPJava cannot completely cover Java types because PHP is different from Java.
422421
The comparison table of Java and PHPJava is shown below:
423-
424-
|Java |PHPJava |
425-
|:-------------:|:-------------:|
426-
|null |null |
427-
|boolean |\PHPJava\Kernel\Types\\_Boolean (including `__toString`) |
428-
|char |\PHPJava\Kernel\Types\\_Char (including `__toString`) |
429-
|byte |\PHPJava\Kernel\Types\\_Byte (including `__toString`) |
430-
|short |\PHPJava\Kernel\Types\\_Short (including `__toString`) |
431-
|int |\PHPJava\Kernel\Types\\_Int (including `__toString`) |
432-
|long |\PHPJava\Kernel\Types\\_Long (including `__toString`) |
433-
|float |\PHPJava\Kernel\Types\\_Float (including `__toString`) |
434-
|double |\PHPJava\Kernel\Types\\_Double (including `__toString`) |
435-
436-
- **Problem 3:** PHPJava cannot calculate big number of `double` and `float` because `gmp_pow` cannot calculate negative exponents. So, PHPJavas use built-in function `pow`.
422+
423+
| Java | PHPJava |
424+
|:-----|:--------|
425+
| null | null |
426+
| boolean | \PHPJava\Kernel\Types\\_Boolean (including `__toString`) |
427+
| char | \PHPJava\Kernel\Types\\_Char (including `__toString`) |
428+
| byte | \PHPJava\Kernel\Types\\_Byte (including `__toString`) |
429+
| short | \PHPJava\Kernel\Types\\_Short (including `__toString`) |
430+
| int | \PHPJava\Kernel\Types\\_Int (including `__toString`) |
431+
| long | \PHPJava\Kernel\Types\\_Long (including `__toString`) |
432+
| float | \PHPJava\Kernel\Types\\_Float (including `__toString`) |
433+
| double | \PHPJava\Kernel\Types\\_Double (including `__toString`) |
434+
435+
- **Problem 3:** PHPJava cannot calculate big number of `double` and `float` because `gmp_pow` cannot calculate negative exponents. So, PHPJava uses built-in function `pow`.
437436

438437
## Run Kotlin on the PHPJava
439438
Do you wanna run Kotlin on the PHPJava? Are you serious?

composer.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@
3737
"friendsofphp/php-cs-fixer": "^2.14"
3838
},
3939
"scripts": {
40-
"tests": "phpunit tests --stop-on-failure && phpcs -n --standard=phpcs.xml src"
40+
"test": "phpunit tests --stop-on-failure",
41+
"cs": "phpcs -n --standard=phpcs.xml src",
42+
"fix": "php-cs-fixer fix",
43+
"tests": [
44+
"@test",
45+
"@cs",
46+
"@fix"
47+
]
4148
}
4249
}

src/Core/JVM/AccessorInterface.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
interface AccessorInterface
88
{
99
public function getFields(): FieldInterface;
10+
1011
public function getMethods(): InvokerInterface;
1112
}

src/Core/JVM/ConstantPool.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ class ConstantPool implements \ArrayAccess, \Countable, \IteratorAggregate
2828
private $reader;
2929

3030
/**
31-
* @param ReaderInterface $reader
32-
* @param int $entries
3331
* @throws ReadEntryException
3432
*/
3533
public function __construct(ReaderInterface $reader, int $entries)
@@ -99,7 +97,7 @@ private function read($entryTag): ?StructureInterface
9997
}
10098

10199
/**
102-
* @return boolean
100+
* @return bool
103101
*/
104102
public function offsetExists($offset)
105103
{
@@ -126,8 +124,6 @@ public function count()
126124
}
127125

128126
/**
129-
* @param mixed $offset
130-
* @param mixed $value
131127
* @throws ReadOnlyException
132128
*/
133129
public function offsetSet($offset, $value)
@@ -136,7 +132,6 @@ public function offsetSet($offset, $value)
136132
}
137133

138134
/**
139-
* @param mixed $offset
140135
* @throws ReadOnlyException
141136
*/
142137
public function offsetUnset($offset)

src/Core/JVM/Field/FieldGettable.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
<?php
22
namespace PHPJava\Core\JVM\Field;
33

4-
use PHPJava\Core\JavaClassInvoker;
54
use PHPJava\Packages\java\lang\_String;
65
use PHPJava\Packages\java\lang\NoSuchFieldException;
76

87
trait FieldGettable
98
{
109
/**
1110
* @param $name
12-
* @return mixed
1311
* @throws NoSuchFieldException
1412
*/
1513
public function get(string $name)

src/Core/JVM/Field/FieldInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
interface FieldInterface
77
{
88
public function __construct(JavaClassInvoker $javaClassInvoker, array $fields);
9+
910
public function get(string $name);
11+
1012
public function set(string $name, $value);
1113
}

src/Core/JVM/Field/FieldSettable.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<?php
22
namespace PHPJava\Core\JVM\Field;
33

4-
use PHPJava\Core\JavaClassInvoker;
5-
64
trait FieldSettable
75
{
86
public function set(string $name, $value)

src/Core/JVM/Field/StaticField.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
namespace PHPJava\Core\JVM\Field;
33

44
use PHPJava\Core\JavaClassInvoker;
5-
use PHPJava\Packages\java\lang\_String;
65

76
class StaticField implements FieldInterface
87
{

src/Core/JVM/FieldPool.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?php
22
namespace PHPJava\Core\JVM;
33

4-
use PHPJava\Core\JavaClass;
54
use PHPJava\Core\Stream\Reader\ReaderInterface;
65
use PHPJava\Exceptions\ReadOnlyException;
76
use PHPJava\Kernel\Structures\_FieldInfo;

0 commit comments

Comments
 (0)