Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecation notices wrapped in Deprecation::withNoReplacement() are logged as NameSpace\{closure} #10705

Closed
1 of 2 tasks
GuySartorelli opened this issue Feb 26, 2023 · 0 comments

Comments

@GuySartorelli
Copy link
Member

GuySartorelli commented Feb 26, 2023

For some deprecated API we have explicitly wrapped the notice in a call to Deprecation::withNoReplacement() - e.g.

return Deprecation::withNoReplacement(function () {
Deprecation::notice('4.13.0', 'Will be replaced by getIterator() in CMS 5');
if (!$this->currentRecord) {
return $this->next();
} else {
return $this->currentRecord;
}
});

This results in the deprecation warning in logs appearing like so:

SilverStripe\ORM\Connect\Query->SilverStripe\ORM\Connect{closure} is deprecated. Will be replaced by getIterator() in CMS 5. Called from SilverStripe\ORM\Connect\Query->column.

Instead of {closure}, it should say the actual method and class which are deprecated.

This is made complicated however by the fact that sometimes we use Deprecation::withNoReplacement() to wrap the call to deprecated API instead of wrapping the notice directly. In those cases the logs already correctly identify the deprecated API.

Acceptance criteria

  • All deprecated API is correctly identified, regardless of whether and how it's wrapped in Deprecation::withNoReplacement()
    OR
  • All deprecated API is correctly identified, and we use different mechanisms to wrap noticed than we do to wrap calls to deprecated API

PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants