一键导入
phpstan
Static analysis tool configured at Level 9. All code must pass PHPStan Level 9 with strict typing, no untyped signatures, and minimal suppression of errors.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Static analysis tool configured at Level 9. All code must pass PHPStan Level 9 with strict typing, no untyped signatures, and minimal suppression of errors.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Readonly data containers with typed factory methods (`fromArray`, `fromModel`, `fromCollection`, `fromRequest`) used to pass structured data between application layers — especially for external API responses, Eloquent models, and service boundaries. Use this skill whenever creating, reviewing, or refactoring DTOs, Data Transfer Objects, value objects for inter-layer communication, or mapping payloads from APIs, models, or collections into typed PHP objects. Also trigger when the user mentions spatie/laravel-data alternatives, data mapping, or payload normalization in a Laravel context.
Eloquent model conventions for mass assignment, casts, relationship naming, activity logging, and mandatory model tests (CRUD + relations).
Single-purpose business logic classes that encapsulate one well-defined business operation. Actions are the primary location for business logic in Laravel applications, invoked from controllers, commands, or jobs.
Albatros accounting API integration via Saloon. Use when working with app/Services/Albatros/, AlbatrosConnector, or Albatros DTOs.
Laravel Blade template conventions covering components, output escaping, security, structure, and formatting.
Artisan console command classes that serve as the CLI entry point for operations. Commands validate input and delegate all business logic to Actions or Services.
| name | phpstan |
| description | Static analysis tool configured at Level 9. All code must pass PHPStan Level 9 with strict typing, no untyped signatures, and minimal suppression of errors. |
app/** or tests/**.phpstan.neon exists at repo root and is used as the default project config.phpstan.neon is missing, initialize config first; do not guess flags ad hoc:
vendor/bin/phpstan initphpstan-baseline.neon exists, it is included intentionally and reviewed before merge.vendor/bin/phpstan analyse --generate-baselinevendor/bin/phpstan analysevendor/bin/phpstan analyse app/ tests/vendor/bin/phpstan analyse app/Services/Billingmixed usage.@phpstan-ignore usage and whether it is justified.mixed types with more specific union types.array<string, mixed> or more precise shapes instead of bare array in PHPDoc.@throws annotations to methods that can throw exceptions.phpstan-assert, phpstan-param, and phpstan-return tags when generics or advanced shapes are needed.assert(), instanceof) instead of suppressing errors.vendor/bin/phpstan analyse after fixes.array has no value type specified.array<string, mixed> or specific shapes (array<int, InvoiceDto>).Cannot call method ... on mixed.instanceof, assert(), or typed wrappers.Cannot call method ... on Type|null.@template, Collection generic count/type mismatch.// ✓ Specific types instead of mixed
public function process(Order $order): Invoice { ... }
// ✓ PHPDoc with typed arrays
/**
* @return array<string, array<int, string|object>>
*/
public function rules(): array { ... }
// ✓ Union types instead of mixed
public function format(string|int|null $value): string { ... }
// ✓ Generics for collections
/**
* @return Collection<int, Invoice>
*/
public function getInvoices(): Collection { ... }
// ✓ @throws annotation
/**
* @throws InvoiceAlreadyPaidException
*/
public function markAsPaid(Invoice $invoice): void
{
if ($invoice->isPaid()) {
throw InvoiceAlreadyPaidException::for($invoice);
}
// ...
}
// ✓ Type narrowing with assert() instead of suppression
public function handle(mixed $model): void
{
assert($model instanceof Invoice);
$model->markAsPaid(); // PHPStan now knows it's an Invoice
}
// ✓ Justified suppression with comment
/** @phpstan-ignore-next-line Property accessed via magic method — documented in IDE helper */
$user->custom_attribute;
vendor/bin/phpstan analyse from repo root.phpstan.neon exists (or initialized it before applying this skill).mixed and array usages with more specific types or PHPDoc generics.@throws annotations to methods that can throw.@phpstan-ignore usages are justified with clear comments.mixed when a more specific type is possible.array without a PHPDoc generic shape such as array<string, mixed>.@phpstan-ignore without an explanation of why it is necessary.@throws annotations on methods that throw.(int) or (string) casts as substitutes for proper type narrowing.resources/boost/skills/php/SKILL.md (type-first PHP conventions)