headercat/phpstan-extension-ide-helper
Provides dummy PHPStan namespace classes and functions so IDEs and autocompletion tools can reference PHPStan internals normally hidden inside its PHAR. Install as a dev dependency to get full autocompletion when writing PHPStan extensions.
Architecture Fit
PHPStan\... classes, functions, and constants). PHPStan is distributed as a PHAR, so IDEs cannot index its internals; this package re-materializes those symbols as plain PHP files with return; injected after each namespace declaration, making them autocomplete- and go-to-definition-friendly while remaining inert at runtime.Rule, NodeVisitor, TypeNodeResolverExtension, or config-level extensions. In a typical Laravel codebase that merely runs PHPStan (via Larastan or a CI step), this package adds zero value; the analyser already resolves its own internals at execution time.require-dev, produces no artifacts consumed in production, and cannot affect Laravel's container, routing, or Eloquent behaviour.phpstan analyse runs will be disappointed — the win is reduced context-switching for engineers writing rules by hand.Integration Feasibility
composer require --dev line; no service provider, no config publish, no Laravel package discovery registration. Integration cost is effectively a lock-file entry plus IDE configuration.composer.json inherits phpstan/* dependencies discovered from phpstan-src. That means installing the helper can transitively constrain the phpstan/phpstan version your repo resolves. A helper release generated from PHPStan 2.3.x may refuse to coexist with a tree pinned to 2.2.x, or worse, silently downgrade/upgrade PHPStan. This must be verified against the helper's actual published composer.json before adoption — it is not stated in the README, and it is the single thing most likely to break CI.2.3.x describes PHPStan 2.3.x internals; pairing 2.3.x stubs with a 2.2.x analyser yields phantom classes and misleading signatures in autocomplete — a silent DX regression that no test will catch.phpstan-src/tree/<tag>. No changelog, no breaking-change callout. Blast radius is unassessable from the release itself; you must diff upstream.return;-after-namespace generation is a pragmatic trick. Signatures, generics, and @template annotations survive, but behaviour does not; anyone reading a stub as if it were source will be misled.composer.json constrain phpstan/phpstan, and if so does it conflict with our pin?phpstan-src and add it to the IDE include path, or rely on PHPStorm's PHAR indexing?composer.lock for deterministic team-wide stubs?Stack Fit
^2.x; requires that the repo already has PHPStan wired into CI, otherwise there is nothing to extend.extension-installer interplay, no config file.Migration Path
composer show phpstan/phpstan; inspect the helper's published composer.json for phpstan/* constraints; grep -r "PHPStan\\\\" app/ tests/ for existing FQCN references in custom rules.phpstan/phpstan to the target minor and get a clean full analysis run before introducing stubs. Isolate analyser breakage from stub breakage — mixing the two makes triage impossible."headercat/phpstan-extension-ide-helper": "2.3.1" alongside "phpstan/phpstan": "2.3.1". Exact pins, not carets, so every developer's editor sees identical symbols.PHPStan\ internals, then run phpstan analyse to confirm the analyser is unaffected.Compatibility
phpstan-src into the IDE include path achieves the same result without a third-party dependency, at the cost of per-developer setup.Sequencing
Maintenance
phpstan/phpstan release and compares it against the pinned pair, opening a tracking issue on mismatch. Detection is cheap; do not rely on human recall.Support
composer install but will not know why the stubs exist. A one-paragraph README in the repo explaining the pairing rule prevents accidental version drift during routine dependency bumps.Scaling
composer.json or Renovate/Dependabot group rule, drift is inevitable.Failure Modes
phpstan/* requirements clash with the repo pin, blocking composer update or silently mutating the analyser version. Impact: CI breakage, resolvable but disruptive. Verify constraints before adoption.phpstan-src.phpstan analyse runs and code review.Ramp-Up
How can I help you explore Laravel packages today?