Problem/Motivation

Since #1844956: Optimize date formatting performance this method does nothing, it just returns its argument as is.
And it is not used anywhere in core or in contrib (https://search.tresbien.tech/search?q=prepareFormat).

Steps to reproduce

Proposed resolution

Deprecate the function in 11.5.0 for removal in 12.0.0.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3617943

Command icon 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

prudloff created an issue. See original summary.

bt dev2 made their first commit to this issue’s fork.

bt dev2’s picture

Status: Active » Needs review

I have removed the prepareFormat() method from core/lib/Drupal/Component/Datetime/DateTimePlus.php class file and created an MR.

nitinkumar_7’s picture

The pipeline is currently failing, but the available job output appears to show failures during artifact collection/upload rather than a PHPUnit test failure. Could we confirm whether these are infrastructure/CI artifact issues and rerun the pipeline before reviewing the MR further?

bt dev2’s picture

PHPUnit test passed now, but I still see some warnings for PHP 8.6.

smustgrave’s picture

Status: Needs review » Needs work

Think we should still be on the safe side and properly deprecate it just in case any custom code could be using it. Probably safe to deprecate in 11.5 and remove in 12.

bt dev2’s picture

Status: Needs work » Needs review

I added the method back and added a deprecated warning. Please review it.

For the pipeline, PHPTest is passing, but there is an issue with the PHPUnit Functional JavaScript test. I don't think that is relevent to this task.

dcam’s picture

Issue summary: View changes
Status: Needs review » Needs work
Issue tags: +Needs change record

Thank you for working on this, @bt dev2. Deprecations require a change record (CR) to be written. Here's a similar CR for a function that was deprecated without replacement: https://www.drupal.org/node/3586362. There's a link to add a "change notice" near the top of this issue just above the "Related issues" heading.

After the CR is written, the URL in the deprecation messages must be changed to the CR's URL.

Yes, you're correct that the test failure has nothing to do with this issue. There is a list of known, intermittent test failures at #2829040: [meta] Known intermittent, random, and environment-specific test failures. In the future, you can check a failure against that list. If it's on there, then you probably don't need to worry about it. Not all intermittent failures are on that list, but the worst ones are.

bt dev2’s picture

Status: Needs work » Needs review

Thank you, I created a change record: https://www.drupal.org/node/3619997

Please let me know whether it looks good or not, then I will publish it.

dcam’s picture

Status: Needs review » Needs work

Thank you for writing the change record! The next step is to replace the issue's URLs in the Merge Request with the CR's URL. If a deprecation has a CR, then we always link to that instead of the issue. Though sometimes they slip past reviewers and have to be fixed later, see #3616720: Fix change record links that was committed earlier today. I've left a suggestion on the MR for doing this. Please review it and apply if it's correct (there's a button for applying a suggestion right next to it).

Please let me know whether it looks good or not, then I will publish it.

I appreciate your enthusiasm, but it's the committer's responsibility to publish CRs when the change is committed. Otherwise we would be notifying people about changes that haven't actually happened yet. So there's no need for you to take any action.

bt dev2’s picture

Status: Needs work » Needs review

Updated the Merge Request by applying your changes; Replaced the issue's URL with the CR's URL in the deprecation message.

Thank you. I appreciate your guidance. I probably need to read some contribution documentation.

dcam’s picture

Title: DateTimePlus::prepareFormat() does nothing and is not used » Deprecate DateTimePlus::prepareFormat()

Looks great! Thank you!

dcam’s picture

Status: Needs review » Reviewed & tested by the community