Skip to content

DB/PreparedSQLPlaceholders: add namespaced tests#2714

Draft
rodrigoprimo wants to merge 1 commit into
WordPress:developfrom
rodrigoprimo:db-prepared-sql-placeholders-tests
Draft

DB/PreparedSQLPlaceholders: add namespaced tests#2714
rodrigoprimo wants to merge 1 commit into
WordPress:developfrom
rodrigoprimo:db-prepared-sql-placeholders-tests

Conversation

@rodrigoprimo

@rodrigoprimo rodrigoprimo commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

Description

In preparation for PHPCS 4.0, which changes the tokenization of namespaced names, this PR adds tests with all forms of namespaced calls (partially qualified, fully qualified, and namespace-relative using the namespace keyword) as well as fully qualified global calls to the WordPress.DB.PreparedSQLPlaceholders sniff.

Note: the new tests also document two known issues:

Both issues will be addressed in a future PR.

Suggested changelog entry

N/A

Tests for namespaced calls to the wpdb class currently result in false
positives: the sniff treats namespaced wpdb class calls as calls to the
global wpdb class.

Tests for namespaced calls to a function called sprintf() currently result
in false negatives: the sniff treats these calls as calls to the global
sprintf() function, causing them to not be flagged when they should be.

Both issues are documented in the test case file and GitHub and will be
fixed in the future.
@rodrigoprimo rodrigoprimo force-pushed the db-prepared-sql-placeholders-tests branch from ecbf7c2 to a21e071 Compare April 6, 2026 05:40
@rodrigoprimo rodrigoprimo marked this pull request as draft April 6, 2026 06:00
@rodrigoprimo

Copy link
Copy Markdown
Contributor Author

As discussed with @jrfnl in a chat conversation, I converted this PR to draft, and I will first create another PR fixing #2710 before marking this one as ready for review again.

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.

1 participant