Post on 06-Jun-2020
transcript
Let’s get ready
alexpott
Drupal 9 is coming
ABOUT ME➤ Contributing to Drupal for >9 years ➤ Drupal 8 core-committer ➤ Testing subsystem maintainer
➤ Consulting at Acro Media and Thunder ➤ alexpott on the internet
➤ When Drupal 9 will be released ➤ Technical debt ➤ Using Drupal’s deprecation policy
➤ Detecting deprecations ➤ How to deprecate code ➤ Other recommendations for getting ready for Drupal 9
WHAT THE TALK IS ABOUT
DRUPAL 8 WILL BE END-OF-LIFE BY NOVEMBER 2021
TECHNICAL DEBT
➤ When software changes you accumulate technical debt ➤ Drupal 8 made a lot of changes very fast. ➤ Therefore introduced a lot of technical debt
“Shipping first time code is like going into debt. A little debt speeds development so long as it is paid back promptly with a rewrite…
Ward Cunningham, 1992
“The danger occurs when the debt is not repaid. Every minute spent on not-quite-right code counts as interest on that debt. Entire engineering organizations can be brought to a stand-still
Ward Cunningham, 1992
DRUPAL’S DEPRECATION POLICY
➤ Deprecated code must trigger a silenced E_USER_DEPRECATION error.
➤ Deprecated functions and methods must have an @deprecated PHPdoc tag
➤ Deprecations must have a change record
➤ Deprecated code should not be used during regular runtime
➤ All code deprecated will be removed in Drupal 9
DETECTING DEPRECATIONS
➤ IDE support. For example, PHPStorm will cross out any usage of deprecated code.
➤ Static analysis tools like @mglaman’s drupal-check
➤ Future support in the Devel module via the Symfony debug toolbar
➤ Using Symfony’s PHPUnit Bridge during automated testing
DETECTING DEPRECATIONS
LIVE CODING
➤ Add @deprecation PHPdoc tag - the format of this is about to change - https://www.drupal.org/project/coding_standards/issues/3024461
➤ Add @trigger_error ➤ Use @group legacy
➤ Use @expectedDeprecation ➤ Straight replacement is not always the way to go
LIVE CODING SUMMARY
ADVANCED CASES
➤ Dynamic deprecation messages can use the ExpectedDeprecationTrait to make testing easier
➤ Method parameters, return values, Drupal hooks, code paths and plugins all have special forms of deprecation
➤ For more see https://www.drupal.org/core/deprecation
CONTRIBUTED/CUSTOM MODULES AND YOUR CODEBASE➤ Use @mglaman’s drupal-check
➤ Using @trigger_error testing is tricky at the moment
➤ Run tests locally or your own CI
➤ Target the minimum version of Drupal core you want to support.
➤ Deprecation testing can be disabled
➤ Run-tests.sh: —suppress-deprecations
➤ Env var: SYMFONY_DEPRECATIONS_HELPER
➤ See https://www.drupal.org/node/3002148
➤ See https://github.com/mglaman/drupal-check/wiki/Drupal-9-Readiness
OTHER RECOMMENDATIONS
➤ Test against multiple PHP versions ➤ (Once it is possible) Test against multiple dependency
versions ➤ Create Drupal 8 migration sources and destinations
➤ Try not to mix refactoring with functional change ➤ Be very very careful with sub-classes and overriding
constructors
Inspired by @larowlan and @drunken_monkey
➤ Drupal 9 will be released in 2020 ➤ Use Drupal’s deprecation policy to deprecate code ➤ Test for deprecate code usage
➤ Jump in and help core and contrib to get ready ➤ https://www.drupal.org/project/drupal/issues/2959269 ➤ https://www.drupal.org/project/issues/search?
issue_tags_op=all+of&issue_tags=Drupal+9+compatibility
➤ #d9readiness in slack
IN SUMMARY
THANKS
➤ Symfony for the idea of using @trigger_error() and PHPUnit Bridge component
➤ DrupalCI maintainers @mixlogic and @mile23 ➤ @mglaman for drupal-check
➤ @Gábor Hojtsy for all Drupal 9 readiness coordination work
➤ The many contributors ➤ Dries Buytaert for the Drupal release date images
Sorry for all the 8.6.x releases
Thank you
Join us forcontribution opportunities
Friday, April 12, 2019
Mentored Contributions
9:00-18:00Room: 602
First Time Contributor Workshop
GeneralContributions
9:00-12:00Room: 606
9:00-18:00Room: 6A
#DrupalContributions
What did you think?
Locate this session at the DrupalCon Seattle website:https://events.drupal.org/seattle2019/sessions/drupal-9-coming-getting-your-code-ready
Take the Survey!https://www.surveymonkey.com/r/DrupalConSeattle