Skip to content

Commit 7e83068

Browse files
authored
Merge pull request #141 from php-java/feat/rules
Add custom rules/script for php-cs-fixer
2 parents 77668db + 139c233 commit 7e83068

653 files changed

Lines changed: 7180 additions & 11346 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);

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 & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ class ConstantPool implements \ArrayAccess, \Countable, \IteratorAggregate
2727
private $reader;
2828

2929
/**
30-
* @param ReaderInterface $reader
31-
* @param int $entries
3230
* @throws ReadEntryException
3331
*/
3432
public function __construct(ReaderInterface $reader, int $entries)
@@ -98,7 +96,7 @@ private function read($entryTag): ?StructureInterface
9896
}
9997

10098
/**
101-
* @return boolean
99+
* @return bool
102100
*/
103101
public function offsetExists($offset)
104102
{

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;

src/Core/JVM/InterfacePool.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\Utilities\DebugTool;

0 commit comments

Comments
 (0)