Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Adjust Symfony eventDispatcher->dispatch calls#279

Merged
phil-davis merged 2 commits intomasterfrom
eventDispatcher-dispatch
Feb 7, 2020
Merged

Adjust Symfony eventDispatcher->dispatch calls#279
phil-davis merged 2 commits intomasterfrom
eventDispatcher-dispatch

Conversation

@phil-davis
Copy link
Contributor

Similar to owncloud/core#36897

We updated from Symfony 3.4 to 4.4 in PR #36881
Symfony 4.3 (and thus 4.4) adjusted the EventDispatcher dispatch method to take parameters in the opposite order.
https://symfony.com/blog/new-in-symfony-4-3-simpler-event-dispatching
symfony/symfony#28920
symfony/symfony#33115

The change was made in a BC way - if the parameters are provided the old way around, then the dispatch method flips them. So existing code is OK. But in Symfony5 the "old way" is likely to have been removed.

phan code analysis reports that the parameters are around the "wrong way" (the old way). e.g.

lib/Jobs/PasswordExpirationNotifierJob.php:170 PhanTypeMismatchArgument Argument 1 (event) is 'user.passwordAboutToExpire' but \Symfony\Component\EventDispatcher\EventDispatcher::dispatch() takes object defined at ../../lib/composer/symfony/event-dispatcher/EventDispatcher.php:51
lib/Jobs/PasswordExpirationNotifierJob.php:215 PhanTypeMismatchArgument Argument 1 (event) is 'user.passwordExpired' but \Symfony\Component\EventDispatcher\EventDispatcher::dispatch() takes object defined at ../../lib/composer/symfony/event-dispatcher/EventDispatcher.php:51

Fix this to match the currently expected order of arguments

@phil-davis phil-davis force-pushed the eventDispatcher-dispatch branch from e0a1c46 to 23a7138 Compare February 6, 2020 09:03
@phil-davis phil-davis requested a review from micbar February 6, 2020 11:45
@codecov
Copy link

codecov bot commented Feb 7, 2020

Codecov Report

Merging #279 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #279   +/-   ##
=========================================
  Coverage     73.52%   73.52%           
  Complexity      230      230           
=========================================
  Files            25       25           
  Lines           982      982           
=========================================
  Hits            722      722           
  Misses          260      260
Impacted Files Coverage Δ Complexity Δ
lib/HooksHandler.php 81.93% <ø> (ø) 39 <0> (ø) ⬇️
lib/Jobs/PasswordExpirationNotifierJob.php 100% <100%> (ø) 16 <0> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2269467...a621eca. Read the comment docs.

@phil-davis phil-davis merged commit 82f3a14 into master Feb 7, 2020
@delete-merged-branch delete-merged-branch bot deleted the eventDispatcher-dispatch branch February 7, 2020 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants