phpyh/psalm-tester
Run Psalm assertions from .phpt files. Write phpt tests with --FILE-- and --EXPECT/EXPECTF-- for traces and errors, then execute them via a PHPUnit test suite using PsalmTester. Supports per-suite default Psalm args and per-test --ARGS-- overrides.
Enhancing Code Quality Gates: Integrate Psalm static analysis into CI/CD pipelines as a mandatory pre-merge check, ensuring type safety and catching regressions early. This aligns with initiatives to shift left on quality. The package now provides a foundational, testable interface for Psalm, enabling teams to enforce type safety programmatically with zero additional tooling debt. The initial release establishes this capability with a clean, Laravel-friendly API, making it a production-ready starting point for Psalm adoption.
Test-Driven Static Analysis: Adopt a test-first approach for Psalm, where expected analysis outcomes are verified in unit tests (e.g., Psalm::run()->assertNoErrors()). This supports a culture of explicit quality contracts in the codebase. The package’s design allows for baselining Psalm errors in tests, ensuring regressions are caught immediately after refactors or new commits.
Build vs. Buy: Buy (adopt this package) to avoid reinventing the wheel for Psalm integration in tests/CI. The lightweight nature reduces maintenance overhead compared to custom scripts or full-fledged solutions like PHPStan’s testers. This is now a production-ready starting point for Psalm adoption, with minimal setup and Laravel-native compatibility.
Use Cases:
Psalm::run()->assertNoErrors()). The package’s Laravel integration lowers the barrier to adoption, making it ideal for team-wide enforcement.Adopt if:
Look Elsewhere if:
*"This new Laravel package lets us automate and enforce Psalm static analysis in our CI pipeline, catching type errors before they reach production. By treating Psalm results as testable assertions, we’ll:
*"phpyh/psalm-tester (v0.1.0) gives us a clean, testable interface for Psalm in CI and local dev. Key wins:
Psalm::run()->assertNoErrors().Psalm::run()->assertNoErrors(); // Fails if new errors are introduced.
Call to Action: *"Let’s pilot this in our next major release for high-impact areas (e.g., API services, shared libraries). Proposal:
assertNoErrors() to baseline current state.How can I help you explore Laravel packages today?