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

Replacement for container-interop #37

Open
boesing opened this issue Jul 28, 2021 · 4 comments
Open

Replacement for container-interop #37

boesing opened this issue Jul 28, 2021 · 4 comments

Comments

@boesing
Copy link

boesing commented Jul 28, 2021

Hey there,

I am working on laminas/laminas-servicemanager#96 and realized that it would be quite simple to fully replace the abandoned package container-interop/container-interop by using some composer magic:

https://github.com/laminas/laminas-servicemanager/pull/96/files#diff-d2ab9925cad7eac58e0ff4cc0d251a937ecf49e4b6bf57f8b95aab76648a9d34R87
https://github.com/laminas/laminas-servicemanager/pull/96/files#diff-d2ab9925cad7eac58e0ff4cc0d251a937ecf49e4b6bf57f8b95aab76648a9d34R52
https://github.com/laminas/laminas-servicemanager/pull/96/files#diff-d2ab9925cad7eac58e0ff4cc0d251a937ecf49e4b6bf57f8b95aab76648a9d34R61


When adding the autoload file to the autoloader like this, all packages type-hinting against the container-interop interfaces will still work and thus, no one will get composer warnings of the abandoned package container-interop/container-interop anymore.

<?php

declare(strict_types=1);

use Interop\Container\Containerinterface as InteropContainerInterface;
use Interop\Container\Exception\ContainerException as InteropContainerException;
use Interop\Container\Exception\NotFoundException as InteropNotFoundException;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface;
use Psr\Container\NotFoundExceptionInterface;

class_alias(ContainerInterface::class, InteropContainerInterface::class);
class_alias(ContainerExceptionInterface::class, InteropContainerException::class);
class_alias(NotFoundExceptionInterface::class, InteropNotFoundException::class);

In v1.2.0, container-interop only extends the PSR-Interfaces and has no own methods.


Is this something which would be considered by this component? I know its not the usual way of handling such problems but I'd say it would be "cleaner" in this component than in the laminas/laminas-servicemanager component.

Feedback welcome.
If this is not something you want to do in this package, feel free to close this issue as invalid.

@mnapoli
Copy link
Member

mnapoli commented Jul 28, 2021

Hey, that's clever and that sounds good to me.

This could be included in psr/container?

@boesing
Copy link
Author

boesing commented Jul 28, 2021

Yes. Just the same way I've done it in laminas/laminas-servicemanager.
This wont work with psr/container v2 due to upstream implementations but for 1.2.0 of psr/container this would work.

Imho, if a project enables support for psr/container v2, they wont be able to use container-interop/container-interop anyways until they migrate their own implementations. So having this replacement available in 1.2.0 of this library would totally drop installations for container-interop/container-interop once and for all.

@boesing
Copy link
Author

boesing commented Jul 29, 2021

@mnapoli I could create a PoC PR so you guys can decide if this is something you want to do.

@mnapoli
Copy link
Member

mnapoli commented Jul 29, 2021

👍 for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants