zendframework/zend-coding-standard
Zend Framework Coding Standard ruleset for PHP_CodeSniffer to enforce ZF repository style, with composer scripts for checking (phpcs) and auto-fixing (phpcbf). Note: repository abandoned; moved to laminas/laminas-coding-standard.
Start by installing the package as a dev dependency:
composer require --dev zendframework/zend-coding-standard
Add Composer scripts for checking and fixing coding standards (cs-check/cs-fix) in composer.json. Create a phpcs.xml file in your project root that references the included ruleset (./vendor/zendframework/zend-coding-standard/ruleset.xml) and defines the paths to lint (e.g., src, test). Run composer cs-check to see violations, then composer cs-fix to auto-correct many issues.
⚠️ Critical note: This package is archived (discontinued). All development has moved to
laminas/laminas-coding-standard. For any new project or active maintenance, use the Laminas fork instead.
phpcs.xml (e.g., <rule ref="ZendFramework.Sniffs.Arrays.ArrayStructuralSniff"> to disable short arrays if needed, or relax specific strict checks).<file>vendor/</file> with exclusion <exclude-pattern>*/vendor/*</exclude-pattern>) and run checks on specific directories via phpcs src/.For legacy Zend Framework/Laminas projects, this package enforces a strict superset of PSR-12 with Zend/Laminas-specific conventions like mandatory declare(strict_types=1), no long array syntax, consistent self:: usage, and disciplined docblock formatting.
laminas/laminas-coding-standard for continued updates and PHP 8+ compatibility.phpcbf liberally but verify manually, especially in multiline arrays (requires 4-space indent, trailing commas).global keyword: Explicitly forbidden. If legacy code uses it, temporarily <rule ref="ZendFramework.CodeAnalysis.GlobalKeywordSniff" severity="0"/> in phpcs.xml.# comments, disallows empty/@author tags, and restricts comment word usage (@var allowed only for properties). Be prepared for noisy false positives in legacy docblocks.phpcbf won’t fix all issues (e.g., logical problems like global usage or type safety). Always review changes and commit frequently.<rule ref="SniffName"/> with severity="0" or exclude specific codes via <exclude name="ZendFramework.Standard sniff_code"/>.laminas/laminas-coding-standard, update your phpcs.xml path, and run tests — minor rule differences may require调整.How can I help you explore Laravel packages today?