Help us improve
Share bugs, ideas, or general feedback.
From acc
Generates PHPStan configs (phpstan.neon, baselines) for PHP 8.4+ projects with levels, paths, strict rules, and DDD/Doctrine support. For new, legacy, or domain-driven apps.
npx claudepluginhub dykyi-roman/awesome-claude-code --plugin accHow this skill is triggered — by the user, by Claude, or both
Slash command
/acc:create-phpstan-configThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Generates optimized PHPStan configurations for PHP 8.4+ projects.
Guides PHPStan error resolution prioritizing refactoring over phpDoc and ignoring, with Nette patterns, baseline management, and type tests. Use before running PHPStan or fixing errors.
Generates Psalm configurations for PHP 8.4+ projects, creating psalm.xml and psalm-baseline.xml with error levels, plugins, taint analysis, and DDD-specific settings for new, existing, or domain-driven projects.
Configures PHPStan static analysis for Sage/Acorn projects: installs phpstan, larastan, and wordpress stubs, creates phpstan.neon, generates baselines, and handles common type errors.
Share bugs, ideas, or general feedback.
Generates optimized PHPStan configurations for PHP 8.4+ projects.
phpstan.neon # Main configuration
phpstan-baseline.neon # Error baseline (if needed)
# phpstan.neon
includes:
- vendor/phpstan/phpstan-strict-rules/rules.neon
- vendor/phpstan/phpstan-deprecation-rules/rules.neon
- vendor/phpstan/phpstan-phpunit/extension.neon
parameters:
level: 8
phpVersion: 80400
paths:
- src
- tests
excludePaths:
- tests/Fixtures/*
- src/Infrastructure/Legacy/*
# Strict type checking
checkMissingIterableValueType: true
checkGenericClassInNonGenericObjectType: true
checkUninitializedProperties: true
checkImplicitMixed: true
reportUnmatchedIgnoredErrors: true
# Parallel processing
parallel:
maximumNumberOfProcesses: 4
# phpstan.neon
includes:
- phpstan-baseline.neon
- vendor/phpstan/phpstan-strict-rules/rules.neon
- vendor/phpstan/phpstan-deprecation-rules/rules.neon
parameters:
level: 6
paths:
- src
- tests
excludePaths:
- src/Legacy/*
- tests/Fixtures/*
# Gradually increase strictness
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false
# Type aliases for legacy code
typeAliases:
UserId: 'int|string'
Timestamp: 'int|DateTimeInterface'
# phpstan.neon
includes:
- vendor/phpstan/phpstan-strict-rules/rules.neon
- vendor/phpstan/phpstan-deprecation-rules/rules.neon
- vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/phpstan/phpstan-doctrine/extension.neon
parameters:
level: 9
phpVersion: 80400
paths:
- src
excludePaths:
- src/Infrastructure/Migrations/*
# Strict for Domain layer
checkMissingIterableValueType: true
checkGenericClassInNonGenericObjectType: true
checkUninitializedProperties: true
checkImplicitMixed: true
# Report all issues
reportUnmatchedIgnoredErrors: true
reportStaticMethodSignatures: true
# Parallel for speed
parallel:
maximumNumberOfProcesses: 8
processTimeout: 300.0
# Custom parameters
doctrine:
repositoryClass: App\Infrastructure\Persistence\DoctrineRepository
objectManagerLoader: tests/object-manager.php
# Ignore patterns
ignoreErrors:
# Doctrine entities
- '#Property .+ has no type specified#'
path: src/Infrastructure/Doctrine/Entity/*
# Value Objects immutability
- '#Readonly property .+ is assigned outside of its declaring class#'
path: src/Domain/*/ValueObject/*
# Custom rules
rules:
- App\PHPStan\DomainLayerRule
- App\PHPStan\ValueObjectImmutabilityRule
includes:
- vendor/phpstan/phpstan-phpunit/extension.neon
parameters:
# PHPUnit-specific settings
phpunit:
configPath: phpunit.xml
includes:
- vendor/phpstan/phpstan-doctrine/extension.neon
parameters:
doctrine:
repositoryClass: Doctrine\ORM\EntityRepository
objectManagerLoader: tests/object-manager.php
includes:
- vendor/phpstan/phpstan-symfony/extension.neon
- vendor/phpstan/phpstan-symfony/rules.neon
parameters:
symfony:
containerXmlPath: var/cache/dev/App_KernelDevDebugContainer.xml
consoleApplicationLoader: tests/console-application.php
parameters:
ignoreErrors:
# Constructor property promotion
- '#Constructor of class .+ has an unused parameter#'
# Doctrine entities
- '#Property .+ does not accept null#'
path: src/Infrastructure/Doctrine/Entity/*
# Test doubles
- '#Call to an undefined method .+Mock::#'
path: tests/*
# Dynamic properties in tests
- '#Access to an undefined property .+Test::\$#'
path: tests/*
# Factory methods
- '#Method .+Factory::create\(\) should return .+ but returns#'
# Event handlers
- '#Parameter .+ of method .+Handler::__invoke\(\) has no type specified#'
# Generate baseline for existing errors
vendor/bin/phpstan analyse --generate-baseline
# Generate baseline with specific name
vendor/bin/phpstan analyse --generate-baseline=phpstan-baseline.neon
# Analyze and exclude baseline errors
vendor/bin/phpstan analyse
# Step 1: Start with baseline at current level
parameters:
level: 0
# Step 2: Generate baseline
# vendor/bin/phpstan analyse --generate-baseline
# Step 3: Increase level
parameters:
level: 1
# Step 4: Fix new errors or add to baseline
# Repeat until level 8
| Level | Focus | Timeline |
|---|---|---|
| 0-2 | Basic errors, undefined variables | Week 1 |
| 3-4 | Return types, dead code | Week 2-3 |
| 5-6 | Argument types, type hints | Week 4-6 |
| 7-8 | Union types, no mixed | Week 7-10 |
| 9 | Maximum strictness | Ongoing |
phpstan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
- run: composer install
- run: vendor/bin/phpstan analyse --memory-limit=1G --error-format=github
phpstan:
script:
- vendor/bin/phpstan analyse --memory-limit=1G --error-format=gitlab > phpstan.json
artifacts:
reports:
codequality: phpstan.json
parameters:
# Parallel processing
parallel:
maximumNumberOfProcesses: 8
processTimeout: 300.0
# Cache results
tmpDir: var/cache/phpstan
# Memory limit
memoryLimitFile: 1G
Analyze project:
composer.json for PHPStan versionphpstan.neonDetermine level:
Add extensions:
Generate baseline if needed:
Provide:
The generator will: