There's probably more to it than the obvious issue described below to support the new version, and AFAICS a breaking change cannot be avoided.
PHP Fatal error: Declaration of LaminasPhpStan\UnmappedAliasServiceLocatorProxy::build($name, ?array $options = null)
must be compatible with Laminas\ServiceManager\ServiceLocatorInterface::build(string $name, ?array $options = null): mixed
in .../vendor/slam/phpstan-laminas-framework/src/UnmappedAliasServiceLocatorProxy.php on line 60
That method is an override for the sole purpose of throwing a ShouldNotHappenException but unfortunately this method needs to be implemented according to the requirements of the interface since there is no abstract/base class that can be used.
Right now this PHPStan extension is not compatible with Laminas ServiceManager v4 which was released on March 4 2024: https://github.com/laminas/laminas-servicemanager/releases/tag/4.0.0
There's probably more to it than the obvious issue described below to support the new version, and AFAICS a breaking change cannot be avoided.
That method is an override for the sole purpose of throwing a ShouldNotHappenException but unfortunately this method needs to be implemented according to the requirements of the interface since there is no abstract/base class that can be used.