create-phpstan-config
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "create-phpstan-config" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-bc7934899047484829752bb1e3a6dd0b5175bdb0f60b952e274f608814359cd2. Verify the upstream source and version against https://github.com/dykyi-roman/awesome-claude-code before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Generate a PHPStan configuration for a PHP project. Create a phpstan.neon file that includes level settings, extensions, code paths, baseline support, and DDD-oriented rules.
Introduction source: third_party · dykyi-roman · 0.0.1 Reference
SkillPi interpretation
- Tasks
- Generates PHPStan configurations for PHP projects. Creates phpstan.neon with appropriate level, extensions, paths, baseline support, and DDD-specific rules.
- Testing
- Not tested
Browse files
Frontmatter
name: create-phpstan-config
description: Generates PHPStan configurations for PHP projects. Creates phpstan.neon with appropriate level, extensions, paths, baseline support, and DDD-specific rules.PHPStan Configuration Generator
Generates optimized PHPStan configurations for PHP 8.4+ projects.
All examples target PHPStan 2.x:
levelaccepts0-10(10= max), and parameters removed in 2.0 (checkMissingIterableValueType,checkGenericClassInNonGenericObjectType,checkExplicitMixed,checkImplicitMixed) must never be generated — they abort the run.
Generated Files
phpstan.neon # Main configuration
phpstan-baseline.neon # Error baseline (if needed)
Configuration by Project Type
New Project (Level 8-9)
# 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 (raise `level` for stricter checks: 9 = explicit mixed, 10 = implicit mixed)
checkUninitializedProperties: true
treatPhpDocTypesAsCertain: true
reportUnmatchedIgnoredErrors: true
# Parallel processing
parallel:
maximumNumberOfProcesses: 4
Existing Project with Baseline
# 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: bump `level` one step at a time (0-10)
treatPhpDocTypesAsCertain: false
reportUnmatchedIgnoredErrors: false
# Type aliases for legacy code
typeAliases:
UserId: 'int|string'
Timestamp: 'int|DateTimeInterface'
DDD Project Configuration
# 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 (level 9 already forbids explicit mixed; use level 10 for implicit mixed)
checkUninitializedProperties: true
treatPhpDocTypesAsCertain: 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 (entry is either a delimited regex string, or a map with `message`/`identifier`)
ignoreErrors:
# Doctrine entities
-
message: '#Property .+ has no type specified#'
path: src/Infrastructure/Doctrine/Entity/*
# Value Objects immutability
-
message: '#Readonly property .+ is assigned outside of its declaring class#'
path: src/Domain/*/ValueObject/*
# Custom rules
rules:
- App\PHPStan\DomainLayerRule
- App\PHPStan\ValueObjectImmutabilityRule
Extension Configuration
PHPUnit Extension
includes:
- vendor/phpstan/phpstan-phpunit/extension.neon
parameters:
# PHPUnit-specific settings
phpunit:
configPath: phpunit.xml
Doctrine Extension
includes:
- vendor/phpstan/phpstan-doctrine/extension.neon
parameters:
doctrine:
repositoryClass: Doctrine\ORM\EntityRepository
objectManagerLoader: tests/object-manager.php
Symfony Extension
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
Custom Error Patterns
Common Ignore Patterns
parameters:
ignoreErrors:
# Constructor property promotion
- '#Constructor of class .+ has an unused parameter#'
# Doctrine entities
-
message: '#Property .+ does not accept null#'
path: src/Infrastructure/Doctrine/Entity/*
# Test doubles
-
message: '#Call to an undefined method .+Mock::#'
path: tests/*
# Dynamic properties in tests
-
message: '#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#'
Error Baseline Generation
# 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
Level Migration Guide
From Level 0 to Level 8
# 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
Recommended Progression
| 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-10 | Maximum strictness (10 is the highest level in PHPStan 2.x) | Ongoing |
CI Configuration
GitHub Actions
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
GitLab CI
phpstan:
script:
- vendor/bin/phpstan analyse --memory-limit=1G --error-format=gitlab > phpstan.json
artifacts:
reports:
codequality: phpstan.json
Performance Optimization
parameters:
# Parallel processing
parallel:
maximumNumberOfProcesses: 8
processTimeout: 300.0
# Cache results
tmpDir: var/cache/phpstan
# Memory limit
memoryLimitFile: 1G
Generation Instructions
-
Analyze project:
- Check
composer.jsonfor PHPStan version - Check existing
phpstan.neon - Identify framework (Symfony, Laravel, etc.)
- Count existing errors
- Check
-
Determine level:
- New project: Level 8-9
- Existing with few errors: Current + 1
- Legacy: Level 0 + baseline
-
Add extensions:
- PHPUnit if tests exist
- Doctrine if ORM used
- Symfony/Laravel if framework
-
Generate baseline if needed:
- For existing projects with errors
- Include command to regenerate
Usage
Provide:
- Project type (new/existing/legacy)
- Framework (Symfony, Laravel, none)
- Current error count (if existing)
- Target level (optional)
The generator will:
- Create appropriate configuration
- Add relevant extensions
- Include ignore patterns
- Generate baseline commands if needed
Current listing version
0.0.1
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 为PHP项目生成PHPStan配置是开发者日常开发中的高频需求
- 提供了详细的配置模板和最佳实践指导
- 支持多种项目类型和框架配置
Highlights
- 触发词精准完整,覆盖多种变体
- description明确描述了生成PHPStan配置的功能
- 边界清晰,不会与其他Skill混淆
Areas to improve
-
缺少When to Use章节 Reported severity: Minor
文档结构完整但缺少明确的When to Use使用场景说明章节
Recommendation: 建议添加When to Use章节,明确说明何时使用此Skill
Highlights
- Phase/步骤清晰,有出口条件
- 包含端到端示例,frontmatter完整
- 文档结构良好,易于理解执行流程
Highlights
- 工具来源明确,参数正确
- 覆盖主要异常情况,提供了详细的配置选项
- 提供了CI/CD集成方案和性能优化建议
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.