petrvs-phpstan-quality

Resolve PHPStan/Larastan findings in Petrvs-PGD with precise type hints and PHPDoc corrections.

19|14|Updated Aug 6, 2024
One-click install
npx skills add https://github.com/gestaogovbr/pgd-petrvs-publico --skill petrvs-phpstan-quality
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: petrvs-phpstan-quality
Source: https://github.com/gestaogovbr/pgd-petrvs-publico/tree/main/.agents/skills/petrvs-phpstan-quality
Command: npx skills add https://github.com/gestaogovbr/pgd-petrvs-publico --skill petrvs-phpstan-quality

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you turn PHPStan/Larastan findings for the Petrvs-PGD codebase into real, correct improvements instead of leaving noisy or misleading warnings unresolved.

Core Features & Use Cases

  • Static analysis triage: Validate whether each reported finding is a true bug, a missing type hint, an incorrect PHPDoc contract, or a Larastan inference limitation.
  • Type and model-relation correctness: Address undefined variables, duplicate validation keys, and Eloquent relation/type issues by inspecting the relevant models and query chains.
  • Incremental quality improvement: Re-run PHPStan on the smallest affected path first, then expand scope only when shared code changes.

Quick Start

Ask the AI to review the PHPStan output for the smallest changed path in Petrvs and propose safe code/type corrections without suppressions.

Frequently Asked Questions about petrvs-phpstan-quality

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix PHPStan undefined variable and duplicate validation key errors in Laravel?

Fix PHPStan undefined variable and duplicate validation key warnings by validating each finding as a true issue, inspecting Eloquent models, and applying precise native type hints and PHPDocs without using suppressions.

Can I resolve Larastan Eloquent relation warnings without adding ignore tags?

Yes, you can resolve Larastan Eloquent relation warnings without ignore tags by inspecting the relevant models, correcting generics repository typing, and addressing inference limitations with precise PHPDocs rather than suppressing the static analysis output.

What is the best way to handle PHPStan type inference limitations in a Laravel repository?

The best way to handle PHPStan type inference limitations is to add precise native type hints and correct PHPDoc contracts, validating each finding as a real issue and preserving domain behavior before re-running static analysis on the smallest altered path.

How do I safely refactor PHP code based on static analysis findings?

Safely refactor PHP code by triaging static analysis findings to distinguish true bugs from missing type hints, preserving domain behavior, and re-running PHPStan on the smallest affected path first before expanding scope to shared code.

Do I need to re-run PHPStan on the entire project after fixing type hints?

No, you should re-run PHPStan on the smallest altered path first after fixing type hints, expanding scope only when shared code changes, ensuring incremental quality improvement without validating the entire project immediately.

Why does PHPStan report incorrect PHPDoc contracts in my Eloquent models?

PHPStan reports incorrect PHPDoc contracts in Eloquent models due to inference limitations and missing generics repository typing, requiring you to inspect query chains and add precise native types and PHPDocs to resolve the static analysis warnings.