Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce the new v2 extension system #1091

Merged
merged 1 commit into from May 25, 2023
Merged

Conversation

veewee
Copy link
Contributor

@veewee veewee commented May 25, 2023

Q A
Branch v2
Bug fix? yes
New feature? yes
BC breaks? yes
Deprecations? no
Documented? yes
Fixed tickets

Fixes phpro/grumphp-shim#20

This PR introduces a new GrumPHP extension system for v2.
Since the new implementation does not leak the dependency with symfony/dependency-injection to the PHP API of an extension, we can make any extension work in grumphp-shim (PHAR distribition) with scoped dependencies as well.

A well calculated downside of this, is that an extension maintainer is now forced to configure the service declarations in a separate YAML (or xml, ...) file where previously this could be done directly from PHP.

Breaking change:

class MyExtension implements ExtensionInterface
{

-     public function load(ContainerBuilder $container): void { /* ... */ }

+    public function imports(): iterable {
+        yield '/path/to/my/config.yaml';
+    }
}

And make sure all services are registered through a symfony/dependency-injection compatible configuration file.
(YAML, XML, INI, ...) - PHP is not supported because of the scoped vendor in the PHAR.

# /path/to/my/config.yaml

services:
  xxxxxx: xxxx

More info : https://symfony.com/doc/current/service_container.html

@veewee veewee merged commit cd90aef into phpro:v2.x May 25, 2023
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant