Static analysis · 5 tools
Top 5 code analysis tools for WordPress plugin and theme developers
For WordPress plugin and theme developers who want to check coding standards and find bugs, start with PHP_CodeSniffer for standards enforcement, then add PHPStan or Psalm for deeper type and bug analysis. This shortlist covers five tools, ending with Phan and the SonarLint editor extension. It is written for developers who maintain PHP code and want checks that run locally and in CI.
| # | Tool | Best for | Key feature | Platforms / deployment | Pricing | More |
|---|---|---|---|---|---|---|
| 1 | PHP_CodeSnifferPHPCSStandards | Enforcing a coding standard across a plugin or theme | phpcs detects violations, phpcbf corrects them | PHP 7.2.0 or greater; Phar, Composer, Phive or Git clone | See vendor pricing page | Introduction |
| 2 | PHPStanPHPStan | Finding bugs in existing plugin code step by step | Rule levels 0–10 to raise strictness gradually | Runs locally, in CI and in a Docker container | See vendor pricing page | Official site |
| 3 | PsalmVimeo | Type checking plus security-focused data-flow analysis | Taint analysis runs by default alongside type checking | Not stated on official pages | See vendor pricing page | Official site |
| 4 | PhanPhan | Low-noise type and definition checks | Checks that methods, functions, classes, constants and properties are defined and accessible | Composer install; Phan 6 needs PHP 8.1+ with php-ast | See vendor pricing page | Official site |
| 5 | SonarLintSonar | Feedback in the editor while coding | Detects bugs, code smells, vulnerabilities and security hotspots | Visual Studio, VS Code, Eclipse, JetBrains IDEs, GitHub Codespaces and GitPod | See vendor pricing page | Introduction |
1 PHP_CodeSniffer
By PHPCSStandards
PHP_CodeSniffer is a set of two PHP scripts, phpcs and phpcbf, that tokenize PHP files to detect violations of a defined coding standard and automatically correct them. It is the official continuation of the abandoned Squizlabs PHP_CodeSniffer package.
Why it is here: It is first because coding-standards enforcement is the first half of this use case, and it detects violations and fixes them automatically.
- Best for
- Enforcing a coding standard across a plugin or theme
- Key features
- phpcs detects violations, phpcbf corrects them
- Checks a single file or a whole directory
- Standard selected with --standard; default is PSR12
- Project settings in a configuration file for teams and CI servers
- Installable via Phar, Composer, Phive or a Git clone
- Limits
- The official page documents PSR12 as the default and PEAR as an example of another standard, and does not mention WordPress-specific standards. WordPress teams should check the vendor documentation for how to select the standard they need.
- Platforms / deployment
- PHP 7.2.0 or greater; Phar, Composer, Phive or Git clone
- Pricing
- See vendor pricing page (not quoted here; facts checked 21 November 2026, Asia/Dhaka)
Official website (github.com/PHPCSStandards/PHP_CodeSniffer) · Read our introduction to PHP_CodeSniffer
2 PHPStan
By PHPStan
PHPStan is a free, open-source static analysis tool that finds bugs in PHP code without requiring tests. It scans the whole codebase for both obvious and tricky bugs.
Why it is here: It follows the standards checker because it adds bug-finding across the whole codebase, with levels that let you raise strictness gradually.
- Best for
- Finding bugs in existing plugin code step by step
- Key features
- Rule levels 0–10 to raise strictness gradually
- Baseline for adopting it on legacy code
- Understands magic methods and properties
- Generics, array shapes and checked exceptions via PHPDocs
- JSON, JUnit and other CI-friendly output
- Limits
- The official page lists extensions for Symfony, Laravel and Doctrine and does not mention WordPress. Teams that need WordPress-specific awareness should check the vendor documentation.
- Platforms / deployment
- Runs locally, in CI and in a Docker container
- Pricing
- See vendor pricing page (not quoted here; facts checked 21 November 2026, Asia/Dhaka)
3 Psalm
By Vimeo
Psalm is a free and open-source static analysis tool for PHP that finds code problems and performs taint-based security analysis. It is used on codebases of many sizes and ages.
Why it is here: It sits here because its taint analysis follows user input to find SQL injection, XSS and other vulnerabilities, which matters for plugins that handle request data.
- Best for
- Type checking plus security-focused data-flow analysis
- Key features
- Taint analysis runs by default alongside type checking
- Tracks data from taint sources to taint sinks
- Default sources include PHP superglobals for request input
- Custom taint types and sources
- Can fix some bugs automatically
- Limits
- The official page does not describe WordPress-specific sources or sinks. Teams that need them should check the vendor documentation on custom taint types and sources.
- Platforms / deployment
- Not stated on official pages
- Pricing
- See vendor pricing page (not quoted here; facts checked 21 November 2026, Asia/Dhaka)
4 Phan
By Phan
Phan is a static analyzer for PHP that aims to minimize false positives and attempts to prove incorrectness rather than correctness.
Why it is here: It comes after the other analyzers because its documented focus is type compatibility and definition checks, with an emphasis on avoiding false positives.
- Best for
- Low-noise type and definition checks
- Key features
- Checks that methods, functions, classes, constants and properties are defined and accessible
- Type safety and arity checks on calls
- Optional detection of unused, dead or unreachable code
- Auto-fixes some issue types, such as unused use statements
- Output in text, checkstyle, json, github and other formats
- Limits
- Phan 6 requires PHP 8.1+ with the php-ast extension, though a polyfill parser option exists with slight differences in doc comment parsing. Teams that support older PHP versions should check the vendor documentation.
- Platforms / deployment
- Composer install; Phan 6 needs PHP 8.1+ with php-ast
- Pricing
- See vendor pricing page (not quoted here; facts checked 22 November 2026, Asia/Dhaka)
5 SonarLint
By Sonar
SonarLint, now called SonarQube for IDE, is an editor extension that gives real-time feedback on bugs and security vulnerabilities with guidance and quick fixes as you code.
Why it is here: It closes the list because it works inside the editor while you write code, complementing the command-line tools above.
- Best for
- Feedback in the editor while coding
- Key features
- Detects bugs, code smells, vulnerabilities and security hotspots
- Explanations, risks, rule details and code examples in the editor
- Quick fixes and AI-generated fixes
- Focus-on-new-code setting for issues from the current cycle
- Connected Mode syncs rules and quality gates from SonarQube Server or Cloud
- Limits
- The official page says it analyzes over 20 languages but does not name PHP or WordPress on that page. Check the vendor documentation for PHP rule coverage.
- Platforms / deployment
- Visual Studio, VS Code, Eclipse, JetBrains IDEs, GitHub Codespaces and GitPod
- Pricing
- See vendor pricing page (not quoted here; facts checked 21 November 2026, Asia/Dhaka)
Official website (sonarsource.com/products/sonarlint) · Read our introduction to SonarLint
How we chose these tools
We looked at three things: fit with the use case of checking coding standards and finding bugs in PHP projects, the capabilities each vendor documents, and the deployment and platform details on its official pages. None of the official pages we used describe WordPress-specific features, so each entry stays within what the vendor documents and flags where WordPress teams should read further.
All facts come from official vendor pages, with check dates. The order reflects editorial fit for this use case: tools that enforce a coding standard come first, then tools that analyze types and data flow, then an editor-based option. This list is built from documentation rather than product trials, so treat it as a starting point for your own evaluation.
Order used in this guide: Ordered by relevance to WordPress workflows, starting with coding-standards enforcement and then deeper type analysis.
Frequently asked questions
Which tool checks coding standards in a PHP plugin?
PHP_CodeSniffer is built for this. Its phpcs script detects violations of a defined coding standard and phpcbf corrects them automatically. Check the vendor documentation for how to select a standard other than the PSR12 default.
What finds bugs in PHP code without writing tests?
PHPStan finds bugs without tests and scans the whole codebase. Psalm and Phan are also static analyzers for PHP.
Can these tools find security issues such as SQL injection or XSS?
Psalm documents taint analysis that follows user input to find SQL injection, XSS and other vulnerabilities. SonarLint also detects vulnerabilities and security hotspots in the editor.
Can I adopt a static analyzer on an older plugin with many existing issues?
PHPStan documents a baseline for adopting it on legacy code, plus rule levels from 0 to 10 for raising strictness gradually.
Do these tools run in CI?
PHP_CodeSniffer documents configuration for teams and CI servers. PHPStan runs locally and in CI and can output JSON or JUnit, and Phan supports formats such as checkstyle and github.
- PHP_CodeSniffer: github.com/PHPCSStandards/PHP_CodeSniffer, github.com/about, github.com/features — checked 21 November 2026
- PHPStan: phpstan.org, phpstan.org/documentation — checked 21 November 2026
- Psalm: psalm.dev, psalm.dev/docs/security_analysis — checked 21 November 2026
- Phan: github.com/phan/phan, github.com/about — checked 22 November 2026
- SonarLint: sonarsource.com/products/sonarqube/ide, sonarsource.com/solutions/ai — checked 21 November 2026
Linthelm is independent and not affiliated with the vendors listed. No vendor paid for inclusion or position. Product names belong to their owners. Features and prices change; confirm details on each official website.