-
Notifications
You must be signed in to change notification settings - Fork 0
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
Working draft for Event subsystem #1
Conversation
cc93935
to
da1afec
Compare
src/Event/NamedType.php
Outdated
|
||
public function is(Type $other): bool | ||
{ | ||
return $other->asString() === $this->asString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems prone to collision with other types.
Maybe change to get_class($other) === get_class($this) && $other->asString() === $this->asString()
?
Note that in PHP the object has access to the $name
property of $other
since it's in the same class, so this would also work:
return get_class($other) === get_class($this) && $other->name === $this->name;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this class will vanish (see below), this point is probably mute.
Regarding property access: Yes, we are aware of that but I consider it bad software design. The asString
is part of the public API, the existence of the property name
is a (private) implementation detail.
src/Event/UnsupportedEvent.php
Outdated
{ | ||
public static function type(Type $type): self | ||
{ | ||
return new self(\sprintf('Type "%s" not supported', $type->asString())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add the class name of the subscriber here to create a bit of context: Event subscriber "Foo\Bar\BazSubscriber" does not support events of type "blah"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea.
Even though this should technically be almost impossible to ever trigger, given that the dispatcher uses the same method to find out what types of events to send to this subscriber.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, thank you, @rpkamp!
Really awesome that you're implementing this 👍 🚀 |
bb76c8e
to
0c15889
Compare
Codecov Report
@@ Coverage Diff @@
## master #1 +/- ##
============================================
+ Coverage 83.56% 84.18% +0.61%
- Complexity 4501 4733 +232
============================================
Files 218 260 +42
Lines 11030 11745 +715
============================================
+ Hits 9217 9887 +670
- Misses 1813 1858 +45
Continue to review full report at Codecov.
|
ecd9405
to
5d15372
Compare
9fd3d89
to
252d6f3
Compare
Fixes #68. Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Fixes #32. Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Remove redundant formatter Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
This PR is closed as it was merged by other means. |
This PR
phpunit
Build Status