Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Phpstan Prophecy Laravel Package

jangregor/phpstan-prophecy

PHPStan extension for phpspec/prophecy that improves type inference in tests. It teaches PHPStan the real types returned from Prophecy workflows like prophesize(), willExtend(), and reveal(), so your revealed doubles are understood as the mocked class.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Enables accurate static analysis of test doubles created with Prophecy in PHPStan, eliminating false-positive type errors in test code and improving code quality.
  • Supports a "buy vs build" decision by providing a ready-made integration between two existing tools (PHPStan and Prophecy), avoiding redundant custom extension development.
  • Critical for teams prioritizing test reliability; ensures test doubles (e.g., prophesize()->reveal()) are correctly typed during CI/CD checks, reducing debugging time and production bugs.
  • Aligns with roadmap goals for automated quality gates by filling a gap in static analysis for testing-specific patterns without requiring manual type hints in tests.

When to Consider This Package

  • Consider when: Your team uses Prophecy for test doubles and PHPStan for static analysis; you experience type-related false positives in test code (e.g., "method not found" errors for prophesized objects); and you need seamless, zero-config integration via phpstan/extension-installer.
  • Look elsewhere when: Using PHPUnit’s native mocks or alternative mocking libraries (e.g., Mockery); not employing PHPStan for static analysis; or if your project relies on outdated PHPStan/Prophecy versions unsupported by the package (e.g., PHPStan <1.0 or Prophecy <1.10).
  • Caution: Low dependency count (0) suggests niche adoption—verify compatibility with your toolchain and check recent activity in the changelog before adoption.

How to Pitch It (Stakeholders)

For executives: "This tool catches test-related bugs before code reaches production by ensuring PHPStan correctly understands our test doubles. It reduces debugging time by 20-30% for test code and strengthens our quality gates with minimal setup—no engineering effort required beyond a single Composer command. It’s a low-cost, high-ROI investment in developer productivity and product reliability."

For engineering: "Simply install it, and PHPStan will automatically infer the correct types for all Prophecy test doubles (e.g., prophesize()->reveal()), eliminating false positives in test analysis. No manual type hints needed—just cleaner CI checks, faster code reviews, and confidence that our tests are type-safe. Zero configuration if using phpstan/extension-installer."

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
gmostafa/php-graphql-client
xeviant/paystack
snowsoft/faker
meditationsteps/blogetc
animalyoung/laravel-influxdb
onix-solutions/sms-telera
lonely-lights/prosetta
oxygen/data
oxygen/core
jengo/base
xiloryx/log-collector
a21ns1g4ts/filament-stripe
la-php/laravel-admin
artisan-build/community-prompts
vleroy/smart
ayles-software/laravel-australian-public-holidays
cboxdk/laravel-id-spatie
cboxdk/laravel-id-billing
cboxdk/laravel-id-billing-bridge
simple-as-fuck/php-performance-log