Skip to content

Commit

Permalink
closures can’t reference self/$this in order for them to be serialized
Browse files Browse the repository at this point in the history
  • Loading branch information
mlebkowski committed Feb 3, 2025
1 parent 90f1f44 commit 19529c2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ServiceFactory/SlimServiceFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ public function __invoke(ServicesBuilder $builder): iterable {
yield self::INPUT_DENORMALIZER => get(DenormalizerInterface::class);

yield ControllerInvoker::class => static function (ContainerInterface $container) {
$serializer = $container->get(self::INPUT_DENORMALIZER);
$serializer = $container->get(SlimServiceFactory::INPUT_DENORMALIZER);
if (false === $serializer instanceof DenormalizerInterface) {
throw new RuntimeException(
sprintf(
'Service registered under %s key is expected to implement %s interface, %s given',
self::INPUT_DENORMALIZER,
SlimServiceFactory::INPUT_DENORMALIZER,
DenormalizerInterface::class,
get_debug_type($serializer),
),
Expand Down

0 comments on commit 19529c2

Please sign in to comment.