jetbrains/phpstorm-stubs
PHPStorm stubs: syntactically correct PHP files with signatures, constants, and full PHPDoc for PHP core and most extensions. Used by IDEs for completion, inspections, type inference, and documentation popups. Community-maintained for non-standard extensions.
Install as a dev dependency to bring in official PhpStorm stubs for accurate IDE support:
composer require --dev jetbrains/phpstorm-stubs
This package doesn’t affect runtime—it only enhances static analysis and IDE intelligence. First use case: configure your IDE to use local stubs (e.g., in PhpStorm: Settings > Languages & Frameworks > PHP > PHP Runtime > Advanced settings > Default stubs path → vendor/jetbrains/phpstorm-stubs). Instantly gain better autocomplete, parameter hints, and type inference for core PHP functions and standard extensions. No code changes needed—just restart the IDE or reindex.
// phpstan.neon
parameters:
stubFiles: [vendor/jetbrains/phpstorm-stubs/PhpStormStubs.php]
git pull to stay current without waiting for IDE updates.v2024.2) in composer.json to match your PHP runtime—critical when supporting multiple PHP versions or large teams.@return types differing across PHP minor versions).myext.stub.php) in a stubs/ directory and register it in your IDE’s PHP settings.@throws annotations are often missing or outdated—the package explicitly warns: verify exception behavior against PHP docs or source code manually. Relying solely on stub-based error analysis may suppress legitimate static analysis warnings.swoole, msgpack, or ext-redis in src/; outdated stubs can cause false positives/negatives in autocomplete and type checking.PhpStormStubsMap.php after upgrades (especially PHP version bumps) using docker compose run test_runner /usr/local/bin/php tests/Tools/generate-stub-map. Skipping this may cause incomplete symbol indexing or missing hints.-dev versions or direct git repos in PhpStorm settings for active development on stubs themselves (e.g., fixing a function signature)—just avoid committing IDE settings pointing to local paths.How can I help you explore Laravel packages today?