Add correctly named getCustomerRegisterUrl() and deprecate the typo (#36735) - #41168
Add correctly named getCustomerRegisterUrl() and deprecate the typo (#36735)#41168lbajsarowicz wants to merge 7 commits into
Conversation
hostep pointed out that the new replacement method should be public since the deprecated method it replaces was public, otherwise external callers of the deprecated method have no BC-safe alternative to move to. Flip visibility; adding a public method is additive and does not break BC.
|
@magento run all tests |
|
Hi @lbajsarowicz. Thank you for your contribution!
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
|
@magento run Static Tests |
|
LGTM, @lbajsarowicz: static tests failure is probably on that copyright header: |
Description
Magento\Customer\Block\Account\AuthenticationPopup::getCustomerRegisterUrlUrl()has a doubled "Url" in its name. It is still there on2.4-develop(AuthenticationPopup.php:126).The method is public on an
@apiblock, so it cannot simply be renamed. This adds a correctly namedgetCustomerRegisterUrl(), has the old method delegate to it, and marks the old one@deprecatedwith a@seepointing at the replacement.This PR continues #36794 by @Vasudev-22 (Partner: EY), rebased onto current
2.4-develop. Their commits and authorship are preserved.The one review point that was never resolved
@Den4ik and @hostep both reviewed the original PR and every point was addressed except this one, from @hostep:
I agree, and this PR makes the replacement public. Deprecating a public method while offering only a private replacement leaves external callers with nowhere to migrate, which defeats the purpose of the deprecation. Adding a public method is additive; it is renaming or removing one that breaks backward compatibility.
Fixed Issues
Fixes #36735
Manual testing scenarios
customer/account/create.getCustomerRegisterUrl()and the deprecatedgetCustomerRegisterUrlUrl()on the block and confirm they return the same URL.Questions or comments
Note for the Semantic Version Checker build: this adds a public method to a class annotated
@api @since 100.0.2. That is an additive (minor) change rather than a breaking one, but it will show up in the SVC report, so flagging it explicitly rather than letting it surprise a reviewer. No existing signature is changed and the deprecated method is retained.Gates run locally on
2.4-develop(Warden, PHP 8.3):Customer/Test/Unit/Block/Account/— 33 tests pass, including a new case asserting the deprecated method and its replacement return the same URL.Magento2: clean. PHPStan level 1: no errors.git grepacross the repository finds no remaining caller of the old name outside its own declaration; the block'sgetConfig()was already updated to the new name in @Vasudev-22's original commits.Contribution checklist