Skip to content

Commit b3e54ec

Browse files
committed
Update composer scripts, vendor and readme
1 parent c698b5d commit b3e54ec

File tree

4 files changed

+101
-5
lines changed

4 files changed

+101
-5
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
# 🫚 Gember MessageBus: Symfony Messenger
2+
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](LICENSE)
3+
[![PHP Version](https://img.shields.io/badge/php-%5E8.3-8892BF.svg?style=flat)](http://www.php.net)
4+
25
Gember MessageBus ([gember/event-sourcing](https://github.com/GemberPHP/event-sourcing)) implementation based on [symfony/messenger](https://github.com/symfony/messenger).

captainhook.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
"enabled": true,
44
"actions": [
55
{
6-
"action": "composer cs"
6+
"action": "composer cs:dry-run"
7+
},
8+
{
9+
"action": "composer rector:dry-run"
710
},
811
{
912
"action": "composer phpstan"

composer.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"friendsofphp/php-cs-fixer": "^3.58",
3131
"phpstan/phpstan": "^1.11",
3232
"phpunit/phpunit": "^11.1",
33+
"rector/rector": "^1.2",
3334
"rregeer/phpunit-coverage-check": "^0.3.1",
3435
"shipmonk/composer-dependency-analyser": "^1.5",
3536
"symfony/property-access": "^7.0"
@@ -49,15 +50,18 @@
4950
},
5051
"scripts": {
5152
"coverage": "vendor/bin/coverage-check var/coverage/clover.xml 95",
52-
"cs": "vendor/bin/php-cs-fixer fix --diff --dry-run --config=.php-cs-fixer.php",
53-
"cs:fix": "vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php",
53+
"cs": "vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php",
54+
"cs:dry-run": "vendor/bin/php-cs-fixer fix --diff --dry-run --config=.php-cs-fixer.php",
5455
"dependency-analyser": "vendor/bin/composer-dependency-analyser",
5556
"phpstan": "vendor/bin/phpstan analyse -c phpstan.neon",
5657
"phpunit": "XDEBUG_MODE=coverage vendor/bin/phpunit",
58+
"rector": "vendor/bin/rector process --ansi",
59+
"rector:dry-run": "vendor/bin/rector process --ansi --dry-run",
5760
"test": [
58-
"@cs",
59-
"@dependency-analyser",
61+
"@rector:dry-run",
62+
"@cs:dry-run",
6063
"@phpstan",
64+
"@dependency-analyser",
6165
"@phpunit",
6266
"@coverage"
6367
]

rector.php

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\CodeQuality\Rector\FuncCall\RemoveSoleValueSprintfRector;
6+
use Rector\CodeQuality\Rector\FuncCall\UnwrapSprintfOneArgumentRector;
7+
use Rector\CodeQuality\Rector\FunctionLike\SimplifyUselessVariableRector;
8+
use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
9+
use Rector\Config\RectorConfig;
10+
use Rector\DeadCode\Rector\Array_\RemoveDuplicatedArrayKeyRector;
11+
use Rector\DeadCode\Rector\Cast\RecastingRemovalRector;
12+
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector;
13+
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector;
14+
use Rector\DeadCode\Rector\Foreach_\RemoveUnusedForeachKeyRector;
15+
use Rector\DeadCode\Rector\If_\ReduceAlwaysFalseIfOrRector;
16+
use Rector\DeadCode\Rector\If_\RemoveUnusedNonEmptyArrayBeforeForeachRector;
17+
use Rector\DeadCode\Rector\Node\RemoveNonExistingVarAnnotationRector;
18+
use Rector\DeadCode\Rector\Property\RemoveUselessReadOnlyTagRector;
19+
use Rector\DeadCode\Rector\Property\RemoveUselessVarTagRector;
20+
use Rector\DeadCode\Rector\Ternary\TernaryToBooleanOrFalseToBooleanAndRector;
21+
use Rector\Php80\Rector\Catch_\RemoveUnusedVariableInCatchRector;
22+
use Rector\Php80\Rector\ClassConstFetch\ClassOnThisVariableObjectRector;
23+
use Rector\Php80\Rector\FuncCall\ClassOnObjectRector;
24+
use Rector\Php80\Rector\Identical\StrEndsWithRector;
25+
use Rector\Php80\Rector\Identical\StrStartsWithRector;
26+
use Rector\Php80\Rector\NotIdentical\StrContainsRector;
27+
use Rector\Php81\Rector\Array_\FirstClassCallableRector;
28+
use Rector\Php81\Rector\Property\ReadOnlyPropertyRector;
29+
use Rector\Php82\Rector\Class_\ReadOnlyClassRector;
30+
use Rector\Php83\Rector\ClassConst\AddTypeToConstRector;
31+
use Rector\Php83\Rector\ClassMethod\AddOverrideAttributeToOverriddenMethodsRector;
32+
use Rector\Privatization\Rector\ClassMethod\PrivatizeFinalClassMethodRector;
33+
use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector;
34+
35+
$config = RectorConfig::configure()
36+
->withCache(__DIR__ . '/var/rector')
37+
->withPaths([
38+
__DIR__ . '/src',
39+
])
40+
->withParallel()
41+
->withRules([
42+
// Misc
43+
PrivatizeFinalClassPropertyRector::class,
44+
PrivatizeFinalClassMethodRector::class,
45+
UnwrapSprintfOneArgumentRector::class,
46+
RemoveSoleValueSprintfRector::class,
47+
CountArrayToEmptyArrayComparisonRector::class,
48+
// See withConfiguredRule below for more
49+
50+
// Misc - Deadcode
51+
RemoveUnusedForeachKeyRector::class,
52+
RemoveDuplicatedArrayKeyRector::class,
53+
RecastingRemovalRector::class,
54+
RemoveUnusedNonEmptyArrayBeforeForeachRector::class,
55+
TernaryToBooleanOrFalseToBooleanAndRector::class,
56+
RemoveUselessParamTagRector::class,
57+
RemoveUselessReturnTagRector::class,
58+
RemoveUselessReadOnlyTagRector::class,
59+
RemoveNonExistingVarAnnotationRector::class,
60+
RemoveUselessVarTagRector::class,
61+
ReduceAlwaysFalseIfOrRector::class,
62+
63+
// PHP 8.0
64+
ClassOnThisVariableObjectRector::class,
65+
ClassOnObjectRector::class,
66+
StrStartsWithRector::class,
67+
StrEndsWithRector::class,
68+
StrContainsRector::class,
69+
RemoveUnusedVariableInCatchRector::class,
70+
71+
// PHP 8.1
72+
ReadOnlyPropertyRector::class,
73+
FirstClassCallableRector::class,
74+
75+
// PHP 8.2
76+
ReadOnlyClassRector::class,
77+
78+
// PHP 8.3
79+
AddTypeToConstRector::class,
80+
AddOverrideAttributeToOverriddenMethodsRector::class,
81+
])
82+
->withConfiguredRule(SimplifyUselessVariableRector::class, [
83+
SimplifyUselessVariableRector::ONLY_DIRECT_ASSIGN => true,
84+
]);
85+
86+
return $config;

0 commit comments

Comments
 (0)