Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add command bus, Drop PHP 8.1 #644

Merged
merged 27 commits into from
Jan 12, 2025
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f937e6d
poc command bus
DavidBadura Nov 7, 2024
fb591b4
add handler
DavidBadura Nov 7, 2024
c4ebea4
add exceptions
DavidBadura Nov 7, 2024
a6fd621
improve api
DavidBadura Nov 8, 2024
069fc15
add service injection
DavidBadura Dec 9, 2024
a1e6159
add some tests
DavidBadura Dec 9, 2024
a5ca1aa
add missing dependency
DavidBadura Dec 9, 2024
03d5432
add more tests
DavidBadura Dec 9, 2024
68fc541
add type info
DavidBadura Dec 10, 2024
9e9ac40
remove php8.1 support
DavidBadura Dec 10, 2024
5d8f28f
ignore cs check in test file
DavidBadura Dec 10, 2024
30bda21
fix cs
DavidBadura Dec 10, 2024
a6bf7d0
make Inject attribute optional
DavidBadura Dec 12, 2024
f632a8b
fix cs
DavidBadura Dec 12, 2024
176857a
allow only one handle attribute per method
DavidBadura Dec 20, 2024
741656a
refactor handler provider
DavidBadura Dec 20, 2024
2b74768
refactor handler finder
DavidBadura Dec 20, 2024
e3b049b
allow handle method without parameter if command is specified
DavidBadura Dec 21, 2024
66ba412
refactor parameter resolver
DavidBadura Dec 21, 2024
63a63f3
fix static analyser
DavidBadura Jan 2, 2025
c66018b
remove handler factory & add exception for missing service
DavidBadura Jan 2, 2025
0faa1de
add service handler provider & more tests
DavidBadura Jan 4, 2025
4f5d43c
update docs
DavidBadura Jan 11, 2025
bf9b4bd
fix pipeline
DavidBadura Jan 11, 2025
6887364
fix pipeline
DavidBadura Jan 11, 2025
6f804ea
rename DefaultCommandBus into SyncCommandBus
DavidBadura Jan 12, 2025
6fed2c3
update docs
DavidBadura Jan 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ jobs:
- "lowest"
- "highest"
php-version:
- "8.1"
- "8.2"
- "8.3"
operating-system:
Expand Down
50 changes: 42 additions & 8 deletions baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@
<code><![CDATA[$this->frozenDateTime->modify(sprintf('+%s seconds', $seconds))]]></code>
</PossiblyFalsePropertyAssignmentValue>
</file>
<file src="src/CommandBus/Handler/CreateAggregateHandler.php">
<InvalidOperand>
<code><![CDATA[$this->parameterResolver->resolve($reflectionMethod, $command)]]></code>
</InvalidOperand>
</file>
<file src="src/CommandBus/Handler/UpdateAggregateHandler.php">
<InvalidOperand>
<code><![CDATA[$this->parameterResolver->resolve($reflectionMethod, $command)]]></code>
</InvalidOperand>
</file>
<file src="src/Console/DoctrineHelper.php">
<ClassNotFinal>
<code><![CDATA[class DoctrineHelper]]></code>
Expand Down Expand Up @@ -57,9 +67,6 @@
</InvalidReturnType>
</file>
<file src="src/Metadata/AggregateRoot/AttributeAggregateRootMetadataFactory.php">
<DocblockTypeContradiction>
<code><![CDATA[$reflectionType instanceof ReflectionIntersectionType]]></code>
</DocblockTypeContradiction>
<InvalidReturnStatement>
<code><![CDATA[$this->aggregateMetadata[$aggregate]]]></code>
</InvalidReturnStatement>
Expand Down Expand Up @@ -219,6 +226,33 @@
<code><![CDATA[$row['payload']]]></code>
</MixedArgument>
</file>
<file src="tests/Unit/CommandBus/AggregateHandlerProviderTest.php">
<InvalidArrayAccess>
<code><![CDATA[$result[0]]]></code>
<code><![CDATA[$result[0]]]></code>
<code><![CDATA[$result[0]]]></code>
</InvalidArrayAccess>
<MixedMethodCall>
<code><![CDATA[callable]]></code>
<code><![CDATA[callable]]></code>
<code><![CDATA[callable]]></code>
</MixedMethodCall>
</file>
<file src="tests/Unit/CommandBus/DefaultCommandBusTest.php">
<InvalidPropertyFetch>
<code><![CDATA[$handler->command]]></code>
</InvalidPropertyFetch>
</file>
<file src="tests/Unit/CommandBus/Handler/DefaultHandlerFactoryTest.php">
<ArgumentTypeCoercion>
<code><![CDATA['aggregateClass']]></code>
<code><![CDATA['aggregateClass']]></code>
</ArgumentTypeCoercion>
<UndefinedClass>
<code><![CDATA['aggregateClass']]></code>
<code><![CDATA['aggregateClass']]></code>
</UndefinedClass>
</file>
<file src="tests/Unit/EventBus/DefaultEventBusTest.php">
<MoreSpecificImplementedParamType>
<code><![CDATA[$message]]></code>
Expand All @@ -229,16 +263,16 @@
<code><![CDATA[$value]]></code>
</MixedArgumentTypeCoercion>
</file>
<file src="tests/Unit/Fixture/ProfileWithBrokenApplyIntersection.php">
<ReservedWord>
<code><![CDATA[ProfileCreated&ProfileVisited $event]]></code>
</ReservedWord>
</file>
<file src="tests/Unit/Fixture/ProfileWithBrokenApplyNoType.php">
<MissingParamType>
<code><![CDATA[$event]]></code>
</MissingParamType>
</file>
<file src="tests/Unit/Fixture/ProfileWithNoTypeHandler.php">
<MissingParamType>
<code><![CDATA[$command]]></code>
</MissingParamType>
</file>
<file src="tests/Unit/Metadata/Subscriber/AttributeSubscriberMetadataFactoryTest.php">
<MissingParamType>
<code><![CDATA[$message]]></code>
Expand Down
8 changes: 5 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,24 @@
}
],
"require": {
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
"php": "~8.2.0 || ~8.3.0",
"doctrine/dbal": "^4.0.0",
"doctrine/migrations": "^3.3.2",
"patchlevel/hydrator": "^1.5.0",
"patchlevel/worker": "^1.2.0",
"psr/cache": "^2.0.0|^3.0.0",
"psr/clock": "^1.0",
"psr/container": "^2.0",
"psr/event-dispatcher": "^1.0",
"psr/log": "^2.0.0|^3.0.0",
"psr/simple-cache": "^2.0.0|^3.0.0",
"ramsey/uuid": "^4.7",
"symfony/console": "^5.4.32|^6.4.1|^7.0.1",
"symfony/finder": "^5.4.27|^6.4.0|^7.0.0"
"symfony/finder": "^5.4.27|^6.4.0|^7.0.0",
"symfony/type-info": "^7.2"
},
"require-dev": {
"ext-pdo_sqlite": "~8.1.0 || ~8.2.0 || ~8.3.0",
"ext-pdo_sqlite": "~8.2.0 || ~8.3.0",
"cspray/phinal": "^2.0.0",
"doctrine/orm": "^2.18.0|^3.0.0",
"infection/infection": "^0.27.10",
Expand Down
100 changes: 88 additions & 12 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions deptrac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ deptrac:
collectors:
- type: directory
value: src/Clock/.*
- name: CommandBus
collectors:
- type: directory
value: src/CommandBus/.*
- name: Console
collectors:
- type: directory
Expand Down Expand Up @@ -103,6 +107,11 @@ deptrac:
- MetadataAggregate
Attribute:
Clock:
CommandBus:
- Aggregate
- Attribute
- MetadataAggregate
- Repository
Console:
- Aggregate
- Message
Expand Down
1 change: 1 addition & 0 deletions docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ nav:
- Message: message.md
- Store: store.md
- Subscription: subscription.md
- Command Bus: command_bus.md
- Event Bus: event_bus.md
- Advanced:
- Aggregate ID: aggregate_id.md
Expand Down
Loading
Loading