Repository navigation
Description
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.
Activity
mnapoli commentedon Jul 28, 2021
Hey, that's clever and that sounds good to me.
This could be included in
psr/container?boesing commentedon Jul 28, 2021
Yes. Just the same way I've done it in
laminas/laminas-servicemanager.This wont work with
psr/containerv2 due to upstream implementations but for 1.2.0 ofpsr/containerthis would work.Imho, if a project enables support for
psr/containerv2, they wont be able to usecontainer-interop/container-interopanyways until they migrate their own implementations. So having this replacement available in 1.2.0 of this library would totally drop installations forcontainer-interop/container-interoponce and for all.boesing commentedon Jul 29, 2021
@mnapoli I could create a PoC PR so you guys can decide if this is something you want to do.
mnapoli commentedon Jul 29, 2021
👍 for me