Automattic / Automattic/VIP-Coding-Standards
Sniff for using PDO to connect to DB
- Dominant language
- PHP
- Stars
- 261
- Forks
- 44
- Avg merge
- 19m
- Merged PRs (30d)
- 1
Description
## What problem would the enhancement address for VIP?
The PDO_MYSQL module is not enabled on VIP. Plugins reliant on PDO like MailPoet are therefore currently not compatible with VIP.
## Describe the solution you'd like
An error should be thrown on an attempt to create a PDO connection.
## What code should be reported as a violation?
`$db = new PDO();`
## What code should *not* be reported as a violation?
Any attempt to use PDO should be reported.
Contributor guide
Research direction
No files or tests are named in the issue. Start by locating the repository’s existing PHP_CodeSniffer sniffs and their tests, then identify the entry point for detecting database API usage; done means attempts to use PDO are reported while the test suite covers the stated violation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100