Skip to content

Commit

Permalink
Apply MapModule for multiple bindings
Browse files Browse the repository at this point in the history
Implemented a condition check to apply the MapModule if multiple bindings are present in the InstallBuiltinModule file. This is done to enhance the functionality and ensure smoother module operations.
  • Loading branch information
koriym committed May 23, 2024
1 parent 5027b5b commit 74deb2d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/CompileVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function visitInstance($value): string
return 'return null;';
}

assert(! is_object($value), 'Invalid instance type:' . gettype($value));
assert(is_object($value), 'Invalid instance type:' . gettype($value));

return sprintf('return unserialize(\'%s\');', serialize($value));
}
Expand Down
1 change: 1 addition & 0 deletions src/InstallBuiltinModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public function __invoke(AbstractModule $module): AbstractModule
$module->install(new PramReaderModule());
$hasMultiBindings = count($module->getContainer()->multiBindings);
if ($hasMultiBindings) {
// Apply MapModule if multiple bindings are present
$module->override(new MapModule());
}

Expand Down

0 comments on commit 74deb2d

Please sign in to comment.