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.