-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Public API's GenericEvent replacement (take 2) #17834
Conversation
New events should subclass our |
updated the intro |
* \OCP\EventDispatcher\Event | ||
* | ||
* @package OCP\EventDispatcher | ||
* @since 18.0.0 |
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.
How about deprecating it right away?
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.
then, we can also skip this entirely
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.
Still makes it easier to refactor step by step that way I'd say.
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.
What in general is problematic with private events is that they do not follow an API. So you can put there some magic in it, and no app can reliably do anything with it, because there is no stable description of it. This GenericEvent offers some access methods. So while you still do not know what exactly is behind, at least there a standardized access methods to get context out of that event. Therefore, I wouldn't really want to deprecate it at all, tbh.
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.
Ok, also fine by me then.
@ChristophWurst what about you? :) |
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.
Whoooooops I thought I already pressed the button. Sorry :)
6326091
to
f04dbc5
Compare
i'll need to touch tests → next week |
5c0e179
to
ea4bee6
Compare
Signed-off-by: Arthur Schiwon <[email protected]>
ea4bee6
to
0727d0a
Compare
great, test pass locally :-/ |
@@ -237,7 +241,7 @@ public function testPostDeleteMeta() { | |||
$dispatcherCalled = false; | |||
/** @var Node $dispatcherNode */ | |||
$dispatcherNode = null; | |||
$this->eventDispatcher->addListener('\OCP\Files::postDelete', function (GenericEvent $event) use (&$dispatcherCalled, &$dispatcherNode) { | |||
$this->eventDispatcher->addListener('\OCP\Files::postDelete', function (APIGenericEvent $event) use (&$dispatcherCalled, &$dispatcherNode) { |
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.
There is no APIGenericEvent dispatched but a symfony GenericEvent, so the type hint seems to cause the test failures.
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.
Fixes them locally but tests also only fail for me on a clean checkout when running all tests though autotest.sh, not when running them individually
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.
have not seen your comment since, but yeah, with a fresh checkout i could reproduce this, too, and found the culprit quickly. Thanks still :)
* those are added to 18 only anyway :) Signed-off-by: Arthur Schiwon <[email protected]>
27063c1
to
fc16b09
Compare
replacement of #17650
The approach above is not really awesome, because it causes breaks and kills backwards compatibility.
The approach now is to
Event
, or less ideally this GenericEvent, anyway not Symfony's old ones