Skip to content

Commit 96fc219

Browse files
Nyholmdbu
authored andcommitted
Minor fixes that address comments made in #66 (#72)
Minor fixes from #66
1 parent 2ed6663 commit 96fc219

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/ClassDiscovery.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Http\Discovery;
44

5-
use Http\Discovery\Exception\ClassinstantiationFailedException;
5+
use Http\Discovery\Exception\ClassInstantiationFailedException;
66
use Http\Discovery\Exception\DiscoveryFailedException;
77
use Http\Discovery\Exception\StrategyUnavailableException;
88

@@ -182,9 +182,11 @@ protected static function evaluateCondition($condition)
182182
/**
183183
* Get an instance of the $class.
184184
*
185-
* @param string|\Closure $class A FQN of a class or a closure that instantiate the class.
185+
* @param string|\Closure $class A FQCN of a class or a closure that instantiate the class.
186186
*
187187
* @return object
188+
*
189+
* @throws ClassInstantiationFailedException
188190
*/
189191
protected static function instantiateClass($class)
190192
{
@@ -197,9 +199,9 @@ protected static function instantiateClass($class)
197199
return $class();
198200
}
199201
} catch (\Exception $e) {
200-
throw new ClassinstantiationFailedException('Unexcepced exception when instantiating class.', 0, $e);
202+
throw new ClassInstantiationFailedException('Unexcepced exception when instantiating class.', 0, $e);
201203
}
202204

203-
throw new ClassinstantiationFailedException('Could not instantiate class becuase parameter is neitehr a callable or a string');
205+
throw new ClassInstantiationFailedException('Could not instantiate class becuase parameter is neither a callable nor a string');
204206
}
205207
}

src/Exception/ClassinstantiationFailedException.php renamed to src/Exception/ClassInstantiationFailedException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
*
1010
* @author Tobias Nyholm <[email protected]>
1111
*/
12-
class ClassinstantiationFailedException extends \RuntimeException implements Exception
12+
final class ClassInstantiationFailedException extends \RuntimeException implements Exception
1313
{
1414
}

0 commit comments

Comments
 (0)