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

Skip to content

[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

Conversation

Simperfit
Copy link
Contributor

@Simperfit Simperfit commented Nov 10, 2017

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.

@Simperfit Simperfit force-pushed the bugfix/decorating-router-might-miss-warmable-interface branch 3 times, most recently from f437cf8 to 66d49f3 Compare November 10, 2017 09:31
@@ -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);
Copy link
Member

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.

Copy link
Member

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 :)

Copy link
Contributor Author

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

Copy link
Contributor Author

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 ?

Copy link
Member

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

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebase and throw added.

@nicolas-grekas nicolas-grekas changed the title [FrameworkBundle] add a notice when passing a routerInterface with wa… [FrameworkBundle] add a notice when passing a routerInterface with warmupInterface in RouterCacheWarmer Nov 10, 2017
@Simperfit Simperfit changed the title [FrameworkBundle] add a notice when passing a routerInterface with warmupInterface in RouterCacheWarmer [FrameworkBundle] add a notice when passing a routerInterface without warmupInterface in RouterCacheWarmer Nov 10, 2017
@chalasr chalasr added this to the 4.1 milestone Nov 11, 2017
@chalasr chalasr added Feature and removed Bug labels Nov 11, 2017
@Simperfit Simperfit force-pushed the bugfix/decorating-router-might-miss-warmable-interface branch from 66d49f3 to 6656dbe Compare November 12, 2017 07:45
@Simperfit Simperfit changed the base branch from 3.3 to master November 12, 2017 07:46
@Simperfit Simperfit force-pushed the bugfix/decorating-router-might-miss-warmable-interface branch 2 times, most recently from 0458373 to 6df98e5 Compare November 12, 2017 07:57

return;
} else {
@trigger_error(sprintf('Passing a %s without implementing %s is deprecated since 4.1.', RouterInterface::class, WarmableInterface::class), \E_USER_DEPRECATED);
Copy link
Member

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.

Copy link
Member

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);
Copy link
Member

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.

@Simperfit Simperfit force-pushed the bugfix/decorating-router-might-miss-warmable-interface branch from 6df98e5 to 4128cf8 Compare November 19, 2017 21:12
@Simperfit
Copy link
Contributor Author

done @stof

@Simperfit Simperfit force-pushed the bugfix/decorating-router-might-miss-warmable-interface branch from 4128cf8 to cfd840f Compare November 19, 2017 21:13
@Simperfit
Copy link
Contributor Author

I will update the Changelog

@Simperfit
Copy link
Contributor Author

Travis failure seems unrelated

@@ -45,6 +45,10 @@ public function warmUp($cacheDir)

if ($router instanceof WarmableInterface) {
$router->warmUp($cacheDir);

return;
} else {
Copy link
Member

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

@Simperfit Simperfit force-pushed the bugfix/decorating-router-might-miss-warmable-interface branch from cfd840f to 060f65a Compare December 3, 2017 17:08
@Simperfit
Copy link
Contributor Author

This has been updated @stof @xabbuh

@Simperfit
Copy link
Contributor Author

Status: Needs Review

@Simperfit Simperfit force-pushed the bugfix/decorating-router-might-miss-warmable-interface branch 4 times, most recently from 6e94f29 to 18453aa Compare December 6, 2017 14:01
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
Copy link
Member

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)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@Simperfit Simperfit force-pushed the bugfix/decorating-router-might-miss-warmable-interface branch from 18453aa to 06faa74 Compare December 7, 2017 09:17
@chalasr
Copy link
Member

chalasr commented Dec 12, 2017

Needs rebase

}

@trigger_error(sprintf('Passing a %s without implementing %s is deprecated since 4.1.', RouterInterface::class, WarmableInterface::class), \E_USER_DEPRECATED);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since Symfony 4.1

@Simperfit Simperfit force-pushed the bugfix/decorating-router-might-miss-warmable-interface branch from 06faa74 to 879a720 Compare January 5, 2018 12:22
@Simperfit
Copy link
Contributor Author

PR rebased

@Simperfit Simperfit force-pushed the bugfix/decorating-router-might-miss-warmable-interface branch from 879a720 to b5d9048 Compare January 24, 2018 16:05
@Simperfit Simperfit force-pushed the bugfix/decorating-router-might-miss-warmable-interface branch from b5d9048 to daa7f02 Compare January 24, 2018 16:07
@Simperfit
Copy link
Contributor Author

PR Rebased

@Simperfit
Copy link
Contributor Author

@nicolas-grekas this one is ready.

@fabpot
Copy link
Member

fabpot commented Jan 26, 2018

Thank you @Simperfit.

@fabpot fabpot merged commit daa7f02 into symfony:master Jan 26, 2018
fabpot added a commit that referenced this pull request Jan 26, 2018
…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.
Copy link
Contributor

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.

symfony-splitter pushed a commit to symfony/framework-bundle that referenced this pull request Feb 25, 2018
…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
Tobion added a commit that referenced this pull request Feb 25, 2018
…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
@fabpot fabpot mentioned this pull request May 7, 2018
@Simperfit Simperfit deleted the bugfix/decorating-router-might-miss-warmable-interface branch June 2, 2019 08:06
nicolas-grekas added a commit that referenced this pull request Jun 5, 2019
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
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.

8 participants