Skip to content

Commit 4e6eeb9

Browse files
authored
Enhance project configuration and add new files for improved coding s… (#243)
* Enhance project configuration and add new files for improved coding standards and testing * Add PHPStan baseline errors for improved code quality checks * Add CI/CD workflows for PHP with Docker support * Add CI/CD workflows for PHP with Docker support
1 parent 971b735 commit 4e6eeb9

36 files changed

Lines changed: 1785 additions & 609 deletions

.ci-tools/deptrac.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
parameters:
2+
paths:
3+
- '../src'
4+
layers:
5+
- name: 'OTP'
6+
collectors:
7+
- type: 'classLike'
8+
value: '^OTPHP\\'
9+
- name: 'Vendors'
10+
collectors:
11+
- { type: 'classLike', value: '^ParagonIE\\' }
12+
- { type: 'classLike', value: '^Psr\\Clock\\' }
13+
ruleset:
14+
OTP:
15+
- Vendors

ecs.php renamed to .ci-tools/ecs.php

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
declare(strict_types=1);
44

5-
use PhpCsFixer\Fixer\Alias\MbStrFunctionsFixer;
65
use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer;
76
use PhpCsFixer\Fixer\ClassNotation\ProtectedToPrivateFixer;
87
use PhpCsFixer\Fixer\Comment\HeaderCommentFixer;
@@ -26,11 +25,13 @@
2625
use PhpCsFixer\Fixer\Strict\StrictComparisonFixer;
2726
use PhpCsFixer\Fixer\Strict\StrictParamFixer;
2827
use PhpCsFixer\Fixer\Whitespace\ArrayIndentationFixer;
29-
use PhpCsFixer\Fixer\Whitespace\CompactNullableTypehintFixer;
28+
use PhpCsFixer\Fixer\Whitespace\MethodChainingIndentationFixer;
29+
use Symplify\CodingStandard\Fixer\Spacing\MethodChainingNewlineFixer;
3030
use Symplify\EasyCodingStandard\Config\ECSConfig;
3131
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
3232

3333
return static function (ECSConfig $config): void {
34+
$header = '';
3435
$config->import(SetList::PSR_12);
3536
$config->import(SetList::CLEAN_CODE);
3637
$config->import(SetList::DOCTRINE_ANNOTATIONS);
@@ -52,11 +53,9 @@
5253
$config->rule(ProtectedToPrivateFixer::class);
5354
$config->rule(DeclareStrictTypesFixer::class);
5455
$config->rule(NativeConstantInvocationFixer::class);
55-
$config->rule(MbStrFunctionsFixer::class);
5656
$config->rule(LinebreakAfterOpeningTagFixer::class);
5757
$config->rule(CombineConsecutiveIssetsFixer::class);
5858
$config->rule(CombineConsecutiveUnsetsFixer::class);
59-
$config->rule(CompactNullableTypehintFixer::class);
6059
$config->rule(NoSuperfluousElseifFixer::class);
6160
$config->rule(NoSuperfluousPhpdocTagsFixer::class);
6261
$config->rule(PhpdocTrimConsecutiveBlankLineSeparationFixer::class);
@@ -72,7 +71,7 @@
7271
'strict' => true,
7372
]);
7473
$config->ruleWithConfiguration(HeaderCommentFixer::class, [
75-
'header' => '',
74+
'header' => $header,
7675
]);
7776
$config->ruleWithConfiguration(AlignMultilineCommentFixer::class, [
7877
'comment_type' => 'all_multiline',
@@ -86,7 +85,18 @@
8685
'import_functions' => true,
8786
]);
8887

88+
$config->skip([
89+
PhpUnitTestClassRequiresCoversFixer::class,
90+
MethodChainingIndentationFixer::class => [__DIR__ . '/src/Resources/config'],
91+
MethodChainingNewlineFixer::class => [__DIR__ . '/src/Resources/config'],
92+
]);
93+
8994
$config->parallel();
90-
$config->paths([__DIR__]);
91-
$config->skip([__DIR__ . '/vendor', PhpUnitTestClassRequiresCoversFixer::class]);
95+
$config->paths([
96+
__DIR__ . '/../src',
97+
__DIR__ . '/../tests',
98+
__DIR__ . '/../castor.php',
99+
__DIR__ . '/ecs.php',
100+
__DIR__ . '/rector.php',
101+
]);
92102
};
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@
44
"src"
55
]
66
},
7+
"timeout": 3,
78
"logs": {
8-
"text": "infection.log"
9+
"text": "infection.txt"
910
},
1011
"mutators": {
1112
"@default": true,
13+
"global-ignoreSourceCodeByRegex": [
14+
"\\$this->logger.*",
15+
"\\$this->cache->save.*",
16+
"parent::build(\\$container);"
17+
],
1218
"MBString": {
1319
"settings": {
1420
"mb_substr": false,

.ci-tools/phpbench.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"runner.bootstrap": "../vendor/bootstrap.php",
3+
"runner.path": "../performance",
4+
"runner.progress": "dots",
5+
"runner.time_unit": "microseconds",
6+
"runner.retry_threshold": 10,
7+
"report.generators": {
8+
"full": {
9+
"extends": "aggregate",
10+
"cols": ["benchmark", "subject", "set", "revs", "its", "mem_peak", "best", "mode", "mean", "worst", "stdev", "rstdev"]
11+
},
12+
"simple": {
13+
"extends": "aggregate",
14+
"cols": ["benchmark", "subject", "set", "best", "mean", "worst"]
15+
}
16+
},
17+
"report.outputs": {
18+
"all": {
19+
"renderer": "html",
20+
"file": "report.html",
21+
"title": "Jose Performance Test Suite"
22+
}
23+
}
24+
}

0 commit comments

Comments
 (0)