Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

## [4.1.2] - 2026-03-18

### Fixed

- Inject logger to callable instances.
- Merge loggers key too.

## [4.1.1] - 2025-03-21

Expand Down Expand Up @@ -134,7 +137,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Added
- All classes.

[Unreleased]: https://github.com/FreeElephants/php-di/compare/4.1.1...HEAD
[Unreleased]: https://github.com/FreeElephants/php-di/compare/4.1.2...HEAD
[4.1.2]: https://github.com/FreeElephants/php-di/compare/4.1.1...4.1.2
[4.1.1]: https://github.com/FreeElephants/php-di/compare/4.1.0...4.1.1
[4.1.0]: https://github.com/FreeElephants/php-di/compare/4.0.1...4.1.0
[4.0.1]: https://github.com/FreeElephants/php-di/compare/4.0.0...4.0.1
Expand Down
8 changes: 7 additions & 1 deletion src/Injector.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ public function merge(
array $components,
string $instancesKey = InjectorBuilder::INSTANCES_KEY,
string $registerKey = InjectorBuilder::REGISTER_KEY,
string $callableKey = InjectorBuilder::CALLABLE_KEY
string $callableKey = InjectorBuilder::CALLABLE_KEY,
string $loggersKey = InjectorBuilder::LOGGERS_KEY
): void
{
$beansInstances = $components[$instancesKey] ?? [];
Expand All @@ -167,6 +168,11 @@ public function merge(
foreach ($callableBeans as $interface => $callable) {
$this->registerService(new CallableBeanContainer($interface, $callable, $this), $interface);
}

$loggers = $components[$loggersKey] ?? [];
foreach ($loggers as $interface => $logger) {
$this->loggersMap[$interface] = $logger;
}
}

public function allowNullableConstructorArgs(bool $allow): void
Expand Down
2 changes: 0 additions & 2 deletions tests/InjectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,5 @@ public function testGetServiceWithInvalidCallable()
],
]);
}


}

Loading