-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Migrate to static
data providers using rector/rector
#48668
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
Migrate to static
data providers using rector/rector
#48668
Conversation
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 is huge 😃
Some abstract test classes are extended in other packages, including packages external to symfony/*
, they are covered by our BC policy. Changing the signature of an abstract
method to make it static
is a breaking change.
We need to update them, but I don't know if that is possible in a backward compatible way.
src/Symfony/Component/Notifier/Test/TransportFactoryTestCase.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Security/Core/Test/AccessDecisionStrategyTestCase.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Translation/Test/ProviderFactoryTestCase.php
Outdated
Show resolved
Hide resolved
Exactly, I don't know either 🤨 |
Maybe we can copy the AbstractTestCases and deprecate the old ones, the new ones then switch to the static dataProviders, but are basically the same. @nicolas-grekas @stof would this work for you? In the Symfony codebase itself we then use the not deprecated class and bump the requirements in composer.json. |
d2a196c
to
0609d48
Compare
I excluded the abstract test cases for now in b48c5d8 |
This PR was squashed before being merged into the 5.4 branch. Discussion ---------- Use static methods inside data providers | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | n/a | License | MIT | Doc PR | n/a refs #48668 follows * #48625 Commits ------- 9a18048 Use static methods inside data providers
Would that help to create a few PRs aiming to refactor data providers using |
Yes, this work needs to be done manually anyway, so we can do it in smaller PRs, thanks |
… providers (alexandre-daubois) This PR was merged into the 5.4 branch. Discussion ---------- [Tests] Remove `$this` occurrences in future static data providers | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes-ish | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Easing #48668 (comment) | License | MIT | Doc PR | _NA_ Commits ------- 6fb7cb9 [Tests] Remove `$this` occurrences in future static data providers
0609d48
to
28aee0b
Compare
@alexandre-daubois I rebased this PR after your was merged 👍 |
… future static data providers (alexandre-daubois) This PR was merged into the 5.4 branch. Discussion ---------- [Tests] New iteration of removing `$this` occurrences in future static data providers | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes-ish | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Easing #48668 (comment) | License | MIT | Doc PR | _NA_ Follow-up of #48980 Commits ------- 1386ac2 [Tests] New iteration of removing `$this` occurrences in future static data providers
… future static data providers (alexandre-daubois) This PR was merged into the 5.4 branch. Discussion ---------- [Tests] New iteration of removing `$this` occurrences in future static data providers | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes-ish | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Easing symfony/symfony#48668 (comment) | License | MIT | Doc PR | _NA_ Follow-up of #48980 Commits ------- 1386ac2e81 [Tests] New iteration of removing `$this` occurrences in future static data providers
… future static data providers (alexandre-daubois) This PR was merged into the 5.4 branch. Discussion ---------- [Tests] New iteration of removing `$this` occurrences in future static data providers | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes-ish | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Easing symfony/symfony#48668 (comment) | License | MIT | Doc PR | _NA_ Follow-up of #48980 Commits ------- 1386ac2e81 [Tests] New iteration of removing `$this` occurrences in future static data providers
… future static data providers (alexandre-daubois) This PR was merged into the 5.4 branch. Discussion ---------- [Tests] New iteration of removing `$this` occurrences in future static data providers | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes-ish | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Easing symfony/symfony#48668 (comment) | License | MIT | Doc PR | _NA_ Follow-up of #48980 Commits ------- 1386ac2e81 [Tests] New iteration of removing `$this` occurrences in future static data providers
@TomasVotruba definitely, will comment your issue on my next iteration! 👍 |
…e-daubois) This PR was merged into the 5.4 branch. Discussion ---------- [Tests] Migrate tests to static data providers | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes-ish | New feature? | no | Deprecations? | no | Tickets | Continuing #48668 (comment) | License | MIT | Doc PR | _NA_ This is yet another PR to continue the manual work needed for the migration of data providers to static ones. I also took the opportunity to pass a few `static::` to `self::` calls, as pointed out by Nicolas in this comment: #49244 (comment) cc `@OskarStark` 👋 Commits ------- 3b8b070 [Tests] Migrate tests to static data providers
…e-daubois) This PR was merged into the 5.4 branch. Discussion ---------- [Tests] Migrate tests to static data providers | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes-ish | New feature? | no | Deprecations? | no | Tickets | Continuing symfony/symfony#48668 (comment) | License | MIT | Doc PR | _NA_ This is yet another PR to continue the manual work needed for the migration of data providers to static ones. I also took the opportunity to pass a few `static::` to `self::` calls, as pointed out by Nicolas in this comment: symfony/symfony#49244 (comment) cc `@OskarStark` 👋 Commits ------- 3b8b07037b [Tests] Migrate tests to static data providers
2242a61
to
acdd54c
Compare
Rebased after #49288 |
There are some remaining failures to fix :) |
I know I need to exclude the abstract test case from notifier, we need to fix this later in a BC way and some others. I am on it and ofc @alexandre-daubois 👍🏻 I think we can finish this one next week |
@TomasVotruba here is another issue we are facing at our codebase |
I hope to send the next (and I hope the last 🤞) one by tomorrow or so! |
@OskarStark I'm on it 👍 |
…e-daubois) This PR was merged into the 5.4 branch. Discussion ---------- [Tests] Migrate tests to static data providers | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes-ish | New feature? | no | Deprecations? | no | Tickets | Continuing #48668 (comment) | License | MIT | Doc PR | _NA_ This PR should take care of remaining errors of #48668. cc `@OskarStark` Commits ------- dea43a6 [Tests] Migrate tests to static data providers
rebase unlocked |
41d5ff4
to
3fa5450
Compare
Rebased and excluded Mailer and Notifier tests which use an abstract test case from |
@nicolas-grekas I would propose to keep and upmerge the rector config, as we need to exclude the same paths in the upper branches too 🤷♂️ we can remove |
770206a
to
2ec54e9
Compare
Thank you @OskarStark. |
For |
Would love to help on this! Would this kind of PR also target 5.4? |
Yes please |
I will run the rector again against 5.4, let's see what's left todo then @alexandre-daubois 👍 |
…tic (OskarStark, alexandre-daubois) This PR was merged into the 5.4 branch. Discussion ---------- [BC Break] Make data providers for abstract test cases static | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | Refs #48668 | License | MIT | Doc PR | - Follows #48668 (comment) ### Todos * [x] Bump min version in `composer.json` Notifier `@OskarStark` * [x] Bump min version in `composer.json` Translation `@OskarStark` * [x] Bump min version in `composer.json` Mailer `@OskarStark` * [x] Bump min version in `composer.json` Security `@OskarStark` - _nothing todo_ * [x] document BC break in CHANGELOG files Notifier `@OskarStark` * [x] document BC break in CHANGELOG files Translation `@OskarStark` * [x] document BC break in CHANGELOG files Mailer `@OskarStark` * [x] document BC break in CHANGELOG files Security `@OskarStark` * [x] document BC break in UPGRADE files Notifier `@OskarStark` * [x] document BC break in UPGRADE files Translation `@OskarStark` * [x] document BC break in UPGRADE files Mailer `@OskarStark` * [x] document BC break in UPGRADE files Security `@OskarStark` * [x] remove $this in static methods `@alexandre`-daubois * [x] make tests green Commits ------- c444a43 [Translation][Mailer] Convert `$this` calls to static ones in data providers 77c8444 [BC Break] Make data providers for abstract test cases static
@nicolas-grekas it can be executed by running:
Review commit by commit.
We need to check now where we use object context in static providers and fix them manually, an maybe merge them manually, unmerge them and apply rector one by one to every branch.