phpro / grumphp-shim

This repository provides easy way to install GrumPHP without the risk of conflicting dependencies.
MIT License
24 stars 3 forks source link

Problem with GrumPHP shim and _HumbugBox ContainerBuilder #20

Closed benr77 closed 1 year ago

benr77 commented 2 years ago
Q A
Version 1.13.0 SHIM
Bug? yes
New feature? no
Question? no
Documentation? no
Related tickets

I'm trying to create an extension, using GrumPHP\Extension\ExtensionInterface.

My installation uses the shim version of the package.

When I try to create the extension, I get an error:

PHP Fatal error:  Declaration of App\MyGrumTask\ExtensionLoader::load(Symfony\Component\DependencyInjection\ContainerBuilder $container): void must be compatible with GrumPHP\Extension\ExtensionInterface::load(_HumbugBox2e6990dfd7a2\Symfony\Component\DependencyInjection\ContainerBuilder $container): void

My IDE wants me to change the method signature to _HumbugBox2e6990dfd7a2\Symfony\Component\DependencyInjection\ContainerBuilder!

Is this something to do with the shim packaging?

Thanks

veewee commented 2 years ago

Thanks for reporting. It is related to https://github.com/phpro/grumphp-shim/issues/10

All vendor classes get prefixed to make sure they don't conflict with your local dependencies. In order to fix this, we have to make sure that all interfaces only use grumphp instances. This would mean that fixing this issue will breaknevery existing extension out there. Probably something we would want to do in the next major version and which will require extra downstream changes from people who already invested time into figuring out how it old works

benr77 commented 2 years ago

OK so basically for now, if you want to use custom extensions, you cannot use the shim version?

This is fine for me, and now I guess it's at least semi-documented in the issue tracker.

Thanks

veewee commented 2 years ago

That is correct

veewee commented 1 year ago

@benr77 For v2 of GrumPHP, I've foreseen a breaking change here in order to make extensions work with grumphp-shim as well. Feel free to play around with it! I'm planning to do a beta release soon.