Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
new exception indroduced
Browse files Browse the repository at this point in the history
  • Loading branch information
mkorkmaz committed Nov 30, 2018
1 parent eead6c5 commit cd23900
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
9 changes: 9 additions & 0 deletions src/Exception/ClassOrMethodCouldNotBeFound.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
declare(strict_types=1);

namespace Selami\Stdlib\Exception;

class ClassOrMethodCouldNotBeFound extends \InvalidArgumentException
{

}
11 changes: 9 additions & 2 deletions src/Resolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

use ReflectionMethod;
use ReflectionParameter;
use Selami\Stdlib\Exception\ClassOrMethodCouldNotBeFound;
use Selami\Stdlib\Exception\InvalidArgumentException;
use ReflectionException;

Expand All @@ -23,15 +24,21 @@ class Resolver
* @param string $methodName
* @return array
* @throws InvalidArgumentException
* @throws ClassOrMethodCouldNotBeFound
*/

public static function getParameterHints(string $className, string $methodName) : array
{

self::checkClassName($className);
self::checkMethodName($className, $methodName);

$method = new ReflectionMethod($className, $methodName);
try {
$method = new ReflectionMethod($className, $methodName);
} catch (ReflectionException $e) {
throw new ClassOrMethodCouldNotBeFound(
sprintf('%s::%s coulnd not be found.', $className, $methodName)
);
}
/**
* @var array $parameters
*/
Expand Down

0 comments on commit cd23900

Please sign in to comment.