<< All versions
Skill v1.0.1
currentAutomated scan100/100dykyi-roman/awesome-claude-code/ci-tools-knowledge
5 files
──Details
PublishedAugust 26, 2026 at 06:01 AM
Content Hashsha256:0523fb1c406391ce...
Git SHA7e1fea8899b7
Bump Typepatch
──Files
Files (1 file, 10.1 KB)
SKILL.md10.1 KBactive
SKILL.md · 458 lines · 10.1 KB
version: "1.0.1" name: ci-tools-knowledge description: PHP CI tools knowledge base. Provides PHPStan levels and configuration, Psalm integration, PHP-CS-Fixer rules, DEPTRAC layer analysis, Rector automated refactoring, and code coverage tools.
PHP CI Tools Knowledge Base
Quick reference for PHP static analysis, code quality, and testing tools.
PHPStan
Levels Overview
| Level | Description | Use Case | |
|---|---|---|---|
| 0 | Basic checks (undefined variables, classes) | Legacy projects, quick start | |
| 1 | + Undefined methods, properties | Minimal safety | |
| 2 | + Unknown methods on $this | Medium safety | |
| 3 | + Return types | Recommended minimum | |
| 4 | + Dead code, unreachable | Recommended for new projects | |
| 5 | + Argument types | Standard compliance | |
| 6 | + Missing typehints | Strict typing | |
| 7 | + Union types strict | High strictness | |
| 8 | + No mixed, nullsafe | Production recommended | |
| 9 | + Maximum strictness | Clean Architecture | |
| max | Bleeding edge | Experimental only |
Configuration Template
neon
# phpstan.neon — targets PHPStan 2.x (level 0-10, 10 = max)includes:- vendor/phpstan/phpstan-strict-rules/rules.neon- vendor/phpstan/phpstan-deprecation-rules/rules.neon- vendor/phpstan/phpstan-phpunit/extension.neon- phpstan-baseline.neonparameters:level: 8paths:- src- testsexcludePaths:- src/Infrastructure/Legacy/*- tests/Fixtures/*# PHP versionphpVersion: 80400# Strict rules (iterable/generics checks come from `level` in 2.x, not from parameters)checkUninitializedProperties: truetreatPhpDocTypesAsCertain: truereportUnmatchedIgnoredErrors: true# Custom rulesignoreErrors:- '#Call to an undefined method [a-zA-Z0-9\\_]+::getId\(\)#'# Type aliasestypeAliases:UserId: 'string'# Parallel processingparallel:maximumNumberOfProcesses: 4
Common Extensions
| Extension | Purpose | |
|---|---|---|
phpstan-strict-rules | Additional strict checks | |
phpstan-deprecation-rules | Deprecated usage detection | |
phpstan-phpunit | PHPUnit support | |
phpstan-doctrine | Doctrine ORM support | |
phpstan-symfony | Symfony container support |
Baseline Management
bash
# Generate baseline (for existing projects)vendor/bin/phpstan analyse --generate-baseline# Analyze with baselinevendor/bin/phpstan analyse# CI commandvendor/bin/phpstan analyse --no-progress --error-format=checkstyle > phpstan-report.xml
Psalm
Error Levels
| Level | Description | |
|---|---|---|
| 1 | Maximum strictness (recommended for new) | |
| 2 | Very strict | |
| 3 | Strict (recommended for existing) | |
| 4 | Relaxed | |
| 5-8 | Increasingly permissive |
Configuration Template
xml
<!-- psalm.xml --><?xml version="1.0"?><psalmerrorLevel="2"resolveFromConfigFile="true"findUnusedBaselineEntry="true"findUnusedCode="true"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns="https://getpsalm.org/schema/config"xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"><projectFiles><directory name="src"/><ignoreFiles><directory name="vendor"/><directory name="src/Infrastructure/Legacy"/></ignoreFiles></projectFiles><issueHandlers><MixedAssignment errorLevel="suppress"/><PropertyNotSetInConstructor><errorLevel type="suppress"><directory name="src/Infrastructure/Doctrine"/></errorLevel></PropertyNotSetInConstructor></issueHandlers><plugins><pluginClass class="Psalm\PhpUnitPlugin\Plugin"/><pluginClass class="Psalm\SymfonyPsalmPlugin\Plugin"/></plugins></psalm>
Useful Commands
bash
# Full analysisvendor/bin/psalm# Generate baselinevendor/bin/psalm --set-baseline=psalm-baseline.xml# Security analysisvendor/bin/psalm --taint-analysis# CI outputvendor/bin/psalm --output-format=checkstyle > psalm-report.xml
PHP-CS-Fixer
Configuration Template
php
<?php// .php-cs-fixer.dist.phpdeclare(strict_types=1);use PhpCsFixer\Config;use PhpCsFixer\Finder;$finder = Finder::create()->in([__DIR__ . '/src',__DIR__ . '/tests',])->exclude(['var','vendor',]);return (new Config())->setRiskyAllowed(true)->setRules(['@PER-CS2.0' => true,'@PER-CS2.0:risky' => true,'@PHP84Migration' => true,'@PHP80Migration:risky' => true,'@PHPUnit100Migration:risky' => true,// Strict rules'declare_strict_types' => true,'strict_param' => true,'strict_comparison' => true,// Modern PHP'array_syntax' => ['syntax' => 'short'],'modernize_strpos' => true,'no_alias_functions' => true,'void_return' => true,// Clean code'no_unused_imports' => true,'ordered_imports' => ['imports_order' => ['class', 'function', 'const']],'single_line_throw' => false,'trailing_comma_in_multiline' => true,// DocBlocks'no_superfluous_phpdoc_tags' => true,'phpdoc_align' => false,'phpdoc_separation' => true,])->setFinder($finder)->setCacheFile('.php-cs-fixer.cache');
Commands
bash
# Check (dry run)vendor/bin/php-cs-fixer fix --dry-run --diff# Fixvendor/bin/php-cs-fixer fix# CI checkvendor/bin/php-cs-fixer fix --dry-run --format=checkstyle > cs-report.xml
DEPTRAC
Configuration Template
yaml
# deptrac.yamldeptrac:paths:- ./srclayers:- name: Domaincollectors:- type: directoryvalue: src/Domain/.*- name: Applicationcollectors:- type: directoryvalue: src/Application/.*- name: Infrastructurecollectors:- type: directoryvalue: src/Infrastructure/.*- name: Presentationcollectors:- type: directoryvalue: src/(Api|Web|Console)/.*ruleset:Domain: [] # Domain depends on nothingApplication:- DomainInfrastructure:- Domain- ApplicationPresentation:- Application- Domainskip_violations:# Temporary violations during migrationApp\Infrastructure\Legacy\*:- App\Domain\*
Commands
bash
# Analyzevendor/bin/deptrac analyse# With baselinevendor/bin/deptrac analyse --baseline=deptrac-baseline.yaml# CI outputvendor/bin/deptrac analyse --formatter=junit --output=deptrac-report.xml
Rector
Configuration Template
php
<?php// rector.phpdeclare(strict_types=1);use Rector\Config\RectorConfig;use Rector\Set\ValueObject\LevelSetList;use Rector\Set\ValueObject\SetList;use Rector\PHPUnit\Set\PHPUnitSetList;return RectorConfig::configure()->withPaths([__DIR__ . '/src',__DIR__ . '/tests',])->withSkip([__DIR__ . '/src/Infrastructure/Legacy',])->withPhpSets(php84: true)->withSets([SetList::CODE_QUALITY,SetList::DEAD_CODE,SetList::TYPE_DECLARATION,PHPUnitSetList::PHPUNIT_100,])->withPreparedSets(deadCode: true,codeQuality: true,typeDeclarations: true,privatization: true,earlyReturn: true,);
Commands
bash
# Preview changes (dry run)vendor/bin/rector process --dry-run# Apply changesvendor/bin/rector process# Single filevendor/bin/rector process src/Domain/Order.php
Code Coverage Tools
PHPUnit Coverage
xml
<!-- phpunit.xml --><phpunit><coverage><report><clover outputFile="coverage.xml"/><html outputDirectory="coverage-html"/><text outputFile="coverage.txt"/></report><include><directory suffix=".php">src</directory></include><exclude><directory>src/Infrastructure/Legacy</directory></exclude></coverage></phpunit>
Coverage Drivers
| Driver | Speed | Accuracy | Use Case | |
|---|---|---|---|---|
| Xdebug | Slow | High | Local dev, accurate metrics | |
| PCOV | Fast | High | CI, fast feedback | |
| PHPDBG | Medium | Medium | Alternative |
CI Integration
yaml
# GitHub Actions with PCOV- uses: shivammathur/setup-php@v2with:php-version: '8.4'coverage: pcov- run: vendor/bin/phpunit --coverage-clover coverage.xml- uses: codecov/codecov-action@v4with:files: coverage.xml
Infection (Mutation Testing)
Configuration
json
{"$schema": "vendor/infection/infection/resources/schema.json","source": {"directories": ["src"]},"logs": {"text": "infection.log","html": "infection.html"},"mutators": {"@default": true},"minMsi": 80,"minCoveredMsi": 90}
Commands
bash
# Run with coveragevendor/bin/infection --threads=4# CI modevendor/bin/infection --min-msi=80 --min-covered-msi=90 --threads=max
Tool Comparison Matrix
| Aspect | PHPStan | Psalm | DEPTRAC | Rector | |
|---|---|---|---|---|---|
| Type analysis | ✅ Deep | ✅ Deep | ❌ | ⚠️ Basic | |
| Architecture | ❌ | ❌ | ✅ | ❌ | |
| Security | ⚠️ | ✅ Taint | ❌ | ❌ | |
| Auto-fix | ❌ | ❌ | ❌ | ✅ | |
| Speed | Fast | Medium | Fast | Slow | |
| Config | NEON | XML | YAML | PHP |
Recommended CI Setup
yaml
lint:parallel:matrix:- TOOL: [phpstan, psalm, cs-fixer, deptrac]script:- case $TOOL inphpstan) vendor/bin/phpstan analyse ;;psalm) vendor/bin/psalm ;;cs-fixer) vendor/bin/php-cs-fixer fix --dry-run ;;deptrac) vendor/bin/deptrac analyse ;;esac
References
For detailed information, load these reference files:
references/phpstan-rules.md— Custom PHPStan rulesreferences/psalm-plugins.md— Psalm plugins and annotationsreferences/rector-rules.md— Rector upgrade sets