yoast/yoastcs
Yoast Coding Standards (YoastCS) provides Composer-installable rulesets and tooling for PHP code style and quality in Yoast projects, including PHP_CodeSniffer standards/sniffs and PHP Parallel Lint. Integrates via Composer for consistent CI enforcement.
get_option() → get_site_option()) via PHPCompatibilityWP sniffs.null !== $var instead of isset($var)").Adopt YoastCS if:
Look Elsewhere if:
"YoastCS is a turnkey solution to elevate our Laravel-WordPress code quality—like a ‘WordPress VIP’ linting engine for our team. It automates compliance with WordPress’s official standards (and Yoast’s internal best practices), reducing bugs and onboarding time. By integrating this into CI, we’ll catch critical issues early, just like top-tier WordPress plugins do. Think of it as ‘GitHub Actions for code hygiene’—no more manual reviews for basic standards."
Key Outcomes:
*"YoastCS gives us PHP_CodeSniffer on steroids for WordPress/Laravel:
YOASTCS_THRESHOLD_ERRORS) let us enforce ‘zero errors’ in PRs or allow controlled warnings.php-parallel-lint to catch syntax errors in seconds.Example Workflow:
composer.json:
"require-dev": {
"yoast/yoastcs": "^3.0"
}
composer check-cs-warnings # Fails on errors
composer check-cs-thresholds # Enforces error/warning limits
=== for strict comparison’) or PHP Parallel Lint (e.g., missing semicolons).Why Not Custom Rules?
WordPress.WP.GetMetaSingle).For Developers: *"This is like ESLint for PHP—but for WordPress. It’ll:
get_post_meta() calls.array_merge when ... (splat) would be cleaner.get_the_author() in favor of get_author_string().[1,2,3] vs [ 1, 2, 3 ])."*How can I help you explore Laravel packages today?