Optional PHPStan 2 extension for gplanchat/durable. It teaches PHPStan that:
WorkflowEnvironment::activityStub(SomeContract::class)returnsActivityStub<SomeContract>(via aligned PHPDoc generics — see ADR012 in the monorepo).- Each
#[ActivityMethod]method on the contract appears on the stub and returnsAwaitable<R>, whereRis the contract method’s return type.
- PHP 8.2+
phpstan/phpstan^2.0gplanchat/durable(same major as your app)
composer require --dev gplanchat/durable-phpstanIf you do not use phpstan/extension-installer, include the extension explicitly:
includes:
- vendor/gplanchat/durable-phpstan/extension.neonFrom PHPStan level 1 onward, reportMagicMethods is enabled through the level chain. ActivityStub relies on “magic” __call for ergonomics, so without this extension you get method.notFound on $stub->greet() even though runtime is correct. This package fixes that by exposing virtual methods via MethodsClassReflectionExtension.
From src/DurablePhpStan/ (monorepo) :
composer install
./vendor/bin/phpstan analyse -c phpstan.neon.distThe Packagist payload is entirely under packages/durable-phpstan/ (no ../../ paths).