grumphp-shim icon indicating copy to clipboard operation
grumphp-shim copied to clipboard

Amp/Future Type mismatch due to humbug/box namespace prefix

Open stijnbernards opened this issue 10 months ago • 1 comments

Hello,

I tried creating a custom TaskHandlerMiddleware and use it together with the grumphp-shim packages. But because TaskHandlerMiddlewareInterface return signature defines Amp\Future and this namespace is not excluded from humbug/box namespace prefixing I'm experiencing the following error:

Fatal error: Declaration of -\CodeQuality\GrumPHP\Runner\TaskHandler\Middleware\ConfigureDefaultIgnores::handle(GrumPHP\Task\TaskInterface $task, GrumPHP\Runner\TaskRunnerContext $runnerContext, GrumPHP\Runner\StopOnFailure $stopOnFailure, callable $next): Amp\Future must be compatible with GrumPHP\Runner\TaskHandler\Middleware\TaskHandlerMiddlewareInterface::handle(GrumPHP\Task\TaskInterface $task, GrumPHP\Runner\TaskRunnerContext $runnerContext, GrumPHP\Runner\StopOnFailure $stopOnFailure, callable $next): _HumbugBox6e20aa8b1e92\Amp\Future in /Users/-/Projects/-/vendor/-/code-quality/src/GrumPHP/Runner/TaskHandler/Middleware/ConfigureDefaultIgnores.php on line 28

Should the Amp\Future namespace be excluded in the box.json or am I doing something wrong? :)

stijnbernards avatar Feb 25 '25 08:02 stijnbernards

Hello @stijnbernards

You are right, it's being scoped right now. Since it's part of the extendable public API, it should be ignored in box.json. (which might theoretically result in conflicts with any mismatching local amp installtion - but I can live with that)

Care to send a PR?

veewee avatar Feb 26 '25 12:02 veewee