-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] add a notice when passing a routerInterface without warmupInterface in RouterCacheWarmer #24894
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
[FrameworkBundle] add a notice when passing a routerInterface without warmupInterface in RouterCacheWarmer #24894
Conversation
f437cf8
to
66d49f3
Compare
@@ -43,6 +43,8 @@ public function warmUp($cacheDir) | |||
{ | |||
if ($this->router instanceof WarmableInterface) { | |||
$this->router->warmUp($cacheDir); | |||
} else { | |||
trigger_error(sprintf('%s is not a instanceof %s, no warmUp has been triggered.', get_class($this->router), WarmableInterface::class), \E_USER_NOTICE); |
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.
IMHO we could trigger a deprecation now and throw a LogicException at the end.
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.
Ddo we ever trigger a notice in the code base? This is suspicious to me :)
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.
We trigger warning but not notices you are right, I will change that with @chalasr's suggestion
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.
Since we are triggering a deprecation, we should go with master ?
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.
Yes, triggering/throwing does not fix a bug, it only enhances DX. This is for master in any case IMO
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.
That's for 4.1 IMHO.
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.
Rebase and throw added.
66d49f3
to
6656dbe
Compare
0458373
to
6df98e5
Compare
|
||
return; | ||
} else { | ||
@trigger_error(sprintf('Passing a %s without implementing %s is deprecated since 4.1.', RouterInterface::class, WarmableInterface::class), \E_USER_DEPRECATED); |
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 do not understand why we care about a deprecation if we immediately throw afterwards anyway.
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.
We MUST NOT throw (we cannot do it until 5.0). We should have only the deprecation notice.
|
||
return; | ||
} else { | ||
@trigger_error(sprintf('Passing a %s without implementing %s is deprecated since 4.1.', RouterInterface::class, WarmableInterface::class), \E_USER_DEPRECATED); |
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.
We MUST NOT throw (we cannot do it until 5.0). We should have only the deprecation notice.
6df98e5
to
4128cf8
Compare
done @stof |
4128cf8
to
cfd840f
Compare
I will update the Changelog |
Travis failure seems unrelated |
@@ -45,6 +45,10 @@ public function warmUp($cacheDir) | |||
|
|||
if ($router instanceof WarmableInterface) { | |||
$router->warmUp($cacheDir); | |||
|
|||
return; | |||
} else { |
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.
no need for the else
as the previous if
returns anyway
cfd840f
to
060f65a
Compare
Status: Needs Review |
6e94f29
to
18453aa
Compare
UPGRADE-4.1.md
Outdated
@@ -16,3 +16,8 @@ Translation | |||
|
|||
* The `FileDumper::setBackup()` method is deprecated and will be removed in 5.0. | |||
* The `TranslationWriter::disableBackup()` method is deprecated and will be removed in 5.0. | |||
|
|||
FrameworkBundle |
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.
Sorry for nitpicking @Simperfit, but could you please move this up sort entries alphabetically (makes searching for something much easier in the future with many more entries)?
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.
done
18453aa
to
06faa74
Compare
Needs rebase |
} | ||
|
||
@trigger_error(sprintf('Passing a %s without implementing %s is deprecated since 4.1.', RouterInterface::class, WarmableInterface::class), \E_USER_DEPRECATED); |
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.
since Symfony 4.1
06faa74
to
879a720
Compare
PR rebased |
879a720
to
b5d9048
Compare
…rmupInterface in RouterCacheWarmer
b5d9048
to
daa7f02
Compare
PR Rebased |
@nicolas-grekas this one is ready. |
Thank you @Simperfit. |
…terface without warmupInterface in RouterCacheWarmer (Simperfit) This PR was merged into the 4.1-dev branch. Discussion ---------- [FrameworkBundle] add a notice when passing a routerInterface without warmupInterface in RouterCacheWarmer | Q | A | ------------- | --- | Branch? | master | Bug fix? | yesish | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | #23403 | License | MIT | Doc PR | none I'm adding a test to RouterCacheWarmer since there were none. Commits ------- daa7f02 [FrameworkBundle] add a notice when passing a routerInterface with warmupInterface in RouterCacheWarmer
FrameworkBundle | ||
--------------- | ||
|
||
* Using a `RouterInterface` that does not implement the `WarmableInterface` is not supported anymore. |
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 must mention that it is about RouterCacheWarmer. This has nothing to do with the RouterInterface itself.
…ions (xabbuh) This PR was merged into the 4.1-dev branch. Discussion ---------- [FrameworkBundle] clarify changelog and upgrade instructions | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony/symfony#24894 (comment) | License | MIT | Doc PR | Commits ------- a8df0aee92 clarify changelog and upgrade instructions
…ions (xabbuh) This PR was merged into the 4.1-dev branch. Discussion ---------- [FrameworkBundle] clarify changelog and upgrade instructions | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #24894 (comment) | License | MIT | Doc PR | Commits ------- a8df0ae clarify changelog and upgrade instructions
This PR was merged into the 5.0-dev branch. Discussion ---------- [Routing] remove deprecations | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | BC breaks? | yes <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | | License | MIT | Doc PR | Ref. #30249, #30286, #24894 Commits ------- 5beb5f8 [Routing] remove deprecations
I'm adding a test to RouterCacheWarmer since there were none.