Problem/Motivation
Symfony PHPUnit bridge 5 has added their own \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait that we can use.
#3156998: Using @requires extension_name in PHPUnit unit tests fails if extension is not present has changed our ExpectDeprecationTrait to use the new Symfony trait but now we can deprecate our own trait in favour of Symfony's.
Currently postponed on #3156998: Using @requires extension_name in PHPUnit unit tests fails if extension is not present and fixing https://github.com/symfony/symfony/pull/37515 upstream.
Proposed resolution
Add @deprecation annotations, @trigger_error()'s, replace core usages, and add a deprecation test.
Remaining tasks
User interface changes
None
API changes
@todo
Data model changes
None
Release notes snippet
@todo
Comment | File | Size | Author |
---|---|---|---|
#10 | 3157434-10.patch | 21.15 KB | alexpott |
#10 | 3-10-interdiff.txt | 769 bytes | alexpott |
#3 | 3157434-3.patch | 21.09 KB | alexpott |
Comments
Comment #2
alexpottComment #3
alexpottThe blocker has landed and Symfony 5.1.3 has been released with the upstream fix.
Comment #4
alexpottLess core code for the win!
16 files changed, 27 insertions, 167 deletions.
A lot of legacy removals forgot to remove the use of the trait. This is cleaning that up.
Comment #5
andypost@alexpott as I see in composer.lock funding was removed, is it intensional? Iirc it was added in separate issue
Comment #6
alexpott@andypost it's what is happening when I run composer update - I have no control over that
Comment #7
andypost@alexpott thanks, I just facing it last months... looks like packagers removing this key faster then they been added it
Comment #8
mondrakeNice cleanup!
Nit:
don't we prefer to alias the base trait in the class imports list and then
use
the alias in the class body?Comment #9
alexpott@mondrake I did that because the trait has the same name. Saved an alias.
Comment #10
alexpottI think we've got issues trying to remove usages of FQDNs so let'z fix that.
Comment #11
jungleRerolled the patch based on #10 and fixed test(s) in Drupal\Tests\Core\Site\SettingsTest
Comment #12
dwwI don't think the intention is that we have to manually use this anywhere. It should be loaded for us, right?
Comment #13
catchNeeds a reroll again.
Comment #14
jungle#11 is still valid to me.
Comment #15
alexpott#13 - #11 looks good to me.
#12 - we need to use the trait in classes that use the method at the moment. Given that Symfony has deprecated @expectedDeprecation annotations we'll probably end up adding it to the base classes once we deal with that deprecation.
Comment #16
alexpottFor some reason @jungle was not credited for the reroll. @mondrake also is credited for #8
Comment #17
dwwCareful re-review. TL;DR: RTBC +1! ;)
This is a bummer per #5, but #6 explains there's nothing we can do about this kind of noise. Alas.
I now understand that most of this patch is just cleaning up the unused trait from prior work (now that I read #4 carefully). That's part of why I was confused about SettingsTest.
Now I see. So we'll move this to our test framework base classes in a follow-up. Sounds good.
Thanks for this comment! ;)
At first this was a head-scratcher. Now I see it's because we're also deprecating expectedDeprecations() here, and we want to test that. The previous test was testing the same thing twice. Now the 2 calls are to each of our dynamic deprecation expect methods. 👍
Thanks,
-Derek
Comment #19
catchNot sure where I went wrong in #13...
Committed 574f861 and pushed to 9.1.x. Thanks!
Comment #21
quietone CreditAttribution: quietone at PreviousNext commentedPublish change record