Skip to content

Commit 931901d

Browse files
authored
Merge pull request #1 from Micro-PHP/v0-2
v0.2: Remove deprecation usage in usort
2 parents 8785b50 + 94dd8fe commit 931901d

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "Dependency injection service container",
44
"type": "library",
55
"license": "MIT",
6-
"version": "0.1",
6+
"version": "0.2",
77
"autoload": {
88
"psr-4": {
99
"Micro\\Component\\DependencyInjection\\": "src/"

src/Container.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,14 @@ protected function initializeService(string $serviceId): void
110110

111111
$decorators = $this->decorators[$serviceId];
112112

113-
usort($decorators, function(array $left, array $right): bool {
114-
return $left[1] > $right[1];
113+
usort($decorators, function(array $left, array $right): int {
114+
$l = $left[1];
115+
$r = $right[1];
116+
if($l === $r) {
117+
return 0;
118+
}
119+
120+
return $left[1] > $right[1] ? 1 : -1;
115121
});
116122

117123
/** @var array<Closure, int> $decorator */

0 commit comments

Comments
 (0)