Skip to content

Commit

Permalink
Merge pull request #141 from LucasHantz/patch-1
Browse files Browse the repository at this point in the history
Skip `class_alias()` declarations when interfaces were already declared, allowing for usage with preloading
  • Loading branch information
Ocramius committed Jun 29, 2022
2 parents e7008ee + bf8a019 commit 6f96556
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/autoload.php
Expand Up @@ -10,6 +10,12 @@
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);
if (! interface_exists(InteropContainerInterface::class, false)) {
class_alias(ContainerInterface::class, InteropContainerInterface::class);
}
if (! interface_exists(InteropContainerException::class, false)) {
class_alias(ContainerExceptionInterface::class, InteropContainerException::class);
}
if (! interface_exists(InteropNotFoundException::class, false)) {
class_alias(NotFoundExceptionInterface::class, InteropNotFoundException::class);
}

0 comments on commit 6f96556

Please sign in to comment.