Problem/Motivation
drupal-check results on commit hash:
source : [git] https://git.drupal.org/project/poll 01a3a57088f707de842de4f74bdb65c7441d837a
source : http://cgit.drupalcode.org/poll
------ --------------------------------------------------
Line poll.module
------ --------------------------------------------------
33 Call to deprecated method url() of class Drupal.
33 Call to deprecated method url() of class Drupal.
35 Call to deprecated method url() of class Drupal.
35 Call to deprecated method url() of class Drupal.
------ --------------------------------------------------
------ ---------------------------------------------------
Line src/Form/PollDeleteForm.php
------ ---------------------------------------------------
48 Call to deprecated function drupal_set_message().
------ ---------------------------------------------------
------ ---------------------------------------------------
Line src/Form/PollForm.php
------ ---------------------------------------------------
57 Call to deprecated function drupal_set_message().
60 Call to deprecated method link() of class
Drupal\Core\Entity\EntityInterface.
61 Call to deprecated function drupal_set_message().
------ ---------------------------------------------------
------ ---------------------------------------------------
Line src/Form/PollViewForm.php
------ ---------------------------------------------------
71 Call to deprecated function drupal_set_message().
96 Call to deprecated method url() of class
Drupal\Core\Entity\EntityInterface.
297 Call to deprecated function drupal_set_message().
345 Call to deprecated function drupal_set_message().
------ ---------------------------------------------------
------ ---------------------------------------------------
Line src/Form/PollVoteDeleteForm.php
------ ---------------------------------------------------
51 Call to deprecated function drupal_set_message().
------ ---------------------------------------------------
------ -------------------------------------------
Line src/PollListBuilder.php
------ -------------------------------------------
60 Call to deprecated method link() of class
Drupal\Core\Entity\EntityInterface.
------ -------------------------------------------
------ ----------------------------------------------
Line src/Tests/PollTestBase.php
------ ----------------------------------------------
203 Call to deprecated function format_string().
235 Call to deprecated function format_string().
------ ----------------------------------------------
------ ----------------------------------------------
Line src/Tests/PollTokenReplaceTest.php
------ ----------------------------------------------
73 Call to deprecated function format_string().
81 Call to deprecated function format_string().
------ ----------------------------------------------
------ --------------------------------------------------
Line src/Tests/PollVoteCheckHostnameTest.php
------ --------------------------------------------------
46 Call to deprecated function format_string().
46 Call to deprecated method getUsername() of class
Drupal\Core\Session\AccountInterface.
52 Call to deprecated function format_string().
52 Call to deprecated method getUsername() of class
Drupal\Core\Session\AccountInterface.
85 Call to deprecated function format_string().
85 Call to deprecated method getUsername() of class
Drupal\user\Entity\User.
106 Call to deprecated function format_string().
106 Call to deprecated method getUsername() of class
Drupal\user\Entity\User.
127 Call to deprecated function format_string().
127 Call to deprecated method getUsername() of class
Drupal\Core\Session\AccountInterface.
------ --------------------------------------------------
------ ---------------------------------------------------------------
Line tests/src/FunctionalJavascript/PollVoteJavascriptTest.php
------ ---------------------------------------------------------------
15 Class
Drupal\Tests\poll\FunctionalJavascript\PollVoteJavascriptTest
extends deprecated class
Drupal\FunctionalJavascriptTests\JavascriptTestBase.
63 Call to method setUp() of deprecated class
Drupal\Tests\BrowserTestBase.
------ ---------------------------------------------------------------
[ERROR] Found 30 errors
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | drupal_9_deprecated_code-3042954-15.patch | 13.95 KB | berdir |
| #4 | drupal_9_deprecated_code-3042954-4.patch | 70.69 KB | sergiu stici |
Issue fork poll-3042954
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
sergiu stici commentedHere is the patch, please review.
Comment #4
sergiu stici commentedCorrected codesniffer.
Comment #6
naheemsays commentedIn places like PollViewForm the following is not correct:
In #3042995: Convert votes into entities I have used the following instead:
Comment #7
berdirThis seems to mix deprecations with coding standards like array syntax, which makes this much bigger and likely to conflict on several other issues. I'd much rather focus on actual deprecations here, things like array syntax can also be scripted.
And yes, not all places have a messenger() method, you either need to use \Drupal::messenger() or maybe better, add the messenger trait.
Comment #8
naheemsays commentedAdding tag that may get someone to look at this at DrupalconEur: https://twitter.com/gaborhojtsy/status/1185151902998249477
Comment #9
berdirAgreed, this would be a good issue for someone at the sprints. I would suggest to start from scratch as the coding standard fixes were moved to #3089551: Code sniffer code style fixes.
Also, drupal_set_message() has a dedicated issue, so don't touch that here and instead help to finish that: #3040194: Remove deprecated function drupal_set_message
Comment #10
berdirAlso, the results from running the test with deprecations on, 8.7 and older deprecations only:
drupal-check doesn't catch some of these.
Note that this is after #3090356: Convert tests to phpunit and there is also an issue for format_string() but most of the calls do that are actually removed in the phpunit converison: #3035040: Replace deprecated method format_string() calls with FormattableMarkup().
Comment #11
-enzo- commentedHello Folks
I want to try to help you to prepare poll module for Drupal 9, but I am getting some issues.
I downloaded the poll module using the branch 8.8.x, but when I tried to apply the patch drupal_9_deprecated_code-3042954-4.patch to start my contribution from there but the patch doesn't work
Could you tell me what I am doing wrong, thanks in advance
Comment #12
naheemsays commentedThere is no 8.8 branch of the poll module. Did you download drupal core 8.8 branch?
Version control patching details are here: https://www.drupal.org/project/poll/git-instructions.
You probably want to ignore the current patch and start from scratch.
Comment #13
-enzo- commentedHi @nbz
My question was, what branch I need to use to apply the patch if you check my previous comment the patch in my test, said no changes to be applied using the patch posted at #4.
Thanks for your help
Comment #14
naheemsays commentedIt was for the 8.x-1.x branch. It most likely will not apply cleanly as especially most of the tests have been converted to unit tests and reside at new locations.
Comment #15
berdirThis fixes a bunch of remaining deprecation mesages, pretty much the only thing left now on 8.8 is the TrustedCallbackInterface, I don't really want to add code to support that, other than that, this should be basically ready for D9.
Updated/removed a bunch of pointless asserts to fix assertTrue() must receive boolean deprecation messages.
Also added the core compatibility key to make it easier to test with D9, will need to be updated to 8.8 once we depend on that. But we need 8.7 now for the EntityViewBuilder constructor/properties.
Comment #16
naheemsays commented-core: 8.xI think you need to keep this in for now as it will break drupal core releases older than 8.7.7.
Comment #17
berdirI'm OK with that :) I did explicitly require 8.7.7+ with the new key.
8.7.7 was released 2.5 months ago and nobody is forced to update this module. And support for 8.6 will end in a few weeks as well.
Comment #18
berdirAlso, I've just released https://www.drupal.org/project/poll/releases/8.x-1.3 (not published yet by the time I write this), took me 1y6m since the last release, by the time I create another one, it'll probably be safe to rely on 8.8 :)
Comment #19
berdirCommitted.