close
Skip to content

DB/DirectDatabaseQuery: add XML documentation#2697

Merged
dingo-d merged 3 commits intoWordPress:developfrom
rodrigoprimo:docs-direct-database-query
Mar 5, 2026
Merged

DB/DirectDatabaseQuery: add XML documentation#2697
dingo-d merged 3 commits intoWordPress:developfrom
rodrigoprimo:docs-direct-database-query

Conversation

@rodrigoprimo
Copy link
Collaborator

Description

This PR adds XML documentation for the WordPress.DB.DirectDatabaseQuery sniff.

The documentation is based on the work started by @jaymcp in #2458. I used the original commit and, in a separate commit, made the following changes to the original version of the documentation:

  • Rewrite standard descriptions to explain why each rule exists.
  • Add <em> tags to highlight key parts in code examples.
  • Use realistic code examples.
  • Replace second caching example with a write + cache invalidation pattern.
  • Wrap caching examples in functions, as the sniff always generates a NoCaching warning if the caching code is not inside a function.
  • Remove dbDelta() recommendation from SchemaChange section. I believe the original intent of the rule is to discourage schema changes and not suggest dbDelta() is used.
  • Remove SchemaChange code comparison (no valid alternative).

I suggest squashing the two commits before merging. I'm opening the PR without doing that to make it easier to tell my changes apart from the original changes.

Suggested changelog entry

N/A

Related issues/external references

Related to: #1722
Supersedes: #2458
Closes #2458

jaymcp and others added 2 commits February 9, 2026 10:21
- Rewrite standard descriptions to explain why each rule exists.
- Add <em> tags to highlight key parts in code examples.
- Use realistic code examples.
- Replace second caching example with a write + cache invalidation
  pattern.
- Wrap caching examples in functions, as the sniff always generates
  a NoCaching warning if the caching code is not inside a function.
- Remove dbDelta() recommendation from SchemaChange section. I
  believe the original intent of the rule is to discourage schema
  changes and not suggest dbDelta() is used.
- Remove SchemaChange code comparison (no valid alternative).
Copy link
Member

@jrfnl jrfnl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rodrigoprimo Thanks for working on this! Looking good and IMO the examples are helpful.

I just left a few small questions, nothing major.

Co-authored-by: Juliette <663378+jrfnl@users.noreply.github.com>
@rodrigoprimo rodrigoprimo force-pushed the docs-direct-database-query branch from 8bc5ac4 to 2a8fc57 Compare February 26, 2026 12:13
@rodrigoprimo
Copy link
Collaborator Author

Thanks for the review, @jrfnl! I believe I addressed all your suggestions.

Copy link
Member

@jrfnl jrfnl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates @rodrigoprimo. LGTM.

@jrfnl
Copy link
Member

jrfnl commented Mar 5, 2026

For whomever merges: please squash-merge.

@dingo-d dingo-d merged commit 747be3e into WordPress:develop Mar 5, 2026
31 checks passed
@rodrigoprimo rodrigoprimo deleted the docs-direct-database-query branch March 5, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants