This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
JBZoo Codestyle is a comprehensive PHP code quality and standards library that provides tools and configurations for PHPStan, Psalm, PHP-CS-Fixer, PHPUnit, PHPMD, Phan, and other QA tools. It's designed to be included in other JBZoo projects to enforce consistent coding standards.
The project uses a sophisticated Makefile system with modular components:
src/init.Makefile- Main entry point included by project Makefilessrc/Makefiles/- Modular Makefile components:01_defines.Makefile- Variable definitions and paths03_tests.Makefile- All test and linting commands04_reports.Makefile- Coverage and analysis reports
Custom PHPUnit base classes and traits in src/PHPUnit/:
AbstractPackageTest- Base test class for JBZoo packagesAbstractPhpStormProxyTest- PhpStorm integration testsTraitComposer,TraitCopyright,TraitGithubActions, etc. - Modular test functionality
src/PhpCsFixer/PhpCsFixerCodingStandard.php- Main PHP-CS-Fixer configuration class- Configuration files for all major PHP QA tools (PHPStan, Psalm, PHPMD, etc.)
make update # Install/update dependencies
make autoload # Dump optimized autoloadermake test # Run PHPUnit tests
make test-all # Run all tests and code style checks
make codestyle # Run all linters at oncemake test-phpstan # Static analysis with PHPStan
make test-psalm # Static analysis with Psalm
make test-phpcs # Code sniffer (PSR-12 + compatibility)
make test-phpcsfixer # Check PHP-CS-Fixer rules
make test-phpcsfixer-fix # Auto-fix with PHP-CS-Fixer
make test-phpmd # Mess detector
make test-phan # Phan static analyzermake report-all # Generate all reports
make report-phpmetrics # PHP Metrics report
make report-pdepend # PHP Depend report- PHP 8.2+ required
- Strict types declaration required (
declare(strict_types=1)) - PSR-12 coding standard with additional JBZoo rules
When creating tests that extend the JBZoo package testing framework:
- Extend
AbstractPackageTestfor package-level tests - Use available traits for specific functionality (TraitComposer, TraitReadme, etc.)
- Override protected properties like
$packageName,$vendorNameas needed
The main coding standard is defined in PhpCsFixerCodingStandard.php:
- Combines @Symfony, @PhpCsFixer, @PSR12 presets with custom rules
- Strict import ordering and unused import removal
- Custom PHPDoc formatting rules
- PHPUnit-specific formatting
src/compatibility.php- Backward compatibility functionssrc/phan.php- Phan static analyzer configurationsrc/phpcs.xml- PHP CodeSniffer rulesetsrc/phpmd.xml- PHP Mess Detector rules- Configuration files are in project root:
phpstan.neon,psalm.xml, etc.
This package is designed to be included in other projects via:
ifneq (, $(wildcard ./vendor/jbzoo/codestyle/src/init.Makefile))
include ./vendor/jbzoo/codestyle/src/init.Makefile
endifThe test suite automatically detects CI environments:
- TeamCity: Uses teamcity-specific reporting
- GitHub Actions: Generates GitHub-compatible test reports
- Local: Standard PHPUnit output with coverage