Skip to content

Commit f4ab629

Browse files
author
Andrii Savluk
committed
clean up code
1 parent 047dd26 commit f4ab629

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
"name": "savks/php-contexts",
33
"type": "library",
44
"license": "MIT",
5+
"require": {
6+
"php": "^8.1"
7+
},
58
"autoload": {
69
"psr-4": {
710
"Savks\\PhpContexts\\": "src/"
811
}
9-
},
10-
"require": {
11-
"php": "^8.1"
1212
}
1313
}

src/Context.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public static function useSelf(bool $withInherited = false): static
2626

2727
/**
2828
* @param class-string<TContext> $contextFQN
29+
*
2930
* @return TContext|null
3031
*/
3132
public static function tryUse(string $contextFQN, bool $withInherited = false): ?Context
@@ -39,7 +40,7 @@ public static function tryUse(string $contextFQN, bool $withInherited = false):
3940

4041
if ($withInherited && is_subclass_of($step['object']::class, $contextFQN)) {
4142
return $step['object'];
42-
} elseif ($step['object']::class === $contextFQN) {
43+
} elseif ($contextFQN === $step['object']::class) {
4344
return $step['object'];
4445
}
4546
}
@@ -49,6 +50,7 @@ public static function tryUse(string $contextFQN, bool $withInherited = false):
4950

5051
/**
5152
* @param class-string<TContext> $contextFQN
53+
*
5254
* @return TContext
5355
*/
5456
public static function use(string $contextFQN, bool $withInherited = false): Context

0 commit comments

Comments
 (0)